Skip to content

fix(browser): retain effective source-map response urls - #1742

Merged
N0zoM1z0 merged 2 commits into
morluto:mainfrom
evenafterallisaid:fix/source-map-effective-url
Oct 11, 2026
Merged

N0zoM1z0 merged 2 commits into
morluto:mainfrom
evenafterallisaid:fix/source-map-effective-url

Conversation

@evenafterallisaid

@evenafterallisaid evenafterallisaid commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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 | null for 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:

  • 130 browser/fetcher/CDP/MCP tests passed, plus the domain bundle-analysis suite, full single-threaded typecheck, lint, architecture guards and generated-document checks.
  • A real loopback HTTP redirect records the effective resolution URL. The public CLI and SDK MCP fixture workflow preserves query values, authenticates Evidence and checks text/structured delivery parity. The CDP wire is a fixture; this local check does not claim a live Chromium session.
  • A real 1,500-request malformed-Location probe now retains complete failure messages within the output limit and marks remaining results unknown.
  • An injected finite-response probe with an escaped URL exceeding output capacity now reads zero body bytes and cancels immediately; regression cases cover successful cancellation and rejection with both an Error and undefined.
  • Both the original 50,000-map origin, whose expanded result exceeds capacity, and a shorter origin whose complete result fits remain covered. No input-size reduction is reported as a performance improvement.
  • Flameox identified repeated fixed-envelope serialization as a production CPU hotspot. The complete result oracle was preserved in the measured consolidation experiment; no general CLI speed or token-reduction percentage is claimed.

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.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T07:34:43.009027Z faeda51 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@N0zoM1z0 N0zoM1z0 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. effective_url is currently required by the new output schema. Parsing an unchanged pre-change source-map result fails at items[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 N0zoM1z0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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, {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@N0zoM1z0
N0zoM1z0 merged commit 062723e into morluto:main Oct 11, 2026
31 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto morluto added the area: runtime Process capture and runtime observation label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(browser): source map redirects omit the effective resolution URL

4 participants