Skip to content

chore(ts): run the differential fixtures optimized and single-threaded, and share lang's translation - #419

Merged
moq-bot[bot] merged 7 commits into
mainfrom
quest/m0/checks/differential
Nov 2, 2026
Merged

moq-bot[bot] merged 7 commits into
mainfrom
quest/m0/checks/differential

Conversation

@kixelated

@kixelated kixelated commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The ts differential tests run each fixture's native wasm32 side as a debug build, which V8 runs several times slower, with V8's background threads adding CPU on top. stable_names also translated lang a second time as its base, with the same roots as the lang test's own translation. Per the 2026-11-01 checks audit, that made lang plus stable_names most of just ts test's CPU.

Approach

  • A differential profile in ts/Cargo.toml inherits dev with opt-level = 1. Overflow checks and debug assertions stay on, so panics and overflow match exactly. Every fixture's native side now builds with it, and stock's getrandom override moves to that profile.
  • Node runs differential.ts with --single-threaded.
  • lang's translation sits in a OnceLock that lang and stable_names share. stable_names checks its added-root translation against that output instead of translating a base of its own. added_root splits into rooted (translate with replaced roots) and kept (the line-order check), so source_order still translates its own base.

Evidence

Every fixture compares the same cases, with the same panic and abort counts as origin/main and 0 differences (--nocapture, cold target/tmp):

fixture cases panics aborts differences
lang 709442 84411 96 0
task 35417 3059 0 0
codec 35273 0 0 0
stock 20279 2296 0 0
bind, crates, and share's 4 builds 16273 each 1387 in one, 1 in another, 0 in the rest 0 0

Breaking the runtime by one (u32Add's bound at 0xfffffffe) fails lang: 709442 cases, 84411 panics, 96 aborts, 13 differences, e.g. native ffffffff01, ts panic "attempt to add with overflow".

Cold cargo test --locked in ts/ (test binaries prebuilt, target/tmp removed), measured on this host (32 cores, shared with other agents, so wall time is noisy; CPU is the measure):

CPU (user + sys) wall lang stable_names
origin/main, run 1 2247 s 9m37s 576 s 341 s
origin/main, run 2 (load ~50) 2805 s 12m13s 729 s 397 s
this PR, run 1 1195 s 8m04s 479 s 348 s
this PR, run 2 (load ~50) 1194 s 8m54s 506 s 353 s

About 1050 to 1600 CPU-seconds saved per cold run (47% to 57%). Wall time is bound by lang's translation, which this PR does not change.

Impact

  • Public API: none. Test infrastructure only.

Alternatives

  • --config profile.dev.opt-level=1 on the build command: hides the profile from Cargo.toml and shares debug/ with any other dev build of the fixtures.
  • Merging stable_names into the lang test: shares the translation without a OnceLock, but serializes its added-root translation after lang's differential and loses its separate test name.
  • debug = false in the profile as well: not measured, left out to keep the change to what the audit measured.

Follow-ups

Checks

just ci passed in a fresh nix develop on head bfbd5dc, after merging origin/main (345aa82). Running the built native lang wasm confirms [0x00, 0xff, ...] runs borrows::leaks, not Fault.

Review

Codex gpt-6.1-sol, medium effort, via quest review --base origin/main.

🤖 Generated with Claude Code

kixelated and others added 4 commits November 1, 2026 20:41
…d, and share lang's translation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A cheaper differential chore(ts): run the differential fixtures optimized and single-threaded, and share lang's translation Nov 2, 2026
@kixelated
kixelated marked this pull request as ready for review November 2, 2026 06:11
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 394a7168-342b-4896-8686-212bd94f06ee

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 83917acb-0a21-4aaf-9e35-8b07306cd5e8
Commits

Reviewing files that changed from the base of the PR and between 345aa82 and bfbd5dc.

Files selected for processing: 5
  • quest/m0/checks/README.md
  • quest/m0/checks/differential.md
  • quest/m0/checks/stable-names.md
  • ts/Cargo.toml
  • ts/tests/fixtures.rs
Files with no reviewable changes: 1
  • quest/m0/checks/differential.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The TypeScript differential fixture harness now uses an optimized Cargo profile and runs Node with --single-threaded. Root-order checks compare outputs from separate base and added-root translations. The lang translation is cached for reuse, and the stable-names plan reflects this change.

Merge Risk: Minimal · previous review bfbd5

No actionable merge-blocking issue is established for these test-infrastructure changes. Merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the two main changes: the differential fixtures now run optimized and single-threaded, and lang's translation is shared. Both match the diff: a new differential Cargo profile with opt-…
Description check Passed The description states the problem, the approach, benchmark evidence, impact, alternatives, follow-ups, and checks. It matches the changeset: the differential profile in ts/Cargo.toml, the --single-th…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: the differential fixtures now run optimized and single-threaded, and lang's translation is shared. Both match the diff: a new differential Cargo profile with opt-level 1, Node running with --single-threaded, and a OnceLock shared between lang and stable_names. The title is specific and concise, though it is long (100 characters) and uses the chore(ts) prefix.

Full details: Description check

Explanation

The description states the problem, the approach, benchmark evidence, impact, alternatives, follow-ups, and checks. It matches the changeset: the differential profile in ts/Cargo.toml, the --single-threaded Node flag, the OnceLock shared translation, and the split of added_root into rooted and kept. It also covers the removed quest documents.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)

Finishing Touches
Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kixelated
kixelated enabled auto-merge (squash) November 2, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant