Repository navigation
refactor(source-maps): report decoder failures through ParseFailure - #10690
Merged
Merged
Conversation
SourceMapFormatFailure and its format/unsupported/limit/section-overlap reasons are replaced by ParseFailureError with format source-map. Limits carry the selected allowance name and maximum; a section-boundary overlap is a malformed failure on the section-boundary field. The codec reply protocol and every public error are unchanged.
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
[Low impact] The PR appears safe to merge; no actionable issue was found. SummaryReplaces
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Source-map checks] --> B[ParseFailureError]
B --> C[Codec reply mapping]
C --> D[Unchanged public errors]
B --> E[Browser predicates]
E --> F[Limit or invalid map result]
Reviews (1) · Last reviewed commit: "refactor(source-maps): report decoder fa..." · Reviewed by Greptile |
This was referenced Nov 15, 2026
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
Source-map decoding reports failures through the shared ParseFailure algebra (format
source-map).SourceMapFormatFailureand itsformat | unsupported | limit | section-overlapreasons are deleted.limitfailures carry the selected allowance aslimit: { name, maximum }(for exampledecoded_records,output_bytes), built by one helper,sourceMapLimitFailure, that also appends the existing recovery text.malformedfailure on thesection-boundaryfield;isSourceMapSectionOverlapis its one reader.parser-format-failure-classlosessrc/javascript/sourceMaps/SourceMapFormat.ts.Part of plan W7 (parser kernel). Sibling of #10664, #10665 and #10667.
Problem and expected behavior
SourceMapFormatFailurerestated the ParseFailure algebra with its own spellings and folded a malformed sub-case (section-overlap) into the kind, so the codec process had to special-case it back toformat. Limit failures carried the allowance only inside message text.Expected: one algebra; the allowance name and maximum are typed facts; consumers classify through named predicates (
isSourceMapFailure,isSourceMapLimit,isSourceMapSectionOverlap) instead ofinstanceofplus string reasons.Change and scope
src/javascript/sourceMaps/SourceMapFormat.ts:SOURCE_MAP_FORMAT, the predicates above,sourceMapSectionOverlap,sourceMapLimitFailure; every throw site usesmalformedInput/unsupportedInput/ the helpers.DecodedSourceMap.ts,TraceSourceMap.ts,SourceMapCodecProcess.ts,src/browser/WebSourceMapFetcher.ts: throw and classify through those helpers.SourceMapCodecProcess.tsstill writes the same codec reply (reason: "format" | "unsupported" | "limit"); it now derives it from the ParseFailure kind.Not included: the codec reply wire schema (
SourceMapCodecProtocol.ts) andSourceMapReply.ts's public mapping, which are unchanged; no CDP internals are touched.Contract and boundary impact
SourceMapReply.tsandWebSourceMapFetcher.tsremain the public translations.Evidence and regression coverage
TraceSourceMap.test.ts(unsupported/malformed kinds, section-overlap throughisSourceMapSectionOverlap) andSourceMapAdmission.test.ts(thedecoded_recordslimit assertslimit: { name: "decoded_records", maximum: 4 }).tests/boundary/javascript/sourceMapDecoder.test.ts,tests/boundary/filesystem/webSourceLocationArtifacts.test.ts,tests/boundary/browser/webSourceMap*.test.ts) pass unchanged.Validation performed
npm run test:focused -- src/browser/WebSourceMapFetcher.test.ts src/javascript/sourceMaps/SourceMapAdmission.test.ts src/javascript/sourceMaps/SourceMapCommand.test.ts src/javascript/sourceMaps/SourceMapDecoder.test.ts src/javascript/sourceMaps/TraceSourceMap.test.ts tests/boundary/browser/webSourceMapFetcher.test.ts tests/boundary/browser/webSourceMapNestedCoordinates.test.ts tests/boundary/browser/webSourceMapResponseCleanup.test.ts tests/boundary/javascript/sourceMapDecoder.test.ts tests/boundary/filesystem/webSourceLocationArtifacts.test.ts src/artifacts/ReleaseExposureReader.test.ts: the first run found 6 unit assertions still on the oldreasonfield; after updating them,npm run test:focused -- src/javascript/sourceMaps/SourceMapAdmission.test.ts src/javascript/sourceMaps/TraceSourceMap.test.tspassed (38 tests); the other 9 files passed in the first run.node scripts/verify/architecture-guards.mjs --shrink-baselines: passed and lowered the baseline.npm run check:fast: typecheck and lint passed.Compatibility, safety, and release
SourceMapFormatFailurewas internal.Author readiness
Human owner:
Before merge
type(scope): outcome.