Skip to content

test(e2e): wait for reclaim before cleanup preview - #628

Merged
V3RON merged 2 commits into
mainfrom
bug/574
Oct 16, 2026
Merged

V3RON merged 2 commits into
mainfrom
bug/574

Conversation

@V3RON

@V3RON V3RON commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #574

Status

Implement: done (red then green, 5/5 stability runs) Review: round 1, 0 open Hardware: n/a Gate: running
Next: gate

  • Wait for the granted device to become ready before inspecting it and previewing cleanup — waitForDeviceState(env, dryRunDeviceId, "ready") before deviceRows and the preview (e2e/capacity-cleanup-nuke.test.ts:189).
  • Keep the scripted slow reclaim as the regression fixture — latencyMs.reclaim: 5_000 stays at e2e/capacity-cleanup-nuke.test.ts:187; the same assertion fails without the wait (proved below).
  • Correct nearby claims that release waits for reclaim — the claim is deleted, and no other line in the repo still says it (stale-refs.sh: clean).
  • Preserve idle demotion, dry-run proposals without destructive calls, and registry-only nuke assertions — every later assertion in the test is unchanged and passes.

What is this?

A fix for a flake in the capacity, cleanup and nuke end-to-end test: the dry-run
setup looked for a warm device immediately after release answered, but a release
answers while the device is still reclaiming, so the device was often not there yet.

How does it work?

The release helper now hands back the device it released, and the setup waits for
that device — by its driver id, so no other warm device can satisfy it — to reach
ready before the preview. The 5,000 ms scripted reclaim latency stays as the
regression fixture; nothing sleeps, and release keeps answering before reclaim
finishes.

Why is this useful?

The test stops depending on how fast the machine reclaims, which is how it failed
in CI, while still proving release stays asynchronous.

Assumptions

none

Review

Spec review: 0 blocking, 0 fixed, 0 notes. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 1. Tokens: n/a.

Review disclosure: delegating to the repo's reviewer agents was refused here
("Subagent depth limit reached (1)"), so each of the three passes was run in this
session against its own brief from .agents/briefs/, over the blind inputs from
.agents/scripts/review-inputs.sh 628 (diff, issue, triage report, ADR 0024,
always-in-scope, the rules, stale-refs.sh output, calibration), with the PR body
and commit messages withheld. These are not fresh-context agents and are labelled
as such. The kind of the diff is tests-only, so the code review ran the tests
lens only.

Proved, not assumed:

  • Red without the fix: the file at the reproduction commit fails the dry-run
    assertion by name (AssertionError: expected a ready (warm) device for the dry-run preview), same source tree.
  • Green with it: 1 run plus 5 stability runs, 2 passed every time.
  • Timing tests and Quality on the previous head failed with EADDRINUSE
    inside src/daemon/relay-promises.timing.test.ts, a file this diff does not
    touch (its project covers src/**/*.timing.test.ts only). It is a one-off
    ephemeral-port collision in a port pick documented as racy
    (e2e/helpers/port.ts): the test passes at base content locally and on the
    rebased head in CI, and no Timing job failed in the previous 100 CI runs. No
    flaky-test issue names it and no base-commit failure exists, so nothing was
    filed; the rebased head is green on its own.

Written by an agent.

V3RON added 2 commits October 16, 2026 20:48
Script a slow reclaim so the dry-run setup observes the same missing-ready assertion without relying on host load.
1 failing -> 0 failing. Carry the granted device identity into the dry-run setup and await its ready state while preserving asynchronous release and the slow-reclaim fixture.
@V3RON
V3RON marked this pull request as ready for review October 16, 2026 19:14
@V3RON
V3RON merged commit 4bab205 into main Oct 16, 2026
43 checks passed
@V3RON
V3RON deleted the bug/574 branch October 16, 2026 19:14
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.

Flaky: capacity-cleanup-nuke dry-run preview finds no warm device

1 participant