Skip to content

fix(benchmarks): match setText's journal read in the root contracts audit - #1943

Merged
trueadm merged 2 commits into
mainfrom
fix/root-contracts-text-journal
Oct 9, 2026
Merged

trueadm merged 2 commits into
mainfrom
fix/root-contracts-text-journal

Conversation

@trueadm

@trueadm trueadm commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The root-transactions audit (benchmarks/root-transactions/contracts.mjs) throws on main before it measures anything. Its instrumentation looks for setText's journal call by exact text, and that text no longer exists.
  • It now matches the call with /journalText\(target, \(STAGED_DOM.*\)\.nodeValue\);/. With the fix, the audit reports the same contract results it gave before the refactor that broke it.

Why

Changes

Validation

  • node benchmarks/root-transactions/contracts.mjs: on main (4f82777) it throws Expected exactly one … (0 !== 1). With the fix it completes. Its reads, results (18 rows: dev/prod × live/delayed-driver/binding-cache × scenarios) and targets are byte-identical to the same script run against the pre-fix(octane): keep updating an only text child after page translation #1915 checkout 1048eab. The reads are compiled 128/0 and descriptor 128/128. live preserves every scenario. delayed-driver fails its hold as intended (it shows replacement). binding-cache passes only first-raw-throw.
  • Applied the same diff on perf(octane): let Vite's minifier drop unused optional drivers #1942's head (origin/perf/foldable-driver-reads, which also carries its own journalAttr string update) and ran the audit there. The results are also byte-identical to the baseline.
  • node benchmarks/bench.mjs root-transactions --quick: all four scripts (retirement, inputs, reorders, contracts) completed.
  • node benchmarks/bench.mjs root-transactions --quick --ratios: checked 10 guards, PASS — no ratio guards breached.
  • pnpm format:files:check benchmarks/root-transactions/contracts.mjs
  • pnpm sync: no generated changes.
  • pnpm format:check / pnpm typecheck / pnpm test: not run locally. This is a benchmark-script-only change; CI covers them.
  • perf-review: not applicable (benchmark tooling only, no runtime, compiler or binding change).
  • concise-code: src +0 −0 (runtime +0 −0); benchmark script +5 −4; no new files or exports. Alternatives considered: (1) updating the exact string to main's two-line spelling, also about 4 lines, rejected because it breaks again as soon as perf(octane): let Vite's minifier drop unused optional drivers #1942 lands; (2) matching either node or target, which would also support full (non---reads-only) runs against pre-fix(octane): keep updating an only text child after page translation #1915 checkouts but needs a capture group, and replaceOnce's split-based count would then need a regex-specific branch. Bytes: not applicable.

Risk / follow-ups

  • The full contract run (without --reads-only) no longer instruments pre-fix(octane): keep updating an only text child after page translation #1915 baseline checkouts, because their call uses node. The documented baseline command (contracts.mjs /path/to/baseline --reads-only) builds only the uninstrumented native artifact, so it is unaffected.
  • No changeset: benchmark tooling only.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Low Risk
Benchmark-only instrumentation in contracts.mjs; no runtime, compiler, or binding changes.

Overview
The root-transactions contract audit (contracts.mjs) was failing on main because its instrumentation still searched for an exact journalText call shape that #1915 removed when setText renamed the text node to target and reformatted the staged-view read.

The audit now patches setText's journal site with regex /journalText\(target, \(STAGED_DOM.*\)\.nodeValue\);/ and substitutes globalThis.__rootContractAudit.*Text(target), so it still instruments the right read across minor staged-DOM spellings (including pending refactors). Comments were updated to describe setText rather than the old wording.

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

…udit

#1915 renamed setText's text node to `target` and wrapped its journal
call, so contracts.mjs's exact-string instrumentation found no match and
the root-transactions audit threw before measuring anything. Match the
call with a pattern that accepts any spelling of the staged-view read, so
the pending ternary form in #1942 keeps matching too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 9, 2026 16:58
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 9, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 62385a6 Commit Preview URL

Branch Preview URL
Oct 09 2026, 05:44 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 62385a6 Commit Preview URL

Branch Preview URL
Oct 09 2026, 05:46 PM

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares 77571d9f9, the merge commit's first parent with 3d1323264 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.683 2.725 ±0.0% −3.6% … +3.8% ⚪ within noise
octane-tsrx replace 6.000 5.933 ±0.0% −3.2% … +3.3% ⚪ within noise
octane-tsrx add 2.350 2.483 ±0.0% −3.9% … ±0.0% ⚪ within noise
octane-tsrx update 0.140 0.142 ±0.0% −1.8% … +5.6% ⚪ within noise
octane-tsrx select 0.005 0.005 −0.0% −0.6% … +2.1% ⚪ within noise
octane-tsrx swap 0.017 0.017 −0.0% −1.9% … +1.4% ⚪ within noise
octane-tsrx remove 0.014 0.014 +1.3% ±0.0% … +3.8% ⚪ within noise
octane-tsrx runlots 24.442 24.408 +1.5% −1.8% … +4.3% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 +0.0% −2.2% … +2.7% ⚪ within noise
octane-tsrx clear 44.217 45.725 +1.6% −0.8% … +3.2% ⚪ within noise
octane-jsx run 3.458 3.383 ±0.0% −2.7% … +1.5% ⚪ within noise
octane-jsx replace 7.000 6.733 +0.0% −4.7% … +2.3% ⚪ within noise
octane-jsx add 3.075 3.058 ±0.0% −3.2% … +0.0% ⚪ within noise
octane-jsx update 0.251 0.250 −0.6% −1.7% … +1.7% ⚪ within noise
octane-jsx select 0.133 0.142 +1.6% +1.0% … +2.6% ⚪ within noise
octane-jsx swap 0.207 0.216 +0.9% −0.9% … +3.5% ⚪ within noise
octane-jsx remove 0.163 0.163 +0.4% −0.8% … +1.1% ⚪ within noise
octane-jsx runlots 27.858 27.917 +0.4% −2.2% … +2.6% ⚪ within noise
octane-jsx select_lots 1.413 1.434 +1.5% +0.0% … +2.5% ⚪ within noise
octane-jsx clear 49.542 47.067 +2.8% −1.2% … +9.6% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 60 measured values.

Public-import reachability bundles (bytes)

No changes across 111 measured values.

@trueadm
trueadm merged commit 89f9042 into main Oct 9, 2026
56 of 59 checks passed
@trueadm
trueadm deleted the fix/root-contracts-text-journal branch October 9, 2026 18:15
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 fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant