Skip to content

test(core): guard boot work counts for catalog lookups, Azure clones and git spawns - #58892

Merged
kitlangton merged 2 commits into
devfrom
test/boot-work-guard
Oct 25, 2026
Merged

kitlangton merged 2 commits into
devfrom
test/boot-work-guard

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What it does

Adds a test that counts the work done by a cold folder boot plus one session turn. It fails if a speedup from #58600, #58601 or #58602 regresses. It asserts exact counts, not timings.

How it works

  1. Boots a real git folder and runs one turn with TestLLM. Nothing goes over the network.
  2. Counts the work through layers the tests already swap in:
    • git spawns, through a wrapped ChildProcessSpawner;
    • catalog lookups and Azure model edits, through a wrapped Model.Service;
    • git PATH lookups, through a spy on which.sync.
  3. Asserts these counts:
    • git spawns: 8 during boot and 9 during the turn (17 total, the number refactor(core): resolve real git binary once on macOS #58602 measured);
    • git executable lookups: 0, and every spawn uses the resolved path;
    • catalog lookups per step: 1;
    • Azure model edits on a model rebuild, with Azure enabled but no resource name: 0.
  4. On failure, it prints each count that moved and by how much, followed by every git spawn. Changing a count on purpose is fine. Update the number in the test and say why in the PR.

Risk

Test only, no src changes. A legitimate new git spawn or catalog lookup fails this test until the expected number is updated, which is the point.

Proof

  • Reverting all three speedups locally fails the test with: git lookups 0 → 17 (+17), catalog lookups per step 1 → 6 (+5), Azure model edits 0 → 78 (+78).
  • Passes with bun run script/test.ts test/boot-work.test.ts and bun test, with the same counts across 6 repeated runs.
  • bun typecheck (core), oxlint and prettier are clean.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new test runs the same way every time and catches the regressions it guards. I ran it 12 times (some under CPU load) and the counts never changed. With #58601 and #58600 reverted locally it fails with a clear drift report (catalog lookups per step 1 → 6, Azure model edits 0 → 156) and lists every git spawn. tsc -b on core is clean.

Public API is unchanged; the change is test-only.

No blocking concerns. One note: on Linux CI, git is never looked up on PATH, so the git-lookup and resolved-path checks always pass there. Only the macOS and Windows runs exercise #58602's part, which the test's comment already says.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The follow-up is fine. It allows one git PATH lookup, for the Windows Git Bash lookup. A regression back to a lookup on every spawn would still fail the test, since that adds about 17 lookups. The test still passes repeatedly on Linux and tsc -b on core is clean.

Public API is unchanged; the change is test-only.

No blocking concerns. Minor: the extra lookup is allowed on every platform, not only Windows, so a single new git lookup on macOS would go unnoticed.

@kitlangton
kitlangton merged commit 6820420 into dev Oct 25, 2026
12 checks passed
@kitlangton
kitlangton deleted the test/boot-work-guard branch October 25, 2026 22:50
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