Repository navigation
refactor(rust): report cargo-auditable section failures through ParseFailure - #10652
Conversation
…Failure RustAuditableFormatFailure restated the malformed/unsupported algebra and the provider translated it by hand; container BinaryFormatFailures were re-wrapped and lost their kind. The reader now throws ParseFailureError (format rust-auditable), container failures propagate unchanged, and the provider maps both through parseFailureAnalysisError. A counted guard keeps new per-format failure classes from returning.
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. |
[Medium impact] The reviewed changes appear safe to merge. SummaryMoves Rust dependency-section errors onto
No new actionable issues or security problems were found. Review conclusions are based on source inspection; tests were not run during this review. Live supersession status could not be checked because GitHub access required authentication. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Native container reader] -->|Original parse failure| C[ParseFailureError]
B[Rust dependency reader] -->|Malformed or unsupported section| C
C --> D[parseFailureAnalysisError]
D --> E[Invalid format or unsupported target]
F[Resource refusal] --> G[RustAuditableResourceFailure]
G --> H[AnalysisResourceConstraintError]
Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
# Conflicts: # scripts/verify/architecture-guard-baselines.json
Summary
This migrates the Rust
cargo auditabledependency-section reader onto the sharedParseFailurealgebra (src/domain/parseFailure.ts, #10593). It is the first per-format slice of W7 step 2. It also adds a counted architecture guard so that no new per-format failure class can appear, while the remaining ones shrink.Problem and expected behavior
RustAuditableFormatFailurerestatedmalformed | unsupportedunder its own class.RustBinaryProviderthen translated it by hand intoAnalysisInputError/AnalysisUnsupportedTargetError. That duplicatedparseFailureAnalysisError.RustBinaryImage.readContainercaught the container'sBinaryFormatFailure(already aParseFailureError) and re-wrapped it as a Rust failure, collapsingtruncatedintomalformedand droppingundecodedContent.Expected and now true:
ParseFailureErrorwith formatrust-auditable.parseFailureAnalysisError, so the public category is unchanged: malformed →invalid_request/invalid_formatonpath; unsupported →unsupported_target.Change and scope
src/rust/RustAuditableReader.ts:RustAuditableFormatFailureis deleted. Throws usemalformedInput/unsupportedInput. A localmalformedSection(detail, cause)keeps the decoder/schema cause, because the helpers onmaindo not yet acceptcause(fix(parsers): stop reading every RangeError as a format failure #10602 adds that).RUST_AUDITABLE_FORMATis exported for the image reader.src/rust/RustBinaryImage.ts:BinaryFormatFailureis no longer re-wrapped. Section-level refusals use the shared helpers.src/rust/RustBinaryProvider.ts: the hand-written mapping is replaced byparseFailureAnalysisError(...) ?? artifactFailure(...).parser-format-failure-classinscripts/verify/architecture-guards.mjs:class *FormatFailure|*FormatError|*ParseFailure extends Erroroutsidesrc/domain/parseFailure.ts. The baseline lists the 11 remaining files (IL2CPP ×2, pyc, model, Capture, SourceMap, AppleIps, WebArtifactReads, xmlDocument, and two Mach-O classes). Removing one lowers the count with--shrink-baselines.RustAuditableResourceFailure. It carries a typedmemory/transportconstraint that maps toAnalysisResourceConstraintErrorwith caller-adjustableproducer_limits, whichParseFailure'slimitkind does not model.visit). It belongs to the duplicate-key policy work.Contract and boundary impact
ParseFailure(domain) owns the failure kind;parseFailureAnalysisErrorowns its public category. The Rust-specific class and translation are removed.truncatedkeeps its own kind internally and still maps toinvalid_format.Expected effects:
Evidence and regression coverage
src/rust/RustAuditableReader.test.tsnow assertsParseFailureErrorwithfailure.kind: "malformed"andformat: "rust-auditable".tests/boundary/rust/rustBinaryImage.test.tsassertsParseFailureErrorfor the universal Mach-O refusal and the SHT_NOBITS section.rustBinaryCli,rustDependencyViewsandrustUnnamedSectionspass unchanged.git show origin/main:src/rust/RustAuditableReader.tsmatches the pattern once).For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/rust/rustBinaryImage.test.ts tests/boundary/rust/rustBinaryBudget.test.ts tests/acceptance/rustBinaryCli.test.ts tests/acceptance/rustDependencyViews.test.ts tests/acceptance/rustUnnamedSections.test.ts src/rust/RustAuditableReader.test.ts: 6 files, 83 tests passed.node scripts/verify/architecture-guards.mjs: passed.npm run check:fast: typecheck and lint passed.npx oxfmt --check src/rust tests/boundary/rust scripts/verify: passed.keeps the container's truncated failure and its facts unchanged;npm run test:focused -- tests/boundary/rust/rustBinaryImage.test.ts: 39 tests passed.Compatibility, safety, and release
RustAuditableFormatFailurewas internal.Author readiness
Human owner:
Before merge
type(scope): outcome.