Skip to content

test(browser): cover DOM relation whitespace and empty values - #2845

Closed
zhangguiping-xydt wants to merge 7 commits into
morluto:mainfrom
zhangguiping-xydt:fix/dom-rel-ascii-whitespace
Closed

zhangguiping-xydt wants to merge 7 commits into
morluto:mainfrom
zhangguiping-xydt:fix/dom-rel-ascii-whitespace

Conversation

@zhangguiping-xydt

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

Copy link
Copy Markdown
Contributor

Summary

Refs #2840. Add regression coverage for HTML relation-token whitespace and CDP empty-value encoding. Non-HTML whitespace must not invent agent hints; valid empty values must preserve links, form destinations, SVG empty-href precedence, and XML namespace undeclarations.

Approach and conflict resolution

Merged upstream main 72d5e72e6d7b7997c4ecb11972fc405be8ec67d2 while preserving the PR history. Kept both the PR's relation-token tests and upstream's prefixed XHTML form tests at the conflicting insertion point, together with upstream namespace/import changes. Main already contains the negative-index cases and the canonical production decoder. The resulting diff against main changes only src/browser/CdpCaptureDocuments.baseUrl.test.ts; production code and dependencies are unchanged.

Validation

Current head: b91b450c1799021fcf27a97368cdb8522028f283. Linux, pinned Node.js 24.22.1/npm 11.16.0.

  • Both DOM source suites: 114 passed, including upstream XHTML/namespace tests and the retained whitespace, empty-value, malformed-index, and SVG/XML controls.
  • npm run check:fast: passed (typecheck and lint, reusing the successful outputs for the identical source tree).
  • Changed-file npm run lint:typed -- src/browser/CdpCaptureDocuments.baseUrl.test.ts: passed, 0 errors / 0 warnings.
  • npm run check: typecheck, lint/module boundaries, formatting, Knip, metadata, architecture guards, and production reachability completed successfully. Its final full-repository typed-lint stage was killed by the 6 GiB container memory limit (confirmed by the kernel OOM log); a complete local check pass is not claimed.
  • Changed-file formatting, diff whitespace, and unresolved-conflict checks: passed.
  • Current-head CI run 42464975078: running. PR readiness and conventional title checks passed. GitHub reports the PR mergeable, with Ready for review status preserved.

The host's older glibc cannot load main's native TypeScript checker; static checks ran in offline Debian bookworm containers with the same pinned Node/npm toolchain. Source tests ran directly on the host. Full-repository typed lint remains unverified locally after the resource-limited attempt; the changed-file typed check passed separately.

Historical evidence on a437d872df3b20b3843682cc3a4fcba35cf033c3: built CLI and stdio MCP with an owned localhost page and real Chrome 138 passed the DOM/form assertions and matched Chrome relList/DOM-property oracles. Prior CI run 38528268551 passed. These are prior-head results; real Chrome CLI/MCP workflows were not rerun for this test-only conflict repair. The earlier complete browser suite failed later storage seeding on Chrome 138, so no complete browser pass or other-OS verification is claimed.

Author readiness

Human owner: @zhangguiping-xydt

  • 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.

@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.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The test-only changes appear safe to merge.

Summary

Adds regression coverage in src/browser/CdpCaptureDocuments.baseUrl.test.ts for:

  • Browser snapshot tests cover node values encoded with CDP's -1 marker.
  • Link relation tests treat only HTML whitespace as separators.
  • Empty form destinations are tested with CDP's -1 marker.
  • SVG and XML link tests cover CDP's empty-value marker.

The supplied diff changes one test file, not the two stated in the PR description. No runtime code, dependencies or permissions change. No actionable correctness, security or repository-rule issues were found. Review checks were source-based; no tests or browser workflows were run during this review.

Reviews (12) · Last reviewed commit: "test(browser): merge main and preserve D..." · Reviewed by Greptile

@morluto
morluto force-pushed the fix/dom-rel-ascii-whitespace branch 2 times, most recently from 09c84a4 to e61d241 Compare October 13, 2026 18:26
@morluto
morluto force-pushed the fix/dom-rel-ascii-whitespace branch from e61d241 to 158dc95 Compare October 13, 2026 18:39
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Oct 14, 2026
morluto added a commit that referenced this pull request Oct 14, 2026
Own service-worker CDP registrations and retry failed teardown. Admit redaction and network metadata against remaining capture capacity, retain explicit omission reasons, and preserve source URL, redirect ancestry, caller-selected content, and historical capture values. Forward CLI cancellation through provider cleanup.

