Repository navigation
fix(gpu): report malformed GPU containers as invalid_format - #10644
Merged
Merged
Conversation
…he shared parse-failure mapping GpuCodeObjectsProvider mapped a malformed BinaryFormatFailure to a BinaryTargetError (target_unavailable / file_format_rejected) while every other format parser reports malformed bytes as an invalid path (invalid_request / invalid_format). It now uses parseFailureAnalysisError.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. Summary
Reviews (1) · Last reviewed commit: "fix(gpu): report malformed GPU container..." · Reviewed by Greptile |
12 tasks
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
inspect_gpu_code_objectsreported malformed GPU container bytes astarget_unavailable(BinaryTargetError,constraint: "file_format_rejected"). Format parsers migrated onto theParseFailurealgebra (#10593) report malformed or truncated bytes as an invalidpathinstead (invalid_request,invalid_format). This change routes the GPU provider through the sharedparseFailureAnalysisErrormapping, so the same failure gets the same public category. The maintainer approved this classification change.Problem and expected behavior
Trigger: a Clang offload bundle whose entry range exceeds the file, or a PE host whose MZ header no longer declares a PE image.
Before:
{"code":"target_unavailable","details":{"path":"…/selected.exe","constraint":"file_format_rejected","reason":"MZ header does not declare a PE image"}}After (the shape of other parsers such as
inspect_elf_notesand the Go reader):{"code":"invalid_request","category":"invalid_input","details":{"operation":"inspect_gpu_code_objects","issues":[{"path":["path"],"reason":"invalid_format","message":"Selected artifact …/selected.exe: MZ header does not declare a PE image"}]}}Unsupported containers still map to
unsupported_target. Limits (BinaryResourceFailure) keep their GPU-specific resource refusal, becauseparseFailureAnalysisErrorleaveslimitto its producer.Change and scope
src/gpu/GpuCodeObjectsProvider.ts: the provider's ownBinaryFormatFailurebranch is replaced byparseFailureAnalysisError(OPERATION, input.path, primary). This also covers any otherParseFailureErrorkind (for exampletruncated) that previously fell through toProviderAdapterError. The imports ofBinaryTargetError,AnalysisUnsupportedTargetErrorandBinaryFormatFailureare removed.file_format_rejectedproducers. They belong to target admission (BinaryTargetResolver), wherefile_format_rejectedmeans the selected target is not an executable REA admits, not a parse failure inside an inspection.Contract and boundary impact
parseFailureAnalysisError(src/domain/parseFailureAnalysisError.ts) owns the public category of a parser's format failure. The GPU provider now consumes it.target_unavailable/file_format_rejectedtoinvalid_request/invalid_format. Schemas are unchanged.Expected effects:
Evidence and regression coverage
tests/boundary/gpu/codeObjects.test.ts: an out-of-range bundle entry and impossible Clang bundle counts now expectAnalysisInputErrorwithpath/invalid_format.tests/acceptance/gpuCodeObjectsCli.test.ts: the CLI refusal for an MZ header that no longer declares PE now expectsinvalid_request/invalid_inputwith aninvalid_formatissue.src/gpu/GpuCodeObjectsProvider.tsrestored fromorigin/main, the boundary file fails 2 of 118 tests (the two updated cases). With this change it passes.For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/gpu/codeObjects.test.ts tests/acceptance/gpuCodeObjectsCli.test.ts: 2 files, 143 tests passed.origin/mainprovider: 2 failed / 116 passed.npm run check:fast: typecheck and lint passed.npx oxfmt --checkon the changed files: passed.Compatibility, safety, and release
target_unavailable/file_format_rejectedfor malformed GPU containers now receivesinvalid_requestwith aninvalid_formatissue onpath. Maintainer approved; not marked breaking because error categories are not a versioned contract here. Reviewers may want a changelog note.Author readiness
Human owner:
Before merge
type(scope): outcome.