-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle potential errors during new deployment flow #2422
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried the current state of this PR, maybe you already noticed it but want to raise that a panic
on the go code is still happening, a bit buried beneath output logs.
We should fix that, seems to be because of the configuration not being returned after validation at post_config_files.go
. Following the conversation from Slack, treating content type unknown
as a warning and not a reason to invalidate the configuration might help with this an unblock flows that could be productive to the user.
} catch (error: unknown) { | ||
// continue on, as this is not a critical failure | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% on board with ignoring errors. We maybe can ignore specific known errors when we know it's ok, but there could also be surprising unknown errors landing catch blocks that should be noticed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is totally fair. I think in this case because these operations aren't completely blocking on the rest of the config + deployment file creation any error we get, even if it is unexpected, shouldn't stop the rest of the function from continuing.
I have two follow-up questions:
- do you agree with the above?
- what do you propose we add to the catch?
The most obvious addition could be some logging, but I didn't think showing a notification to the user or something that heavy was necessary for a non-blocking action failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, logging might be the best option here. Maybe also some more details in code comments about why this isn't and shouldn't be a blocking operation, this to help future collabs to better determine if this needs to change in case something else lands within the try
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included some debug logging in 5241816
I also improved the comment a bit to be more explicit about why it is fine to continue on in the new deployment flow.
Could you say more about this + what the practical impact is on users who fall into this circumstance? I think it's ok / an improvement, but I want to make sure we think about that and confirm it. |
Absolutely. The impact is deployments initially made with the unknown type won't have the generated config with This is due to the API calls to include the files failing because To the point @marcosnav made we can change the behavior and avoid this tradeoff. Part of the reason I mentioned it as happening "in this current state" was to avoid going down a rabbit hole of fixing several bugs / weird behaviors at once without opening it up to some discussion. |
Sorry, I meant this from the perspective of our users. Correct me if I'm wrong on anything here, but I was hoping for something like: we want to encourage folks to include their config + deployment files in what they publish to connect so we include them in the |
This is all correct. The extra bits I would emphasize are:
To be clear this PR is the most minimal fix to #2419. My hope is to either add to this PR, or follow it up and fix this so See this conversation in Slack for a bit more: https://positpbc.slack.com/archives/C05D7NZD52S/p1731025235725539 |
17cd4f2
to
1f79690
Compare
Ah yes, that's definitely good to highlight / would appear as an at least semi-broken / weird state for most users.
nods yeah, minimal is great! And I'm not trying to push us to not do that — just wanted to confirm that we are doing a minimal thing that also doesn't make our user's end experience worse (and be explicit about that + what those things are). |
This PR fixes two things:
type="unknown"
deployment is created the entrypoint could be blank when we reachnormalizeConfig
, which would cause the entrypoint field to be missing from the Configuration and thefiles
array to only contain a/
type="unknown"
) the API calls to update the file lists with the Posit deployment record / configuration file were failingWhy were the APIs failing?
The API calls were failing because when we get a
Config
from a file we validate said file before decoding it:publisher/internal/config/config.go
Line 63 in fa07fcf
This makes sense, we have to have a valid file to get a valid
Config
, but the strict nature of not allowingtype: "unknown"
means our config creation herepublisher/internal/inspect/detectors/all.go
Line 79 in 66fdddb
We have some ways we get around this in others parts of the code:
publisher/internal/services/api/put_configuration.go
Line 80 in 8b382de
It would be ideal, when we don't care about the type, to be able to ignore that part of our validation. Or even better allow the unknown type completely until it matters.
Intent
Resolves #2419
Type of Change
Approach
The approach here was two fold.
The backend now produces a more correct configuration in cases where
type = 'unknown'
.The frontend also handles the API calls when creating a new deployment separately, only bailing out when absolutely necessary - like when a file fails to be created.
The tradeoff here is that
type = 'unknown'
configurations will not have the.posit
files listed in theirfiles
field - at least with the way it is currently implemented.Automated Tests
A test for the backend has been added.