Reviewed fixes: #2263, #2637, #2767, #2845, #2859, #2863, #2872, #2874, #2876, #2879, #2955, #2957, #2961, #3033.

Validation: 25 current event/network source tests passed; earlier focused browser lanes passed 201 source tests and 176 boundary tests with two skips, plus 35 Python tests. Real browser/Windows lanes were not rerun. Playwright allocation before admission remains unbounded by these retention limits.
@zhangguiping-xydt zhangguiping-xydt changed the title fix(browser): avoid false agent hints from non-HTML whitespace fix(browser): preserve valid DOM link relation hints Oct 14, 2026
@zhangguiping-xydt zhangguiping-xydt changed the title fix(browser): preserve valid DOM link relation hints test(browser): cover DOM relation whitespace and empty values Oct 14, 2026
@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.

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: This test-only PR passes. Its two test files give 91 passing tests on Node 22, 24 and 26, up from 74 before the PR. They also pass when merged onto current main. Thanks, zhangguiping-xydt, for all of the new tests in it.

I tested head a437d87. Its merge base is 29d3dcb, and main was at 40f73f6 (#3735).

Results

Source and tests Node Result
Merge base 29d3dcb, its own tests 24.18.0 74 passed
PR head a437d87, its own tests 22.23.1 91 passed
PR head a437d87, its own tests 24.18.0 91 passed
PR head a437d87, its own tests 26.11.1 91 passed
Main 40f73f6, its own tests 24.18.0 76 passed
Main 40f73f6 with the PR's test changes merged in 24.18.0 91 passed
  • Two test files ran each time. They cover browser capture of DOM documents.
  • The PR changes only test files, so the head run uses the same source as the merge base. The 17 extra tests are new checks, not a source change.
  • The merged run used a three-way merge of the test files in a scratch folder. It had no conflicts.
  • The counts close like this: the base has 74 tests and main has 76. The PR adds 17, but 2 of them (two small rows in the main test file) are already on main. So the merged run has 76 plus 15, which is 91. I found that by diffing the test files.
  • One CI check, "Conventional PR title", shows as cancelled on GitHub. It is not a test result, and I did not look into it.

Not run

  • Any other test file, and the full suite.
  • Windows and macOS.
  • I did not review whether the new cases match the HTML rules they cite.
Commands
git -C ~/code/rea-mirror/rea.git fetch origin
git -C ~/code/rea-mirror/rea.git archive a437d872df3b20b3843682cc3a4fcba35cf033c3 | tar -x -C /tmp/fresh-1015/2845-head
npm ci && npm run build && npm run test:prepare   # Node 24.18.0, all exit 0
node scripts/run-development-tests.mjs focused \
  src/browser/CdpCaptureDocuments.baseUrl.test.ts \
  src/browser/CdpCaptureDocuments.test.ts
# head: exit 0 on Node 22, 24 and 26 (91 passed)
# base test files in the head tree: exit 0 (74 passed)
git merge-file main.copy base.copy pr.copy   # for each of the two test files, exit 0
# fresh main tree (40f73f62b), as is: exit 0 (76 passed); with the merged test files: exit 0 (91 passed)
Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 22.23.1, 24.18.0, 26.11.1
  • Head: a437d87
  • Base: 29d3dcb
  • Other: the box was shared with other test agents.

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@zhangguiping-xydt
zhangguiping-xydt marked this pull request as draft October 17, 2026 04:30
@zhangguiping-xydt
zhangguiping-xydt marked this pull request as ready for review October 17, 2026 07:29
@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 ⚠️ Failed 2026-10-17T07:29:31.248044Z a437d87 Draft marked ready
ℹ️ 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.

@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.

@morluto

morluto commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by f690571 and the current DOM capture tests. Main covers HTML relation-token whitespace, CDP’s empty-value sentinel at the decoder boundary, empty form destinations, SVG href precedence, and namespace restoration. Both current DOM source suites passed locally (36 tests).

@morluto morluto closed this Nov 18, 2026
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