Repository navigation
fix(har): accept Chrome DevTools bracketed IPv6 server addresses - #7225
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds bracketed IPv6 support for HAR files declaring
Reviews (3) · Last reviewed commit: "fix(har): accept Chrome DevTools bracket..." · Reviewed by Greptile |
1e219fe to
c888469
Compare
Chrome DevTools HAR exports declare creator WebInspector 537.36 and
report IPv6 serverIPAddress values in brackets: its HAR writer strips
the port with lastIndexOf(':') but its bracket removal,
replace(/\[\]/g, ''), only matches the literal pair '[]'. The pinned
schema then rejects the whole archive at the first such entry.
Extend the existing Playwright 1.58.2 adaptation to this declared
producer. Brackets are removed only in the disposable validation copy
and only around a valid IPv6 literal; reported spellings are retained
and the per-entry limitation names the declared producer.
c888469 to
7681ef6
Compare
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
inspect_web_network_capturerefuses a whole HAR exported from Chrome DevTools as soon as one entry was served over IPv6. f14c2d4 (#3161) fixed the same thing for Playwright 1.58.2. Chrome's own "Export HAR" writes the same bracketed form, so this extends that adaptation to it.No linked issue: the failure reproduces on a public Chrome export, shown below.
Problem and expected behavior
Chrome DevTools declares its HAR creator as
WebInspectorwith the AppleWebKit version from Chromium's user agent, frozen at537.36for years. Its HAR writer (Log.ts) cuts the port offremoteAddress()withlastIndexOf(':'), then tries to drop the brackets withipAddress.replace(/\[\]/g, ''). That regex only matches the literal string[], so[2620:0:860:ed1a::1]:443is written as[2620:0:860:ed1a::1].A real Chrome export of a Wikipedia page load (88 entries, CredData test corpus,
test/data/validHARFiles/ipv6File.har):Expected: the capture decodes, as a Playwright 1.58.2 capture with the same addresses already does.
Change and scope
HarSchema.ts: the bracket adaptation is keyed by a small table of observed producers (name, version, label), now Playwright 1.58.2 andWebInspector537.36. Every Chromium-based DevTools declares that creator, so the label is "Chromium DevTools". The rules are unchanged: brackets come off only in the disposable validation copy, and only around a valid IPv6 literal.HarCapture.ts: the per-entry limitation names the declared producer instead of always saying Playwright 1.58.2. Playwright captures keep the exact text they had, so their Evidence identities do not change.docs/web-network-captures.mdsays why Chromium's export is bracketed, citing Log.ts at a pinned commit.Contribution scope: an ordinary fix inside the existing HAR import boundary; a maintainer scope decision is not applicable.
Left out, yours to decide: the same Chrome export of another site (
chargebee.com.har, 268 entries) also fails, on/log/entries/62/timings/blocked = -0.771. Chrome writes small negativeblockedvalues (18 of its 268 entries) and clamps them in its owntimesum withMath.max(t, 0). Accepting them means loosening a timing rule, which is a separate decision, so it is not in this PR.Contract and boundary impact
Semantic owner and earliest changed stage: HAR schema validation (
src/browser/history/HarSchema.ts), read byHarCapture.tsfor the per-entry limitation.Contribution scope fit and linked maintainer decision: not applicable (fix within the existing boundary).
CLI and MCP/tool-catalog contract: unchanged; the Chrome capture now decodes instead of returning
invalid_request.Provider, bridge, target-format, or platform compatibility: adds Chromium DevTools HAR (
WebInspector537.36) next to Playwright 1.58.2.Evidence, artifact, provenance, or reconstruction contract: original address spelling is kept in Evidence; Playwright limitation text is byte-identical to before.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Evidence and regression coverage
Tests added or updated:
HarCapture.test.ts: two Chromium DevTools addresses keep their original spelling and get the producer-named limitation; a differentWebInspectorversion, bracketed IPv4, and an address with a port stay rejected.Base reproduction or other evidence: both "retains" cases fail on main baec375 with
HAR schema validation failed: format (must match format "ipv4")and pass with the fix. Changing theWebInspectorrow's version, changing its label, or accepting any IP family inside the brackets each turns two tests red.User-visible CLI/MCP output: the 88-entry Chrome export decodes through the built CLI: 88 records, spellings like
[2620:0:860:ed1a::1]kept, limitation on the 87 bracketed entries.Remaining proof gaps: Chrome's negative
timings.blocked(above) is not handled. Only Chromium 537.36 exports were tested; otherWebInspectorversions stay rejected on purpose.Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
On 7681ef6 (rebased onto main baec375):
vitest run src/browser/history/— 252 passedvitest run tests/boundary/browser/— 1239 passed, 1 skippednpm run check:fast— passesnpm run docs:check— passesBefore the rebase:
lint:typed(no new findings in the changed files),oxfmt --check,tests/acceptance/browser/historicalRedirectLocationCliMcp.test.ts.Compatibility, safety, and release
AI use: the fix and tests were written by an AI agent; the tests were rerun independently before opening.
Author readiness
Human owner: @JayOfTheKeyboard
Before merge
type(scope): outcome.