fix: return 404 instead of 500 for stale scanner UUIDs#291
Open
revmischa wants to merge 2 commits intomeridianlabs-ai:mainfrom
Open
fix: return 404 instead of 500 for stale scanner UUIDs#291revmischa wants to merge 2 commits intomeridianlabs-ai:mainfrom
revmischa wants to merge 2 commits intomeridianlabs-ai:mainfrom
Conversation
When a scan is re-run, UUIDs are regenerated. Users with stale browser tabs would get unhandled KeyError (500) when fetching scanner input for old UUIDs. Wrap get_field calls in try/except KeyError to return a proper 404. Fixes Sentry HAWK-14. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_field()calls in thescanner_inputendpoint withtry/except KeyErrorto return a proper 404 instead of an unhandled 500shortuuid.uuid(). Users with stale browser tabs still reference old UUIDs, causingKeyErrorin parquet lookupChanges
src/inspect_scout/_view/_api_v2_scans.py: Addedtry/except KeyErroraroundget_field()calls, returning HTTP 404 with a descriptive messagetests/view/test_api_v2_scanner_input.py: Added tests for unknown UUID (404), unknown scanner (404), and valid UUID (200 with input + header)Test plan
ruff checkpassesruff formatpassesmypy srcpassespytest tests/view/test_api_v2_scanner_input.py— blocked byinspect_aidependency mismatch (CompactionEventmissing); affects all tests in repo, not specific to this change🤖 Generated with Claude Code