Skip to content

flaky: physical-reclaim e2e quarantined-device retry test sees ready, not quarantined #1719

Done

Description

@V3RON

e2e/physical-reclaim.test.ts, "a daemon restarted with a quarantined physical device in state.db retries it after its quarantineNextRetryAt" failed on main at 6551fc0 (CI run 44289531652, E2E (1/3)): expected 'ready' to be 'quarantined'. It failed again on PR #1713 (run 44299851793, two attempts), whose diff touches neither physical reclaim nor quarantine; #1716, stacked on #1713 with the same code, passed it.

Written by an agent.

Activity

  1. added
    bug:new
    flaky-test
    on Nov 18, 2026
  2. self-assigned this
    on Nov 24, 2026
  3. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed. The bug is in the test; the daemon is correct. On bug/1719-repro, e2e/physical-reclaim.test.ts, "a daemon restarted with a quarantined physical device in state.db retries it after its quarantineNextRetryAt" waits until 1 s past quarantineNextRetryAt before its first status read, as a loaded runner does. It now fails every run with the CI error:

    pnpm test:e2e e2e/physical-reclaim.test.ts -t "retries it after its quarantineNextRetryAt"
    
    AssertionError: expected 'ready' to be 'quarantined' // Object.is equality
     ❯ e2e/physical-reclaim.test.ts:317:42
    
    CI run 44289531652, E2E (1/3): same assertion, test took 3333 ms (window: 2500 ms)
    

    Root cause

    Defect in the test. e2e/physical-reclaim.test.ts:303 (on main) sets quarantineNextRetryAt = Date.now() + 2_500 before withDaemon, the state.db seed and startDaemon. Line 315 then expects quarantined. On a slow shard that setup takes longer than 2.5 s. The restored timer (src/core/startup-converger.ts:61 → src/core/quarantine-coordinator.ts:165) then fires at once, since the retry is already due, and the device is ready before the first read. That is the right behaviour. The line is a wall-clock deadline, which testing rule 5 keeps out of e2e.

    Simplest fix

    On bug/1719-repro, delete line 317, the quarantined check. Keep the wait. The "not before it is due" side is still proven by timestampMs >= nextRetryAt on each uninstall (line 325).

    fix:      8 passed (8)   pnpm test:e2e e2e/physical-reclaim.test.ts
    mutation: quarantine-coordinator.ts:165 arms at clock.now(), ignoring the due time
              AssertionError: expected 1795532578494 to be greater than or equal to 1795532579397
               ❯ e2e/physical-reclaim.test.ts:325:56
    

    Alternatives rejected

    • A wider window (10 s): still a race with runner load, and 7 s slower.
    • Two seeded devices, one past due and one due in an hour: fully deterministic, but a new fixture for the same claim.

    Risk

    • On a runner whose start takes longer than 2.5 s, a retry that ignores the due time passes too. It never goes red wrongly.
    • The uninstall timestamps come from the daemon's clock (e2e/fake-driver/fake-driver.ts:778), the same clock that arms the timer.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  4. removed their assignment
    on Nov 24, 2026
  5. added
    bug:ready
    and removed
    bug:new
    on Nov 24, 2026
  6. self-assigned this
    on Nov 24, 2026
  7. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1827 (#1719)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  8. added a commit that references this issue on Nov 25, 2026
    1531951
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:readyflaky-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions