Repository navigation
fix(browser): retain effective source-map response urls - #1742
Conversation
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9bc3ddaed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }), | ||
| signal, | ||
| ); | ||
| observeResponse(current); |
There was a problem hiding this comment.
Retain the response URL instead of the request string
When a source-map URL or redirect target contains #..., Fetch removes the fragment before issuing the request, so the returned response URL is fragment-free while current still contains it. This callback therefore publishes an effective_url that was never observed and can charge nonexistent fragment bytes to the evidence budget; retain the response URL (with a fragment-stripping fallback for injected responses whose url is empty) instead.
AGENTS.md reference: AGENTS.md:L11-L11
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I built and exercised exact head d9bc3ddaede91449572f5fe13a5adc489f97417d. The real loopback redirect correctly retains the observed resolution URL. The 1,500-request malformed-Location probe also now stops with explicit unknown coverage below the existing 32 MiB bound, addressing #1738 as well as #1729.
Two paths still need adjustment before merging:
- Charge the JSON-escaped observed response URL before reading its body. In a production fetch-boundary probe with a 35,651,625-byte escaped URL, this head read all 2,097,216 response bytes (33 stream pulls) before discovering the URL could not fit. A stalled-body variant waited for the 30-second deadline; when its cancellation rejected, the returned unavailable result omitted that cleanup failure. Preserve cancellation ownership and the primary capacity reason if cancellation also fails. These are controlled injected-response probes, not claims about a real browser or an HTTP server accepting a multi-megabyte request target.
effective_urlis currently required by the new output schema. Parsing an unchanged pre-change source-map result fails atitems[0].effective_url. Please keep that field optional without a default for historical output, while the current producer always emits a string or null; this preserves omission and historical semantic identity. Generic authenticated Evidence ingestion is a separate contract, and this finding does not claim its integrity check failed.
I have tested a local correction and can supply the focused regression coverage. The fixed envelope pricing also appeared as an actual CPU hotspot under Flameox; pricing invariant envelope bytes once removes repeated serialization without changing the complete result oracle.
N0zoM1z0
left a comment
There was a problem hiding this comment.
The amended source passes 130 boundary regressions, the bundle-domain suite, full typecheck/lint/architecture and generated documentation checks. Actual HTTP and finite-stream probes confirm complete diagnostics stay within capacity, legacy omission remains unchanged, over-cap identity admission reads zero body bytes, and cancellation rejection preserves the primary typed resource constraint and cleanup cause. Public CLI and SDK MCP fixture delivery checks pass with authenticated Evidence and text/structured parity. Existing completed results and explicit unknown coverage remain intact. Waiting for all workflows on exact head faeda51 before guarded merge.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: faeda516a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await response.body?.cancel(); | ||
| } catch (cleanupCause: unknown) { | ||
| if (cause instanceof SourceMapFormatFailure && cause.reason === "limit") | ||
| throw sourceMapOutputError(cause, { |
There was a problem hiding this comment.
Retain a cleanup owner for the failed response
When response.body.cancel() rejects in this over-budget-URL path, the thrown error unwinds to the outer finally, which clears the timer and drops both the Response and the still-unaborted operation controller. The cleanupResources label cannot close or retry the possibly live HTTP body, so repeated failures can leave connections orphaned; abort and await the transport or retain an actual cleanup owner before propagating.
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
| items.push(item); | ||
| } | ||
| } catch (cause: unknown) { | ||
| if (signal?.aborted === true) throw cause; |
There was a problem hiding this comment.
Propagate caller cancellation from the output-limit catch
When a response URL exceeds the remaining output budget and the caller aborts while a successful response.body.cancel() is pending, fetchOne rethrows the original SourceMapFormatFailure; this branch notices the aborted signal but rethrows that internal cause. The CLI/MCP outcome is therefore a provider failure rather than cancellation, contrary to the normal path at line 158 and the fetcher's exact-abort-reason contract; rethrow signal.reason here for causes that do not carry a cleanup failure.
AGENTS.md reference: AGENTS.md:L5-L5
Useful? React with 👍 / 👎.
Retain each source map's declared URL separately from the last approved response URL actually observed, so the result records the base used to resolve original sources. Preserve query values, source artifacts, mappings and module edges. Closes #1729 and #1738.
The browser fetch boundary emits
effective_url: string | nullfor current results. Historical observations may omit the field; parsing does not insert a default or alter their stored identity. An initial policy rejection or failed first fetch emits null, while a rejected redirect retains the last approved response identity.Charge JSON-escaped response identities before reading response bodies and complete failure diagnostics against the existing 32 MiB output budget. Preserve completed results when another map cannot fit, and report requested/processed coverage with explicit unknown omissions. If response cancellation fails, retain the primary capacity reason, aggregate cleanup cause and resource identity. Price invariant envelopes once rather than serializing them for every map.
Validation on the amended source:
CI verifies the amended exact head before merge, including real browser and native package lanes. No installation, executable mutation or browser interaction authority changed. Generated catalogs, build outputs and profiles are not committed; the temporary profiling environment has been removed.