Skip to content

test(browser): cover invalid WebMCP annotation payloads - #3837

Open
aznikline wants to merge 3 commits into
morluto:mainfrom
aznikline:test/webmcp-invalid-annotations
Open

aznikline wants to merge 3 commits into
morluto:mainfrom
aznikline:test/webmcp-invalid-annotations

Conversation

@aznikline

@aznikline aznikline commented Oct 15, 2026 •

Copy link
Copy Markdown

Summary

Follow-up test coverage from closed #2263: browser-level cases for invalid WebMCP annotation payloads were committed to 092a86cb4d2bb5b0e322391f1d6230673b3b63f3 after that PR closed and were not absorbed by upstream f6905719c3c80d829037e509d6e46129b131d893 or current main.

Problem and expected behavior

A page emitting a non-boolean consequential value, a malformed annotations payload, or annotations: null must keep the tool registration, omit the consequential hint, and mark webmcp_tools coverage incomplete (invalid_protocol_value, unavailable_sections). Existing main coverage exercises only boolean consequential values.

Change and scope

Test-only: adds a fixture override webMcpAnnotations (tests/fixtures) selected by own-property presence (Object.hasOwn) so an explicit null reaches the provider instead of falling back to valid defaults, and an it.each covering all three invalid payloads. No production code changes; does not reimplement #2263's absorbed fixes.

Validation performed

  • npm run test:focused -- tests/boundary/browser/cdpBrowserProvider.document_script.test.ts — 29/29 pass; the null case fails against the pre-fix fixture
  • npm run check:fast — green (typecheck + lint); oxfmt --check clean

Author readiness

Human owner:

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

Generated with Devin

aznikline added a commit to aznikline/rea that referenced this pull request Oct 15, 2026
…, and morluto#2465 call-site P1

Records the call-site member-read fix a13b935, the main merge 02ef51a (writeSite origin + [null] mutation encoding), the author-readiness human attestation requirement, and the morluto#2263 test-only follow-up draft PR morluto#3837.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@kaoru0822-kitauji
kaoru0822-kitauji marked this pull request as ready for review October 15, 2026 06:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

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-15T06:17:05.999302Z 74e2dc3 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.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This test-only PR appears safe to merge.

Summary

Adds browser tests for invalid WebMCP annotations without changing production code.

  • Browser tests now cover invalid WebMCP annotation payloads.

Reviews (2) · Last reviewed commit: "test(browser): preserve explicit null We..." · Reviewed by Greptile

Comment thread tests/fixtures/fakeCdpBrowserEvents.ts Resolved
aznikline added a commit to aznikline/rea that referenced this pull request Oct 15, 2026
…2 closures

Ledger updates for comments 4278964125/4278964129 (fixed by 1a866d4 and
025187d on split/intrinsic-boundaries) and 4279727743 (fixed by bcb92eb
on test/webmcp-invalid-annotations), plus current thread-resolution readback
and the HUMAN_ATTESTATION_REQUIRED blockers.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: The three new test cases pass, and they catch a real break. I removed the check they guard, and two of the three failed. The type check is clean.

Results

Base is main c7f6b8b. The change is applied on top of it.

Check Main Main plus this change
Browser provider test file 26 of 26 pass 29 of 29 pass
tsc --noEmit 0 errors 0 errors
Same file, with one source check removed not run 2 of 29 fail

The two failures are the bad-payload case and the null-payload case. The third case, a non-boolean hint, still passes. A separate source line handles it. I did not remove that line, so I have not shown that the third case catches a break.

The mutation was a scratch edit. I put the file back and diffed it against main.

Not run

  • Real CI ran on GitHub, not here. Static checks, source tests and test shards 1 to 5 show SUCCESS. Several browser and native jobs show SKIPPED. I did not run those.
  • A real browser. The fake CDP browser answers on loopback only, so no test made an outside network call.
  • The full suite, and any doctor test folder. Our safety rules forbid both.
  • The PR body has an empty "Human owner" line. That is for the maintainers to judge.

Thanks, aznikline, for the tests. This change only adds tests, so there is no before and after for a fix.

Commands
npm ci && npm run build && npm run test:prepare
npm run typecheck
npm run test:focused -- tests/boundary/browser/cdpBrowserProvider.document_script.test.ts
patch -p1 -F0 < 3837.diff

The scratch edit deleted two lines in one source file. They mark a bad annotations value as incomplete.

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: 24.18.0
  • Head: bcb92eb
  • Base: c7f6b8b
  • Other: up to four test agents share this box, so the box may have been shared during the runs.

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

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

I am helping review first-contributor PRs at the maintainer’s request. The PR body still has no named human owner and all three Author readiness declarations are unchecked; I did not find a separate readiness declaration from the author in the current comments/reviews. Please complete those when you have reviewed and own the final diff and evidence, as required by CONTRIBUTING.md. I will keep the technical review separate from that declaration and will not fill it on your behalf.

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Technical follow-up: I integrated unchanged head bcb92eb with main 6c06f40 and ran the exact document/script boundary suite on Linux, pinned Node 24.18.0: 29/29 pass. The explicit-null fixture uses own-property presence correctly, so null reaches the producer; the assertions retain registration while preserving invalid_protocol_value/unavailable coverage. No follow-up code defect found. This is loopback fake-CDP validation, not a real-browser qualification. The selected task took 3.69 s wall / 4.42 s reaped-family CPU / 0.60 GiB sampled peak family RSS (shared host, two cores, 3 GiB heap; model tokens and cold/warm unmeasured). The author ownership/readiness declaration remains incomplete, so I am leaving this PR open rather than attesting to it on the author’s behalf.

@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@aznikline thanks for the PR — this branch has merge conflicts with main. Could you merge or rebase onto the latest main and resolve them? Once it's clean and CI is green we can take another look.
cc @gensokyo-dev @dandgabr

aznikline and others added 3 commits November 25, 2026 12:20
Retains the tool registration while omitting the consequential hint and
marking webmcp_tools coverage incomplete when the page emits a
non-boolean consequential value or a malformed annotations object.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The added it.each pushed the discovery describe over the 150-line function limit.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The fixture's `??` fallback replaced a supplied null annotations payload with
the default valid object, so the invalid-input case never reached the
provider. Select the override by own-property presence and cover the null
payload at the browser boundary.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@aznikline
aznikline force-pushed the test/webmcp-invalid-annotations branch from bcb92eb to 0757b29 Compare November 25, 2026 04:24
@aznikline

Copy link
Copy Markdown
Author

Rebased onto main c214fc4 and resolved the conflicts — upstream removed several fixture options this branch relied on, so the resolution adds only the two the new cases need: webMcpConsequential (re-added) and webMcpAnnotations (own-property presence so explicit null reaches the provider), alongside upstream's webMcpStackTrace override. The replay-inventory describe reorganization was dropped in favor of upstream's current layout; the invalid-annotation cases now sit in their own describe.

Local validation (pinned Node 24.22.1): npm run test:focused -- tests/boundary/browser/cdpBrowserProvider.document_script.test.ts — 23/23 pass; npm run check:fast green (typecheck + lint + architecture guards).

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

area: tests Test suite and verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants