Skip to content

CI: migrated test db template and six unit-pure shards - #1927

Merged
neuromechanist merged 4 commits into
devfrom
ci/unit-pure-template-shards
Oct 24, 2026
Merged

neuromechanist merged 4 commits into
devfrom
ci/unit-pure-template-shards

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

unit-pure takes ~31 min and has grown ~0.7 min/day (10 min a month ago), about 10-12 days from its 44-min timeout. Analysis of run 40061599144 showed ~20 s of setup and the rest one serial bun test over 644 files; backend time is dominated by freshDb() re-running all migrations at ~860 call sites.

  • Template database (backend/test/helpers/d1.ts): the migrated schema is built once per process and each freshDb() / freshDbWithForeignKeys() returns an independent Database.deserialize() copy. Same real SQLite, same real schema; a new test proves schema equality with a from-scratch migration, copy independence and the FK pragma. Full backend suite locally: 8446 pass, 0 fail, 183 s (was 420-640 s).
  • Six shards: unit-pure-shard (matrix 1..6, --shard=i/6 balanced by test/unit-pure-timings.json) plus a gate job that keeps the required check name unit-pure. The gate fails unless every shard succeeded, recomputes the file list itself, and requires the shards' reported list hash and counts to match it and their files run to sum to the full list, so a dropped slice cannot pass green. Mirrors the existing scrub-tools shard pattern.
  • One file classifier: scripts/ci/unit-pure-files.sh, used by test.yml and deploy-backend.yml's test-gate (left serial on purpose; it gains from the template). Stale timing comments fixed.

No test was removed or weakened; the no-mock policy holds (real SQLite).

Test plan

  • Full backend suite with the template: 8446 pass, 0 fail
  • Classifier lists the same files in the same order as the old inline loop
  • test/workflow-yaml.test.ts, test/ci-tier-routing.unit.test.ts (61 pass); YAML parses; bash -n on new run blocks
  • Local shard simulation with the timings file
  • This PR's own run: six shards plus the unit-pure gate green; compare wall time

🤖 Generated with Claude Code

freshDb and freshDbWithForeignKeys deserialize a copy of a lazily built migrated template. Full backend suite: 8446 pass, 183 s.
unit-pure-shard runs bun test --shard=i/6 with seeded timings; the unit-pure gate keeps the required check name and proves every classified file ran. The file classifier moves to scripts/ci/unit-pure-files.sh, shared with deploy-backend test-gate (left serial). Tier-routing guard reads the script.
Gate proves the exact set of files each shard ran (junit), none twice; deploy gate and shards write the classifier output to a file and refuse an empty list; one unit_pure_due output replaces three copies of the nine-term filter; tier guard pins both callers of the shared script.
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR1927

Version: 0.10.24-PR1927.ea36446
Commit: ea36446


🤖 Updated on each push.

The exactly-once block meant for the unit-pure gate was also inserted into the scrub-tools gate, which has no file list, so jq failed to compile and the gate went red although every scrub shard passed. Tested: workflow YAML and tier-routing suites (64 pass).
@neuromechanist
neuromechanist merged commit 12e7984 into dev Oct 24, 2026
46 of 47 checks passed
@neuromechanist
neuromechanist deleted the ci/unit-pure-template-shards branch October 24, 2026 18:31

This branch was previously deployed

1 inactive deployment
npm — ea364463 Deployed Oct 24, 2026 by neuromechanist via publish #3865
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant