Skip to content

List each hop of a redirect chain as a network row of its own - #633

Open
vishnuv688 wants to merge 1 commit into
mainfrom
fix/630-redirect-hop-rows
Open

vishnuv688 wants to merge 1 commit into
mainfrom
fix/630-redirect-hop-rows

Conversation

@vishnuv688

Copy link
Copy Markdown
Member

What & why

A redirect re-sends a request under the same BiDi request id, and core's handlers (used by Selenium JS and Nightwatch) and the Python adapter rebuilt one row per id. A login form's submit therefore showed only the page it landed on: the browser sent POST /authenticate, got 303, then loaded /login, and the trace listed one GET /login 200. The committed Nightwatch and Python fixtures show it, with no POST in either.

Each hop is now a row of its own:

  • Its id comes from networkRowId(requestId, redirectCount): the request id for the first hop, and the id with BiDi's redirectCount after it (R1, R1#1, ...).
  • Each hop runs on its own clock, from its own beforeRequestSent.
  • Every answer or failure closes the hop it names, by its own redirectCount. Hops whose events arrive out of order (the next hop sent before the previous is answered, or Python's per-callback threads reordering them) still close correctly.
  • A driver whose events carry no redirectCount keeps one row per chain, as before.

The Python adapter mirrors the rule as frames.network_row_id, held equal to core's by a new networkRowId section in packages/shared/mirror-vectors.json. The backend merges Python frames by id, so it needs no change.

Closes #630

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Polish (an improvement to an existing feature)
  • Breaking change (existing behavior changes for users)
  • Documentation
  • Internal (build, CI, dependencies, tooling)

Packages touched

  • shared (types and contracts)
  • core (framework-agnostic capture/reporting)
  • elements (published element/snapshot API: @wdio/elements)
  • service (WebdriverIO adapter)
  • nightwatch-devtools (Nightwatch adapter)
  • selenium-devtools (Selenium adapter)
  • selenium-devtools-py (Selenium Python adapter)
  • backend (server)
  • app (UI)
  • script (page-injected runtime)
  • trace (Trace mode)

Also packages/shared/mirror-vectors.json and the mirror runners in selenium-devtools and selenium-devtools-py.

Capability matrix

  • packages/conformance/src/features.ts updated, and tables regenerated with pnpm docs:capabilities, if this adds or changes user-facing behaviour

Not applicable: network capture is listed already; this changes which rows a redirect chain produces.

Notes for reviewers

  • Why core and not each adapter: the change is in core's BiDi handlers, which Selenium JS and Nightwatch share; Python cannot import core, so its copy is held equal by the mirror vectors.
  • The WebdriverIO service is not touched here. It has BiDi handlers of its own and already writes one row per response, but drops a response with no content-type, so a bare 303 is missing there. That is WebdriverIO service drops network responses that have no content-type #629, stacked on this PR, which reuses networkRowId for its row ids.
  • Hop request headers are what the browser reports. A hop after a 303 can carry the POST's content-type and origin in Chrome's BiDi event; nothing copies headers across hops. The network-capture rule says so.
  • Tests: the two core tests that pinned one row per chain are rewritten. New ones cover a POST, 303, GET chain, hops answered out of order, a driver with no counts, and the same hop sent again; Python gets the chain and a thread-reordered chain.
  • Checks run: pnpm test (348 files, 4741 tests), pnpm typecheck and lint (0 errors) pass. Python: 970 passed; the two failures in tests/test_instrumentation.py (driver retention) fail the same way on main.
  • Not run in a real browser. CI's examples-smoke job drives each adapter against the fixture site, whose login form posts and redirects; a manual check is to run any example in trace mode and look for the POST /authenticate row with its 303 in the Network tab.

Screenshots / recordings

Not applicable: no UI change.

🤖 Generated with Claude Code

A redirect re-sends a request under the same BiDi id, and core and the
Python adapter rebuilt one row per id, so a form submit showed only the
GET it landed on: its POST and the 3xx were lost. Each hop now gets a
row whose id is the request id plus its redirectCount, on its own clock,
and every answer or failure closes the hop it names by its own count, so
hops sent before the previous one is answered still close correctly. A
driver that sends no counts keeps one row per chain. The Python copy of
the id rule is held equal to core's by the mirror vectors.

Closes #630
@vishnuv688 vishnuv688 self-assigned this Nov 30, 2026
@vercel

vercel Bot commented Nov 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devtools Ready Ready Preview Nov 30, 2026 7:56am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · This PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

Redirect hops now get separate network rows in core and the Python adapter.

  • Redirect chains show a separate network row for each hop.

Acknowledged scope: vishnuv688 explicitly defers the WebdriverIO service's missing responses without content-type to #629.

Diagram

sequenceDiagram
    participant Browser
    participant Capture
    participant Rows
    Browser->>Capture: POST, request R1, count 0
    Capture->>Rows: Open R1
    Browser->>Capture: GET, request R1, count 1
    Capture->>Rows: "Open R1#1"
    Browser->>Capture: 303, request R1, count 0
    Capture->>Rows: Close R1
    Browser->>Capture: 200, request R1, count 1
    Capture->>Rows: "Close R1#1"
Loading

Reviews (1) · Last reviewed commit: "List each hop of a redirect chain as a n..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redirect chains collapse into one network row, losing a form's POST

1 participant