Skip to content

fix(tests): stop the partial-pause quota test depending on installed CLIs - #63

Open
msabel-lang wants to merge 1 commit into
Himmelschmidt:mainfrom
msabel-lang:fix/quota-test-depends-on-installed-clis
Open

fix(tests): stop the partial-pause quota test depending on installed CLIs#63
msabel-lang wants to merge 1 commit into
Himmelschmidt:mainfrom
msabel-lang:fix/quota-test-depends-on-installed-clis

Conversation

@msabel-lang

Copy link
Copy Markdown

Companion to #62 — same class (a test reading the machine), different mechanism, so it's separate.

quota_partial_pause_fails_loud_without_collapse pauses cli:grok and expects the live gate to fail loud with exit 4, naming the paused ref without compacting the fleet. But pick_providers filters by presence before the quota gate, so a provider that isn't installed never reaches it.

The test papers over this with a branch: exit 4 asserts the real behaviour, and anything else falls through to an else that asserts exit 1, commented "offline / no binaries on PATH". That covers a machine with all three vendor CLIs, and a machine with none.

A machine with some matches neither. With Claude Code installed but not Grok or Antigravity, grok is filtered out before the gate, the plan succeeds, and spar exits 0:

$ spar provider list
claude   ok       /home/…/.local/bin/claude
grok     missing  -
agy      missing  -

$ cargo test --test plan_implement quota_partial_pause_fails_loud_without_collapse
assertion `left == right` failed: expected quota(4) when providers exist, got 0

Reproduced on pristine abcac30 with no local changes, and it still fails with #62 applied — which rules config out and leaves PATH as the cause.

That's the common case rather than a corner: anyone trying spar has the Claude CLI long before the others.

Approach

Stub claude, grok and agy onto PATH for this test so the fleet exists regardless of the host, then assert exit 4 unconditionally and drop the else entirely.

I chose stubbing over skipping so the coverage is restored rather than dropped — the regression this test guards (the old apply_quota_filter dropping the paused entry and sliding a different model into a role's slot) is now checked on every machine instead of only a fully-provisioned one. The pattern is borrowed from abandoned.rs, which already stubs a fake claude onto PATH.

The stubs are never executed — the run stops at the gate, which only consults presence. They're made executable because which has to resolve them.

quota_exit_when_all_paused needs no change: it pauses all three, so whichever one is installed is present-but-paused and reaches the gate on its own. That's why it survived where this one didn't.

Verified

Both quota tests pass on the machine that was failing this one, and the full suite is 463 passed, 0 failed.

…CLIs

`quota_partial_pause_fails_loud_without_collapse` pauses `cli:grok` and expects
the live gate to fail loud with exit 4, naming the paused ref without compacting
the fleet. But `pick_providers` filters by presence *before* the quota gate, so a
provider that is not installed never reaches it.

The test papered over this with a branch: exit 4 asserts the real behaviour,
anything else falls through to an `else` that asserts exit 1 and calls it
"offline / no binaries on PATH". That covers a machine with all three vendor CLIs
and a machine with none. A machine with *some* — Claude Code installed, Grok and
Antigravity not — matches neither: grok is filtered out before the gate, the plan
succeeds, and spar exits 0. The assertion then fails with

    expected quota(4) when providers exist, got 0

on a tree with no changes in it. That is the common case, not a corner: anyone
adopting spar has the Claude CLI long before the others.

Stub `claude`, `grok` and `agy` onto PATH for this test so the fleet exists
regardless of the host, and assert exit 4 unconditionally. The regression this
test guards — the old `apply_quota_filter` dropping the paused entry and sliding
a different model into a role's slot — is now checked on every machine instead of
only on a fully-provisioned one. The stubs are never executed: the run stops at
the gate, which only consults presence. They are made executable because `which`
resolves them.

`quota_exit_when_all_paused` needs no change. It pauses all three, so whichever
one is installed is present-but-paused and reaches the gate on its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants