-
Notifications
You must be signed in to change notification settings - Fork 63
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
frontend: 404 when build_chroot is not found in database from task_id #3649
base: main
Are you sure you want to change the base?
Conversation
Pull Request validationFailed🔴 Review - Missing review from a member (2 required) Success🟢 CI - All checks have passed |
Adresses concern raised in fedora-copr#3457 (comment) Providing nonexisting chroot will result in NoResultFound too. This change returns 404 instead of 500. Relates to fedora-copr#3457
tested on stg and it returns 404 as it should instead of 500:
also instead of messy log, we get in logs
|
Thank you for testing @nikromen, There are a lot of layers of abstractions on the backend, but IMHO we will hit this error handling in case something is wrong: copr/common/copr_common/request.py Lines 84 to 96 in e81a524
And it behaves differently for |
Ok, I can see your point now. tldr;let's close this PR since it works, the only inconvenience is a rare occasion of bad HTTP code in error logs Honestly, the original error is a bit of a mystery for me then :D I originally thought the build https://copr.fedorainfracloud.org/coprs/petersen/haskell-language-server/build/6742605/ was happening during f39 branching and thus we got the database error (which should be addressed by #3225 I think)... but looking to copr's branching history - F39 was branched on Aug 11, 2023 so it's some weird glitch :/ Anyway, yes, with the change in this PR, the task above would fail at the backend side - since it was successful after the second retry (see the logs of the f39-aarch build) and because My issue with this is - we use the BuildsLogic and CoprsLogic methods not only for backend-related code but, in general, everywhere else - even inside But to add more headache to this, - due to a lot of layers of abstraction in this - it would be hard to change the behaviour so backend receives 5xx when it should, and the rest gets 4xx, meanwhile not to break anything else :D And since what we have now works fine and nobody complains (except confusing HTTP code in our logs), I don't want to touch it anymore :D WDYT about not accepting this change and closing the issue that we are fine with it? |
try: | ||
build_chroot = BuildChrootsLogic.get_by_build_id_and_name(build_id, chroot_name) |
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.
This is a valid code movement.
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.
true, that's maybe the only thing I would want to accept right now from this PR
except DataError as ex: | ||
raise MalformedArgumentException( | ||
f"Invalid build_id: {build_id} or name: {name}" | ||
) from ex |
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 sure where the DataError comes from. Do we really need this part at all?
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.
reproducer: https://copr.fedorainfracloud.org/backend/get-build-task/6742s605-fedora-39-aarch64
but looking at usage of this method... it's only used for backend related part so it really isn't a big deal tbh and it can be dropped
Addresses concern raised in
#3457 (comment)
Providing nonexisting chroot will result in NoResultFound too.
This change returns 404 instead of 500.
Fix #3457