[PR #6985] [MERGED] fix(browser): preserve media type parameter spelling #7550

Closed
opened 2026-11-03 13:38:38 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6985
Author: @ShuaixinHuang
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @morluto

Base: main ← Head: codex/fix-cdp-media-type-parameters


📝 Commits (7)

  • 4a8f669 fix(browser): preserve media type parameter spelling
  • 1583739 Merge commit 'dd02d8ff69' into codex/fix-cdp-media-type-parameters
  • fd9c274 Merge commit '9895f1870c' into codex/fix-cdp-media-type-parameters
  • ab5c5b7 Merge commit 'be2811e414' into codex/fix-cdp-media-type-parameters
  • 4b251c2 test(verifiers): follow shared command output and identity
  • cef7d58 Merge shared verifier CI test repair
  • 4a12003 test(ci): synchronize upstream verifier assertion repair

📊 Changes

2 files changed (+80 additions, -2 deletions)

View changed files

📝 src/browser/CdpSafeMetadata.test.ts (+65 -0)
📝 src/browser/CdpSafeMetadata.ts (+15 -2)

📄 Description

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 347b6e4d95 (#7002), which includes the earlier #6986, #6988 and #6994 repairs. Current head: 4a120031d7. 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 4b251c25 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 be2811e414, 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 4a120031d7. 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6985 **Author:** [@ShuaixinHuang](https://github.com/ShuaixinHuang) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/fix-cdp-media-type-parameters` --- ### 📝 Commits (7) - [`4a8f669`](https://github.com/morluto/rea/commit/4a8f669c47245dfea0156318eb715e5882e4093e) fix(browser): preserve media type parameter spelling - [`1583739`](https://github.com/morluto/rea/commit/15837394bd13beb69dd7839a0d0d238f4fb031df) Merge commit 'dd02d8ff696385949b05459f2ab9b6ffda18a52c' into codex/fix-cdp-media-type-parameters - [`fd9c274`](https://github.com/morluto/rea/commit/fd9c2748c227c024ba4be781dfa6a70c53385369) Merge commit '9895f1870c5537e64f08e9ff145a0917696b7a50' into codex/fix-cdp-media-type-parameters - [`ab5c5b7`](https://github.com/morluto/rea/commit/ab5c5b7ee200c5979cb62e4471922cb6b17e6e8e) Merge commit 'be2811e41407f0149b3e8e12cb2bf0ffd5904b2d' into codex/fix-cdp-media-type-parameters - [`4b251c2`](https://github.com/morluto/rea/commit/4b251c25d75e1bc400e730ee54d7f4acd2d2504b) test(verifiers): follow shared command output and identity - [`cef7d58`](https://github.com/morluto/rea/commit/cef7d586300872bda2256611170ce03503539269) Merge shared verifier CI test repair - [`4a12003`](https://github.com/morluto/rea/commit/4a120031d71757ba5b6c343cc572388a43c46969) test(ci): synchronize upstream verifier assertion repair ### 📊 Changes **2 files changed** (+80 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/CdpSafeMetadata.test.ts` (+65 -0) 📝 `src/browser/CdpSafeMetadata.ts` (+15 -2) </details> ### 📄 Description ## 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](https://www.rfc-editor.org/rfc/rfc9110.html#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](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#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. - [x] 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: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] 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 - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] 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 - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. ## Synchronization validation (2026-10-24) Synchronized reviewed upstream 347b6e4d95 (#7002), which includes the earlier #6986, #6988 and #6994 repairs. Current head: 4a120031d71757ba5b6c343cc572388a43c46969. 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 4b251c25 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 be2811e414, 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](https://github.com/morluto/rea/actions/runs/40096657138/job/120883953610), Conventional PR title and PR readiness all succeeded for 4a120031d71757ba5b6c343cc572388a43c46969. 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:38:38 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7550
No description provided.