Skip to content

test(browser): preserve page URL during subresource redirects - #2885

Closed
zhangguiping-xydt wants to merge 4 commits into
morluto:mainfrom
zhangguiping-xydt:fix/browser-redirect-final-url
Closed

zhangguiping-xydt wants to merge 4 commits into
morluto:mainfrom
zhangguiping-xydt:fix/browser-redirect-final-url

Conversation

@zhangguiping-xydt

@zhangguiping-xydt zhangguiping-xydt commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Refs #2593. Browser observation must distinguish a main-frame redirect leaving the approved origins from a cross-origin subresource redirect. The former makes the final page URL unknown; Fetch/Script redirects must preserve the approved page URL.

Why This Change Was Made

Main now includes the original runtime correction in b98be5408: excludeTargetScope() records exclusion, clears finalUrl, and prevents later events or final-frame capture from restoring a stale approved URL. This branch incorporates that implementation and its document-redirect assertions instead of keeping a duplicate assignment.

The final diff against main adds one assertion to the existing Fetch/Script negative controls: target.final_url must equal target.initial_url. Main-frame exclusion and omitted resource-type cases remain covered by upstream tests. Existing maintainer and PR history is preserved.

User Impact

Protects the existing observe-web-session and observe_web_session behavior: report unknown final locations after scope escape while retaining confirmed page locations after unrelated subresource redirects. No new runtime, schema, dependency, authority or release changes.

Evidence

Current commit: 9b4e5f43a3b0d3400b1baa6fa660f53ff769e15b. Integrated main: 29d3dcb7ea85b3be37cd81e977ae4e09cebdd2fc. Linux x64, Node.js 24.18.0/npm 11.16.0, real Chrome 138.0.7204.157.

  • Redirect resource-type boundary suite: 6 passed, including Fetch/Script negative controls and document exclusion/final-capture races.
  • npm run check:fast: passed.
  • Exact-commit built CLI and actual stdio MCP: passed. An owned localhost server serves /app on 127.0.0.1, then returns HTTP 302 to /outside on excluded localhost. Both adapters return target_left_scope, final_url: null, and a redirect event whose excluded URL remains omitted. An independent browser URL confirms the tab reached /outside.
  • The original before-fix real-browser proof (6e25cc3) returned the stale approved /app URL through both adapters. The historical proof is retained; the runtime fix is now supplied by main.

Integrated upstream EVM cleanup-ownership and PCAP exact-output/fixture-cleanup repairs (07540cbcd, 1341e8c83) that caused the latest CI failures on the companion branches. Their shared source passed the focused EVM/PCAP suites on the same integrated main; this is boundary coverage, not a claim of real EVM/PCAP provider verification.

Verification limits

Current-head CI run 38528150551 passed, including Source tests, Static checks, Build package, all five test shards, Portable tests and CI required. Conventional PR title and Greptile Review also passed. The current head is mergeable. Earlier-head checks remain historical evidence. The local Chrome 138 full-browser lane has an isolated-context origin/storage-seeding limitation; the targeted redirect proof above passes. Other operating systems and Chrome versions were not exercised locally. CI gates and assertions have not been weakened.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-13T18:53:13.285652Z fd815a9 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.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low impact] This test-only change appears safe to merge.

Summary

Adds an assertion that Fetch/Script redirects preserve the observed page URL.

  • Browser tests keep page URLs steady across Fetch and Script redirects.

Reviews (8) · Last reviewed commit: "test(browser): retain redirect scope cov..." · Reviewed by Greptile

@morluto
morluto force-pushed the fix/browser-redirect-final-url branch 2 times, most recently from 7c39cef to e442cc6 Compare October 13, 2026 18:26
@morluto
morluto force-pushed the fix/browser-redirect-final-url branch from e442cc6 to fd815a9 Compare October 13, 2026 18:51
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Oct 14, 2026
@kaoru0822-kitauji kaoru0822-kitauji added the ci-fix-wip Claimed by the CI-fix track label Oct 14, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

CI-fix track: the shard 4 and Portable failure (productCatalog.test.ts › build-generated product facts) isn't from this PR; it's main's generated-docs drift at the time. I merged current main (no conflicts). Main still has one productCatalog translated-readme failure, which #3080 fixes. This PR's change (clearing final_url when a redirect leaves the approved scope) and its cdpObservationResourceTypes assertions pass on the merged tree, along with all src/browser tests (414 passed overall). check:fast is clean.

@kaoru0822-kitauji kaoru0822-kitauji removed the ci-fix-wip Claimed by the CI-fix track label Oct 14, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@zhangguiping-xydt zhangguiping-xydt changed the title fix(browser): clear the final URL after an excluded redirect test(browser): preserve page URL during subresource redirects Oct 14, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@zhangguiping-xydt

Copy link
Copy Markdown
Contributor Author

Closing this standalone test follow-up after the original redirect runtime fix landed on main in b98be54. The remaining diff is one assertion that Fetch/Script redirects preserve the page final_url. That additional coverage remains useful; we are retiring this PR to prioritize the remaining contributions.

@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks, @zhangguiping-xydt, for isolating the subresource-redirect case that must preserve the approved page URL while an out-of-scope main-frame redirect remains unknown. Main now latches the exclusion and tests both redirect paths (main).

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.

3 participants