Skip to content

fix(browser): preserve media type parameter spelling - #6985

Merged
morluto merged 7 commits into
morluto:mainfrom
ShuaixinHuang:codex/fix-cdp-media-type-parameters
Oct 24, 2026
Merged

morluto merged 7 commits into
morluto:mainfrom
ShuaixinHuang:codex/fix-cdp-media-type-parameters

Conversation

@ShuaixinHuang

@ShuaixinHuang ShuaixinHuang commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preserve case-sensitive media type parameters in captured CDP response metadata and Link declarations.

Problem and expected behavior

Multipart/Mixed; boundary="AaB03x" currently becomes multipart/mixed; boundary="aab03x". The same lowercasing changes JSON-LD profile URI paths and protobuf message names. RFC 9110 section 8.3.1 permits case-insensitive type/subtype names, but parameter values can be case-sensitive. Captured metadata must preserve those values.

Change and scope

Give media type declarations their own normalization owner: trim the declaration, lowercase only its type/subtype prefix, and preserve the complete parameter suffix. Use it for response mime_type and Link type; existing token normalization for content encoding, relation, destination, and crossorigin remains intact. No separate issue: the PR includes executable reproductions.

Follow the contribution scope. Ordinary correction of already-captured metadata; no separate maintainer scope decision is applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: CdpSafeMetadata, before response metadata and link declarations enter observations.
  • Contribution scope fit and linked maintainer decision: existing passive capture projection; not applicable.
  • CLI and MCP/tool-catalog contract: field shapes are unchanged; media type parameter spellings now preserve the captured source.
  • Provider, bridge, target-format, or platform compatibility: no CDP command change; uses existing response and Link values.
  • Evidence, artifact, provenance, or reconstruction contract: avoids changing case-sensitive captured declarations; no new inferred facts.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): no changes to browser connection, scope approval, navigation, or cleanup.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none; no schema or dependency change.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: three table-driven cases cover multipart boundaries, JSON-LD profile URIs with quoted semicolon/comma, and protobuf message names across both projections. Node's independent MIMEType parser checks parameter equivalence; existing normalization and trust/scope controls are asserted.
  • Base reproduction or other evidence: all three added cases failed before the production fix, with lowercase parameter values; all pass after it.
  • User-visible CLI/MCP output (if applicable): mime_type and link type now retain boundary="AaB03x", /Profiles/Book;V=One,Two, and Example.Message instead of lowercasing those values.
  • Remaining proof gaps: Windows/Node 24.22.1; CDP boundary tests simulate protocol events and do not establish live Chrome behavior. No real browser launch was performed.

For evidence-bearing changes:

  • 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

  • Selected regression before the production fix — 3 failed for parameter lowercasing.
  • npm run test:focused -- src/browser/CdpSafeMetadata.test.ts tests/boundary/browser/cdpBrowserProvider.network.test.ts tests/boundary/browser/cdpResourceCompleteness.test.ts — 3 files, 126 tests passed, including production CDP adapter and public CLI Evidence coverage.
  • node node_modules/vitest/vitest.mjs run src/browser/CdpSafeMetadata.test.ts — 85 tests passed after organizing the new cases into their own describe block.
  • npm run check — 6 tasks, resolved module boundaries, and architecture guards passed; lint zero errors.
  • git diff --check and normal pre-commit lint/format — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; parameter values now retain source spelling.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows execution; simulated CDP events, no real browser or analysis engine.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no added network calls, browser commands, target authority, persistence, or credential retention. Existing metadata scope/redaction behavior is retained.

Author readiness

Human owner: @ShuaixinHuang

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

The human owner instructed the assistant in this session to prepare all three changes and submit them directly for review; this PR is AI-assisted.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Synchronization validation (2026-10-24)

Synchronized reviewed upstream 347b6e4 (#7002), which includes the earlier #6986, #6988 and #6994 repairs. Current head: 4a12003. The complete feature patch is byte-for-byte identical to this PR's pre-repair feature patch and remains 2 files against that upstream revision; no verifier-test changes remain in the PR diff.

The preceding head's shard 6 had 13 failed / 1889 passed / 20 skipped from two shared test-contract mismatches. Those are historical results. A user-authorized local support patch 4b251c2 migrated the error diagnostics and run ID checks, then upstream merged #7002 concurrently. The resulting conflict was resolved by taking both upstream test files exactly. The Python cases now check VerifierCommandExitError, exit code 1 and snapshot.stderr.text. The ownership cases compare leader/descendant identities to the actual launcher-assigned nonce and distinguish the inherited identity. Archive rejection, ambient-import isolation, no extraction, process-exit-before-root-cleanup and cleanup-retry checks remain.

Clean-base comparison before the upstream merge (Windows, pinned Node 24.22.1/npm 11.16.0, Python 3.12.14, native Windows addon present): the exact focused two-file command for packedBridgeVerification.test.ts and packagedWasmVerifierOwnership.test.ts failed 10 / passed 14 / skipped 3 on be2811e, then passed 24 / skipped 3 after the local migration. A controlled temporary bypass of ast.parse made the existing invalid-Python regression fail as intended (1 failed / 23 deselected); production bytes were restored. These are local repair evidence, not the final upstream-combination result.

On the final integrated ELF branch, npm run test:focused -- tests/boundary/process/packedBridgeVerification.test.ts tests/boundary/process/packagedWasmVerifierOwnership.test.ts tests/boundary/filesystem/verifierCommandOutput.test.ts tests/boundary/process/nativeVerifierPreflightOwnership.test.ts passed 29 / skipped 14 (four files). All 24 packed-Python cases and five command-output cases passed. Existing Windows skips cover three packaged-Wasm lifecycle cases, eight native-client preflight cases and three filesystem failure cases. No new skip was introduced; Linux CI must execute the POSIX coverage. This run does not establish real external-client/provider behavior.

Each final integrated branch passed npm run check (six tasks, module boundaries and architecture guards) and git diff --check; normal commit and push hooks passed. No CI gates, timeouts or skips were weakened. Upstream #7002's own green CI does not establish this PR's new-head result. Latest-head confirmation on 2026-10-24: CI required, Conventional PR title and PR readiness all succeeded for 4a12003. Source tests and all eight test shards succeeded. Optional lanes retain their reported skips; the historical local Windows limits remain disclosed.

Earlier post-sync feature/shared validation passed 245 tests across five CDP and shared-regression files. After the earlier be2811 merge, the two import/type-erasure source files passed all 36 tests on this branch.

Earlier checks also passed all 113 reference-lifetime cases, six property-path regressions, and nine evaluation-gate tests. The former cyclic-path single case passed with the same 512 MiB heap / external 20 s guard (137 ms test time, 3.76 s elapsed); the baseline exhausted the heap. No completed-baseline speedup or process-family RSS claim is made.

@chatgpt-codex-connector

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 🔄 Running since 2026-10-24T09:43:41.860111Z 4a8f669 PR opened
ℹ️ 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 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Preserves case-sensitive media type parameters in response mime_type and Link type, while still lowercasing the type/subtype.

  • Captured media types keep parameter spelling while normalizing their names.

Reviews (6) · Last reviewed commit: "test(ci): synchronize upstream verifier ..." · Reviewed by Greptile

@morluto
morluto merged commit 85bc8c8 into morluto:main Oct 24, 2026
43 of 45 checks passed
@morluto morluto added the bug Something isn't working label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants