Skip to content

Burn down small build/test-hygiene issues - #724

Merged
bpowers merged 9 commits into
mainfrom
issue-burndown
Jun 8, 2026
Merged

bpowers merged 9 commits into
mainfrom
issue-burndown

Conversation

@bpowers

@bpowers bpowers commented Jun 8, 2026

Copy link
Copy Markdown
Owner

A cluster of small, related build- and test-hygiene fixes, one issue per commit.

Test correctness (engine)

  • Silently-skipped corpus: incremental_compilation_covers_all_models chained TEST_MODELS (repo-relative paths) onto a ../../-prefixed list and silently continued on failed opens, so every TEST_MODELS entry was skipped while the test name and panic denominator claimed the combined corpus. Paths are now prefixed and a failed open is a recorded failure. All corpus models pass with the loop actually running.
  • Production-threshold fixture: the rank_and_filter truncation test built 250 loops to trip the production MAX_LOOPS=200; it now uses the existing MaxLoopsGuard test override with a 5-loop fixture, per the documented rule in docs/dev/rust.md.

Lint-cap headroom (engine)

  • db/tests.rs was at 5995/6000 lines -- five lines from the per-file lint cap. Split two cohesive sections into sibling modules (incremental_compile_tests.rs, vm_verification_tests.rs) along the existing section headers; test bodies are byte-identical and tests.rs lands at 2943 lines.

Formatting gates (build/CI)

  • prettier: one-time sweep of 48 drifted files (isolated commit), then a js-needs-format gate in the pre-commit TypeScript pipeline and the CI frontend job. The script's egrep no longer excludes the real src/core sources (its core filter was aimed at generated lib*/ output).
  • ruff: one-time ruff format sweep of 9 drifted Python files (isolated commit), then a ruff format --check gate in scripts/pysimlin-tests.sh and the CI pysimlin job.

Pre-commit Rust pipeline (build)

  • Clippy and the 180s-capped cargo test previously ran concurrently against one shared build cache, so the cap absorbed compile time and lock waits -- tripping spuriously on cold caches (even for docs-only commits) and structurally on macOS, where the budget had to absorb all compilation. The pipeline now runs clippy, then cargo test --no-run (both untimed), then the capped test run, mirroring CI's compile-then-time structure. Every commit on this branch passed the restructured hook locally on macOS with ample headroom.

Fixes #623
Fixes #667
Fixes #645
Fixes #627
Fixes #664
Fixes #629
Fixes #703

bpowers added 8 commits June 7, 2026 17:04
… test

incremental_compilation_covers_all_models chained TEST_MODELS (repo-relative
paths) onto ALL_INCREMENTALLY_COMPILABLE_MODELS (../../-prefixed paths) and
opened each with a bare File::open from the crate dir, so every TEST_MODELS
entry hit the Err(_) => continue arm and was silently skipped -- the test
only ever exercised the prefixed list while its name and panic denominator
claimed the combined corpus.

Add the ../../ prefix to TEST_MODELS entries (matching the generated corpus
tests' concat!) and turn a failed file-open into a recorded failure instead
of a silent skip, so a renamed or missing fixture cannot quietly shrink
coverage again. The parse-stage and non-XMILE continue arms keep skipping
by design. All TEST_MODELS entries pass incremental compilation with the
loop actually running.

Fixes #623
…test

test_rank_and_filter_truncates_to_max_loops built MAX_LOOPS + 50 = 250
FoundLoops to trip the production cap, violating the documented rule
against testing production threshold gates with fixtures large enough
to trip them (docs/dev/rust.md#test-time-budgets). The test-only
override it should have used (MaxLoopsGuard, added in 76db318) already
existed and is used by the neighboring truncation-order tests.

Switch to a cap of 3 with 5 loops; the assertion is unchanged in
meaning and the fixture no longer scales with MAX_LOOPS if the
production constant is ever raised.

Fixes #667
db/tests.rs had grown to 5995 lines, five short of the 6000-line
per-file cap that scripts/lint-project.sh enforces in pre-commit and
CI, so the next non-trivial test addition would have blocked an
unrelated commit with a forced split under duress.

Move two cohesive sections (along the existing section headers) into
sibling test modules, following the db/ precedent of one file per test
concern: the incremental-compilation + AC acceptance-criteria tests
into incremental_compile_tests.rs, and the PREVIOUS/INIT opcode + LTM
incremental-verification tests into vm_verification_tests.rs. The move
is behavior-preserving: test bodies are byte-identical, only the
simple_project helper gains pub(crate) visibility so the siblings can
keep sharing it. tests.rs lands at 2943 lines.

Fixes #645
Nothing enforces prettier formatting on commit or in CI (eslint only
loads eslint-config-prettier to disable conflicting rules, it does not
check formatting), so 48 files across core, diagram, app, engine,
server, and serve-web drifted prettier-dirty on main.

Reformat everything in one isolated commit -- no behavior changes --
so the prettier --check gate added in the next commit starts from a
clean tree and unrelated future PRs stop picking up reformatting
noise. The sweep includes src/core, which the existing js-format
script's egrep excluded (its 'core' filter was aimed at generated
lib*/ output but also caught the real src/core sources); the gate
commit fixes that glob.
Neither the pre-commit hook nor CI verified prettier formatting --
eslint loads eslint-config-prettier solely to disable conflicting
rules -- so TypeScript files merged prettier-dirty and drift
accumulated on main (cleared by the previous commit's sweep).

Wire the existing js-needs-format script (prettier -l, exits nonzero
on drift) into the pre-commit TypeScript pipeline and the CI frontend
job, mirroring how cargo fmt --check is already enforced for Rust.
The script's egrep exclusion drops its 'core' term: that filter was
aimed at generated lib*/ output but also silently excluded the real
src/core sources from both js-format and the check; the lib/,
lib.browser/, and lib.module/ exclusions remain.

Fixes #627
The pysimlin gate runs ruff check (the linter) but nothing verifies
ruff format, so 9 lint-clean-but-format-dirty Python files drifted on
main across simlin/, examples/, scripts/, and tests/.

Reformat them in one isolated commit -- no behavior changes -- so the
ruff format --check gate added in the next commit starts from a clean
tree. This is the Python analogue of the prettier sweep two commits
back.
The pysimlin pre-commit step ran ruff check (the linter) only, and the
CI pysimlin job ran neither ruff command, so format drift accumulated
undetected (cleared by the previous commit's sweep).

Add ruff format --check to scripts/pysimlin-tests.sh (which the
pre-commit hook's Python pipeline runs) and a ruff format/lint step to
the CI pysimlin job, mirroring how cargo fmt --check and the new
prettier gate are enforced for Rust and TypeScript.

Fixes #664
The pre-commit Rust pipeline ran clippy --all-features and a
180s-wall-clock-capped cargo test concurrently against one shared
build cache. cargo serializes same-target-dir builds on a file lock,
so the capped test step's budget absorbed clippy's compile time: on a
cold cache this tripped the cap and reported 'Rust tests failed' even
for docs-only commits, and on macOS the budget also had to absorb all
compilation, which CI explicitly excludes (ci.yaml compiles with
cargo test --no-run before its 3-minute post-compile test cap).

Run clippy, then cargo test --no-run, then the capped cargo test
sequentially. Compilation and lock waits no longer count against the
cap, which now measures what it was built to police: the PR #461
pathological-test-runtime regression class. Wall-clock cost is small
because the hook's Rust pipeline runs concurrently with the slower
TypeScript pipeline either way. The timeout diagnostic now reflects
that a capped run is genuine test runtime.

Fixes #629
Fixes #703
scripts/check-docs.py validates backtick path references in CLAUDE.md
files against the filesystem, and src/engine's CLAUDE.md referenced
the wasm output directory as core/ -- a gitignored build product that
exists on dev machines (so the local pre-commit check passes) but not
on a clean CI checkout. Every CI run since 4c4c9a4 has failed the
Policy checks job on it.

Reword the reference so the checker doesn't treat generated output as
a tracked path; the prose still names the directory.
@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown

Reviewed the test-correctness changes, the build/test-hygiene plumbing, and spot-checked the prettier/ruff sweeps.

Verdict: correct.

  • incremental_compilation_covers_all_models now correctly prefixes TEST_MODELS and records open failures instead of silently skipping. The residual continue for non-XMILE extensions is pre-existing and benign for the current corpus (all .xmile/.stmx).
  • test_rank_and_filter_truncates_to_max_loops switches to MaxLoopsGuard::new(3) with a 5-loop fixture; MAX_LOOPS_OVERRIDE is thread_local!, so parallel test scheduling stays sound.
  • db/tests.rs → incremental_compile_tests.rs + vm_verification_tests.rs is mechanical; both helpers (simple_project, feedback_loop_project) are pub(crate) and the db.rs mod declarations are properly #[cfg(test)]-gated.
  • Pre-commit Rust pipeline: sequential clippy → cargo test --no-run → capped cargo test is well-motivated and clippy failures still reach $PIPELINE_A_OUT via the subshell redirect.
  • CI/script additions: pnpm js-needs-format and ruff format --check gates, plus the js-needs-format egrep fix dropping the spurious core/ exclusion, all check out.

No blocking findings.

@claude

claude Bot commented Jun 8, 2026

Copy link
Copy Markdown

Reviewed the patch across all 70 files / 9 commits.

The substantive logic changes are tight and well-justified:

  • Engine integration test (src/simlin-engine/tests/integration/simulate.rs:3689): the TEST_MODELS path-prefix fix and the silent-skip → recorded-failure swap correctly land the test on the combined corpus it always claimed to cover.
  • LTM truncation test (src/simlin-engine/src/ltm_finding_tests.rs:1297): the MaxLoopsGuard override + tiny fixture matches the documented rule in docs/dev/rust.md#test-time-budgets and the existing pattern in neighboring tests.
  • db/tests.rs split: the moved sections are byte-identical; simple_project correctly promoted to pub(crate); super::tests::simple_project import in incremental_compile_tests.rs resolves.
  • Pre-commit Rust pipeline (scripts/pre-commit): the clippy → cargo test --no-run → capped cargo test sequencing correctly removes compile time from the 180s cap, mirroring CI's structure.
  • Formatting gates (prettier in package.json + scripts/pre-commit + ci.yaml; ruff in scripts/pysimlin-tests.sh + ci.yaml): the gates work and the sweep commits cleared the trees so they start green. The js-needs-format egrep correctly drops the misplaced core exclusion so src/core/*.ts is now covered (verified the 5 src/core files are reachable by the new pattern).
  • CLAUDE.md fix (src/engine/CLAUDE.md:7): rewording away from the gitignored core/ path resolves the policy-check failure on clean CI checkouts.

The remaining ~3400 lines of diff are pure prettier/ruff reformatting (verified on spot-checks across diagram, engine, core, server, serve-web, pysimlin) — no behavior changes.

No actionable findings.

Overall correctness verdict: correct.

@bpowers
bpowers merged commit d50887e into main Jun 8, 2026
12 of 13 checks passed
@bpowers
bpowers deleted the issue-burndown branch June 8, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment