Skip to content

Local just check fails on the 5s unit budget: ~26 to 40 git and signing tests in core run 5 to 11s #4472

Open

Description

@lex00

On a local 18-core Mac, just check on main (9f099d4) fails only on the 5s unit-test budget (test/unit-test-budget.setup.ts, #2817). There are no assertion failures: with CHANT_UNIT_TEST_BUDGET_MS=30000 the same run passes (28,999 passed, 147 skipped). CI passes because its runner keeps these under 5s.

Which tests, and how many, varies with load: 26 in a full just check, 40 in npx vitest run --project unit packages/core. They are the tests that drive real git repos, bare remotes and signing, in packages/core/src/workspace/ (ci-green*, ci-serve, ci-run*, runs*, lineage-, status-, work-history, check-contract, graph-contract, records-sessions-write), lifecycle/ (release-*, publish-resume, work-lease) and op/ (operator, work-lease-run). The same tests went over budget on the pre-epic main (8cd7346) in a side-by-side run during #4419.

Also seen independently during the multi-engine epic-ready (#4450): paired runs on main and the integration branch flipped between 0 and 11 over-budget tests with machine load alone, no assertion failures. That report (#4469) was closed as a duplicate of this one.

The budget is one number for every unit test today: unitTestBudgetMs(process.env) in test/unit-test-budget.ts, read by the setup file, with no per-file override.

Choices:

  • move these to *.e2e.test.ts, as the budget message suggests (they then stop running on pull requests);
  • give these files their own higher budget;
  • make them faster (shared repo fixtures, fewer git subprocesses).

Found during #4419's end-of-epic test pass.

Acceptance

  • (maintainer run) just check on main on the 18-core Mac passes with the default 5s budget two runs out of two, and npx vitest run --project unit packages/core reports no over-budget test.
  • CI's unit shards still pass with the default budget, and the listed files still run on pull requests (unless the ruling below moves them to e2e, in which case they appear in the e2e project's run in release-suites.yml).
  • If a per-file budget is added: a test in test/ asserts that a listed file gets its higher budget and every other file keeps 5s, and the budget message names the file's budget.

Open questions

  • How should the slow git and signing tests in packages/core stop failing the 5s unit budget locally?
    • (a) Move them to *.e2e.test.ts. Local just check passes, but they stop running on pull requests and only gate the release.
    • (b) Give these files a higher per-file budget (for example 15s). They keep running on PRs; needs a small per-file mechanism in the budget setup.
    • (c) Make them faster with shared repo fixtures and fewer git subprocesses. Keeps the 5s bar, but it is open-ended work across ~40 tests.
    • Recommended: (b) now, then (c) file by file, because these tests cover code every PR touches, so dropping them from PRs (a) costs more than a looser budget on a named list.

Activity

  1. added
    bug
    area:core
    area:ci
    on Oct 25, 2026
  2. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Also seen independently during the multi-engine epic-ready (#4450): paired runs on main and the integration branch flipped between 0 and 11 over-budget tests with machine load alone, no assertion failures. That report (#4469) is closed as a duplicate of this one.

  3. added
    epic:engine-ship
    on Oct 26, 2026
  4. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Maintainer rulings on this issue's open questions (2026-10-25, epic:engine-ship refinement):

    • How should the ~26-40 slow git/signing unit tests in chant packages/core stop failing the 5s unit budget on local just check?
      Ruling: Per-file budget
  5. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Merged into integration/engine-ship at f6aa69f (unit branch unit/es-chant-4472), following the ruling (per-file budget).

    What landed:

    • test/unit-test-budget.ts: SLOW_FILE_BUDGET_MS (15s) and SLOW_UNIT_TEST_FILES, the issue's file set spelled out as 46 repo-relative paths (packages/core/src/workspace: ci-green*, ci-serve*, ci-run* including ci-runner-key and ci-runner-start, runs*, lineage-, status-, work-history, check-contract, graph-contract, records-sessions-write; lifecycle: release-*, publish-resume, work-lease; op: operator, work-lease-run). The list is explicit names, not patterns, so a new file never joins it by accident. unitTestBudgetForFile(file, runBudget) gives a listed file max(15s, run budget), every other file the run budget, and 0 still turns every budget off. overBudgetMessage takes the file and, for a listed one, names the file and its budget.
    • test/unit-test-budget.setup.ts: reads the test's file from ctx.task.file.filepath, relative to the repo root, and applies that file's budget.
    • test/unit-test-budget.test.ts: cases asserting every listed file exists and is listed once, a listed file gets 15s while other files (including the same name as .e2e.test.ts) keep 5s, how CHANT_UNIT_TEST_BUDGET_MS interacts, and that the message names the file's budget. Written, not run (epic rule).
    • vitest.config.ts: the unit project's comment now says 5s default (it said 15s) and points at the list.

    The listed files stay in the unit project, so they still run on pull requests. Checked: tsc over the three test/ files is clean.

    Still missing: (maintainer run) just check twice on the 18-core Mac and npx vitest run --project unit packages/core with no over-budget test; CI unit shards with the default budget. Option (c), making these files faster and taking them off the list one by one, is left for later.

  6. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Ticked the per-file budget item: unit-test-budget.test.ts (merge f6aa69f) passed in the epic-ready unit runs; chant main e17daa8.

    Budget finding from epic-ready, for the maintainer's runs to decide. Three full npx vitest run --project unit runs on this Mac:

    • d02d65d (first run): packages/core/src/cli/handlers/pr-waves-blocked.test.ts "re-run once db is fixed: wave 1 applies db, and wave 2 applies web" took 5.7s, and packages/core/src/workspace/intent-gaps.test.ts "the warning follows the revision read..." took 5.2s, both over the 5s budget.
    • d02d65d (second run): pr-waves-blocked.test.ts again, 5.2s; intent-gaps passed.
    • 9ae806b (third run): no budget failure.
      Run alone, both files passed 3 of 3. pr-waves-blocked.test.ts takes the same time alone on main and on the integration tip (file 5.38s vs 5.24s), so it is load and not a regression. Neither file is in the named slow list, and neither drives git or signing.

    Left: (maintainer run) just check on main twice with the default budget, and npx vitest run --project unit packages/core with no over-budget test; then CI's unit shards on main.

  7. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Main is now 1b233ff (tree equal to tested tip 991ca77; unit suite 29255 passed). The steps above still hold; the only change since e17daa8 is #4475's drift-record files.

  8. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    epic-ready (round 2, F1), per the #4502 ruling: packages/core/src/workspace/intent-gaps.test.ts is added to SLOW_UNIT_TEST_FILES in test/unit-test-budget.ts (#4472's per-file budget list, 15s per test), with the reason in a comment: it walks real git history per test and is load-sensitive.

    Orchestrator's measurement, the file alone, three runs on 556c71d: wall 5.4s, 14.9s, 16.9s (target 2.5s alone); slowest test 1.8s, 4.7s, 5.9s; run 3 failed the 5s budget on "the warning follows the revision read: under --at c1 ...", and that flips with load. pr-waves-blocked.test.ts met the target (0.08 to 0.16s, 3/3 tests), so it stays off the list.

    Merged to integration/engine-ship as 2bd59e9 (branch unit/es2-chant-fix-gapsbudget). npx vitest run test/unit-test-budget.test.ts: 7 passed.

  9. lex00 commented on Oct 26, 2026

    @lex00
    ContributorAuthor

    Ready for the maintainer (epic:engine-ship round 2, 2026-10-26).

    chant main is 9b8fa99 (the merge of integration/engine-ship, tree equal to the tested tip 280be4e; unit suite 29365 passed, 2 budget-only failures under load, no assertion failure). Push CI on main passed (chant run 40407754959).

    Ticked item 2: chant run 40407754959 on main 9b8fa99 (push, 2026-10-26 21:50Z) passed all four test-shard jobs. They run npx vitest run --project unit --shard=<n>/4 with no CHANT_UNIT_TEST_BUDGET_MS override, so the default 5s budget applies. chant.yml runs the same jobs on pull_request, and the listed files stay in the unit project.

    Load findings from round 2's epic-ready, all on this Mac:

    Left: item 1 (maintainer run). On the 18-core Mac, on chant main 9b8fa99 with npm ci and bash scripts/ci-lexicon-artifacts.sh --steps generate,bundle done:

    1. just check, twice, with CHANT_UNIT_TEST_BUDGET_MS unset. Both should pass.
    2. npx vitest run --project unit packages/core should report no over-budget test.

    Run them on a quiet machine. The findings above say other suites running at once are enough to push a 2s test past 5s. A test that goes over only under load fits option (c), making it faster, or a place on the per-file list with its reason.

  10. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Finding from consolidation-graph epic-ready (2026-10-26), chant integration f0a894e: in a full npx vitest run --project unit (2193 files, run while other worktrees were compiling and testing), five tests went over the 5s budget and each passed when its file ran alone right after:

    • lexicons/terraform/src/components/pr-loop.tofu.test.ts: "a plan that changed after review is refused..." 5.8s, "a dependent whose real plan exceeds its placeholder preview..." 6.6s; alone 6/6 pass
    • packages/core/src/workspace/decide.test.ts: 5.1s; alone 31/31 pass
    • packages/core/src/workspace/export-import.test.ts: 5.5s; alone 9/9 pass
    • packages/core/src/workspace/trust/record-seal.test.ts: 5.6s; alone 15/15 pass
      These are load flips, the class this issue tracks; none is over budget alone, so none joins SLOW_UNIT_TEST_FILES.
  11. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Second full run (consolidation-graph epic-ready round 2, chant integration b6281ef): three budget overruns, each passing 3/3 alone right after:

    • lexicons/terraform/src/components/pr-loop.tofu.test.ts: the same two tests as round 1 ("a dependent whose real plan exceeds its placeholder preview..." and "a plan that changed after review is refused..."). This file has now flipped in both full runs, so it sits close to the 5s budget under load; alone it stays under.
    • packages/core/src/workspace/intent-squash.test.ts: "--follow-squash fetches the pull request's head..."
      Also seen by a fixer in round 1: local-executor.test.ts "parallel phase runs steps concurrently (~max, not sum)" at 116ms against its 110ms wall-clock limit under load, then 3/3 passes.
  12. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Ready for the maintainer (consolidation-graph, 2026-10-27)

    chant main is now 47b8594 (tree equal to the tested tip b6281ef).

    What epic-ready showed: two full unit runs on this machine under load (comments above) had five and then three budget overruns, all passing alone right after, none over budget alone, so SLOW_UNIT_TEST_FILES did not grow. pr-loop.tofu.test.ts flipped in both runs and sits close to 5s under load. The second run passed 30275 tests.

    Left: item 1 (maintainer run), just check twice on the 18-core Mac with the default 5s budget on a quiet machine, plus the packages/core unit run with no over-budget test. Report any test that fails there with its time.

    Commands: run sheet entry G5 in Run sheet: engine-wt/goals/consolidation-graph-1-runs.md.

  13. lex00 commented on Nov 20, 2026

    @lex00
    ContributorAuthor

    The budget also trips in CI shards, and each test passes when the failed jobs rerun. Three runs on 2026-11-20 went over:

    test time
    graph-schema sync, packages/core/src/graph-schema/graph-schema.test.ts (run 44689705087, shard 4/4) 5.6s
    gate.test 5.3s
    pinned-upgrade-multi 5.1s

    Each pull request that hits one waits a full rerun before it can enter the merge queue.

  14. lex00 commented on Nov 20, 2026

    @lex00
    ContributorAuthor

    More CI shard runs went over the budget on 2026-11-20, each in a file the pull request did not touch. Every one passed when the failed jobs ran again.

    run tests over budget longest
    44725345136 (#5381) retention.test.ts (2), status-mixed.test.ts 19.6s
    44734432715 (#5386) release-floors.test.ts, declared-kinds.test.ts, pr.test.ts, trust.test.ts 10.8s
    44738302287 (#5383) plan-stale.test.ts, source-release.test.ts, boxes.test.ts 11.8s

    The load scaling raises the limit to about 6.4s at a load of 5 on 4 cores, and these tests take 7 to 12s on the shard, so each pull request in the queue risks one rerun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciarea:corebugepic:engine-ship

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions