Skip to content

test(valtio): add React parity harness - #519

Closed
jonkwheeler wants to merge 32 commits into
octanejs:mainfrom
jonkwheeler:jon/valtio-react-parity-harness
Closed

jonkwheeler wants to merge 32 commits into
octanejs:mainfrom
jonkwheeler:jon/valtio-react-parity-harness

Conversation

@jonkwheeler

@jonkwheeler jonkwheeler commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • pin Valtio 2.3.2 to its annotated release tag, canonical commit, and npm artifact checksum
  • add fail-closed same-fixture React/Octane lanes for useSnapshot and useProxy
  • record the React DevTools label divergence and add executable public type evidence
  • classify every port-authored test and execute required recorded-unverified lanes in the global audit

Verification

  • Valtio project: 4 files, 14 tests passed
  • all 3 Valtio parity lanes passed
  • React parity harness and classification tests passed
  • generated binding status and parity-gap indexes are current
  • global React parity audit passed (stable: 5,345 cases; canary: 5,413 cases)

Provenance

  • An agent produced this diff (agent-authored)

Note

Low Risk
Test, audit, and documentation metadata only; no production hook implementation changes in the diff.

Overview
Adds a React parity harness for @octanejs/valtio pinned to [email protected], with upstream ledger (UPSTREAM.md), react-parity.json lanes, and refreshed binding status/docs (verified → 2026-08-02).

Evidence lanes: repo-authored adapted runtime tests for useSnapshot / useProxy, a differential suite that compiles shared TSRX fixtures to React and compares Octane vs upstream, paired pristine/adapted typetests, and a test-classifications ledger (including a guard that useDebugValue is omitted). Conformance binding tests now use act to assert sync vs async snapshot subscription behavior.

Tooling: verifyPortTestClassifications is generalized to any binding; the global react-parity check runs it for manifests that ship test-classifications.json. Vitest gains valtio-differential with global setup; @octanejs/valtio tests also run the differential project. Lockfile SHA bumps propagate to parity audits and the user-apps-v1 eval manifest (overlay lockfile + grader digests).

Reviewed by Cursor Bugbot for commit db4041c. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Aug 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview Aug 7, 2026 3:58pm
octane-website-mcp Ready Ready Preview Aug 7, 2026 3:58pm

Request Review

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only labels Aug 2, 2026
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 2, 2026 23:53 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 2, 2026 23:54 Inactive
@jonkwheeler
jonkwheeler marked this pull request as draft August 3, 2026 01:49
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 3, 2026 05:58 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 05:59 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 3, 2026 06:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 06:13 Inactive
@jonkwheeler
jonkwheeler force-pushed the jon/valtio-react-parity-harness branch from c0ae1a9 to 1213453 Compare August 3, 2026 07:53
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 3, 2026 07:55 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 3, 2026 07:55 Inactive
Comment thread scripts/react-parity/check.mjs Resolved
Comment thread packages/valtio/audit/react-parity.json Resolved
Follow the hook-form pattern: tag parity lanes with
testExecution group react-parity, move differential tests into a
dedicated project with globalSetup precompile, and drop per-file
beforeAll compile hooks.
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp August 7, 2026 15:57 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website August 7, 2026 15:58 Inactive
Resolve merge conflicts preserving PR intent and the react-parity vitest
differential split; refresh lockfile and vitest integrity hashes.

Co-authored-by: Cursor <[email protected]>
Comment thread vitest.config.js Resolved
Comment thread packages/valtio/package.json Resolved
Upstream adapted suite files are excluded from discovery, so the valtio
ledger assertion must match the four remaining classified tests.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Addressed maintainer provenance/ownership feedback, merged origin/main, and fixed the Bugbot classification-count finding. Bugbot is clean on the current head; no unresolved threads; CLEAN vs main.

READY FOR REVIEW

Comment thread vitest.config.js Resolved
jonkwheeler and others added 2 commits August 9, 2026 16:10
…nejs#519)

Move Octane-only binding coverage out of parity ownership and replace the adapted lane with cases that cite pinned [email protected] React hook source.

Co-authored-by: Cursor <[email protected]>
@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Addressed maintainer ownership feedback (ordinary binding suite + cited adapted hooks), merged origin/main, and refreshed digests. Bugbot completed successfully on the current head with no unresolved threads; merge state is CLEAN.

READY FOR REVIEW

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Branch is conflicting with main after recent trunk movement; withdrawing readiness while currency is repaired.

REVIEW WITHDRAWN

@jonkwheeler

Copy link
Copy Markdown
Contributor Author

Merged origin/main (digest conflicts resolved + lockfile digests refreshed; then update-branch for subsequent trunk commits). Bugbot completed successfully on the current head with no unresolved threads; merge state is CLEAN.

READY FOR REVIEW

@leonidaz leonidaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React-parity scope review only; tests were not run.

"verification": "verified"
},
"upstreamSuites": {
"runtime": "absent",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pinned canonical tag has an executable runtime suite (test:spec: vitest run) with 20 test files, including React-hook coverage such as tests/useProxy.test.tsx; breadth or React Testing Library coupling does not make that suite absent. Please run the applicable pristine suite unchanged, adapt the React-facing cases one-for-one with exact dispositions/citations, and retain the framework-neutral tests as the baseline for the vanilla core reused here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pinned canonical tag has an executable runtime suite (test:spec: vitest run) with 20 test files… Please run the applicable pristine suite unchanged, adapt the React-facing cases one-for-one…

Need a scope call before expanding this PR.

Options
(a) Expand to full pristine Vitest + one-for-one adapted React suite (vendor upstream/, ~11 React files, StrictMode/RTL/devtools triage) — matches the parity contract, large port.
(b) Keep the thin repo-authored retrofit and revise the claim language — rejects the review ask.

Lean: (a), but that is a separate multi-commit port with triage decisions (StrictMode double-invoke, devtools.test.tsx, vanilla pristine-vs-adapted boundary). Leaving this open until that work is authorized / landed.

},
"upstreamSuites": {
"runtime": "absent",
"types": "insufficient"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pinned repository also has an executable upstream type lane: test:types runs tsc --noEmit over its TS/TSX test graph, which contains the embedded type assertions. The parity rules require that actual suite to run pristine under its original compiler/config and be adapted one-for-one; the two repo-authored public probes may supplement it, but cannot replace it as “insufficient.”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pinned repository also has an executable upstream type lane: test:types… cannot replace it as “insufficient.”

Same scope gate as the runtime suite thread.

Options
(a) Treat types as present: pristine tsc --noEmit on the vendored graph, one-for-one adapted suite, hashed inventories + transformation ledger + negative controls.
(b) Keep repo-authored probes only — rejects the review ask.

Lean: (a) paired with the runtime expansion. Upstream types are embedded in the TSX test graph rather than a __typetest__ tree, so the inventory shape needs an explicit design choice. Leaving open.

* `[email protected]` React hooks at `valtio/esm/react.mjs` and
* `valtio/esm/react/utils.mjs` (commit 15c64d4d7a7a9bd55d750fa6a317b440978a2b25).
*
* Citations (upstream source; upstream ships no standalone unit suite claimed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation-source line references are not a pinned upstream-test oracle. This file is declared repo-authored yet is counted in a required adapted parity lane; each case must either run the same observable scenario against the pinned React binding or cite the exact pinned upstream test it adapts. In particular, the synchronous-subscription case has neither a React side nor an upstream test citation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation-source line references are not a pinned upstream-test oracle… the synchronous-subscription case has neither a React side nor an upstream test citation.

Agreed that source-line citations are not enough. Exact upstream oracles for these cases live in tests/basic.test.tsx / tests/useProxy.test.tsx at the pin (including the sync-option cases), but citing them honestly requires vendoring that suite and either adapting those tests one-for-one or adding a React differential side.

That is the same expand-to-upstream-suite decision as the runtime absent thread — parking here rather than papering over with implementation citations.

{
"schemaVersion": 1,
"files": ["packages/valtio/typetests/pristine/public-api.test-d.ts"],
"assertionGroups": ["useSnapshot readonly inference", "useProxy mutable inference"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only assertion-group labels, not an inventory/hash of the assertions. The type-parity contract requires file- and assertion-group-level structural comparison, a narrowly allowed transformation ledger, and negative controls for a skipped file, deleted assertion, and removed @ts-expect-error; whole-file hashes in the manifest do not prove that after an intentional refresh.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only assertion-group labels, not an inventory/hash of the assertions… whole-file hashes in the manifest do not prove that after an intentional refresh.

Correct — the current pristine-types.json / adapted-types.json label lists do not meet the type-parity contract (file + assertion-group hashes, permitted-transformation ledger, skip/delete/@ts-expect-error negative controls).

That machinery only makes sense once types are present with a real pristine/adapted suite (or a properly hashed repo-authored probe pair like livestore). Parking with the types-suite scope decision rather than inventing hashes for the thin probes.

jonkwheeler and others added 3 commits August 9, 2026 21:11
…t roots

Discover tests/upstream and typetests when evidence is repo-authored, add
adapted/type dispositions, and reject unclassified files in each root.

Co-authored-by: Cursor <[email protected]>
Comment thread packages/valtio/audit/react-parity.json Resolved
jonkwheeler and others added 2 commits August 9, 2026 21:18
Assert under sync act so `{ sync: true }` must notify before a microtask;
awaiting nextPaint also passed for non-sync subscriptions.

Co-authored-by: Cursor <[email protected]>
Attach store subscriptions before mutating, then assert under sync act that
`{ sync: true }` updates while a non-sync Counter still reads the old value.

Co-authored-by: Cursor <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 4ffcdb1. Configure here.

Keep react-parity.json integrity pins aligned with the sync-contrast test rewrite.

Co-authored-by: Cursor <[email protected]>
@leonidaz

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! This pull request was incorporated into main as commit 83fc576d384a through consolidated PR #699.

@leonidaz leonidaz closed this Aug 12, 2026
kotarotaniguchi0523 pushed a commit to kotarotaniguchi0523/octane that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants