Repository navigation
desk-hub: fix two test flakes (the offline sweep's 401, the lease test's margin) - #107
Conversation
…pool's load breaks provisioning-sweep: a revocation deletes the machine's record, tells every project, and then deletes its Access token, so between the record and the token the Worker refuses the credential 403 not-enrolled, and Access's 401 comes only after (the spec's §3 order). The sweep's revocation is the alarm's, which the suite does not await: the race and late tests saw the record gone and asked at once, reading 403 when the token's deletion had not landed (runs 39568222090, 39582934642). They now wait for the token as the gone and fenced tests already did (`tokenGone`). With the API's deletion answered 400 ms late, the old tests fail both and the new ones pass. session-plane: the lease test ran a 1.2 s lease on a 200 ms heartbeat and asserted the machine never read offline over 2.5 s; one renewal landing more than a second late (a stall anywhere from the hub's timer through the suite's proxy and client back to the project) lapsed the lease (run 39568222090). A 3 s lease now, and the wait ends a second past the lease the hello started. With the acks paused 1.3 s, the old test fails as in CI and the new one passes (and at 2.4 s); with no ack renewing, the new one still fails. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Gates for head 27de1cf: Post-fix repeat runs, on the pool with 20 whole-suite copies of each file added to the full unit suite, both green:
Counting the gate's own run, that is 42 executions of each fixed test with no failure. Review ( Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook) |
Fixes two desk-hub test flakes on master. In both, the test was wrong and the hub's code was right.
provisioning-sweep: "binds each candidate to the enrollment it read…"
It failed in runs 39568222090 and 39582934642 with
expected '403 not-enrolled' to be '401 access'.Cause.
Registry.revokeMachinedoes three things in order:sweepRevocations).sweepOrphans).Between steps 1 and 3, the Worker refuses the credential with
403 not-enrolled. Access's401comes only after the token is gone. The provisioning-keys spec (§4, "What the credential gets afterwards") sets this order, so the code is right.The revocation here runs from the Registry's alarm, and the suite doesn't await it. The race test, and the "late" test written the same way, saw the record disappear from the list and asked right away. On a loaded box the token's deletion hadn't landed yet.
Fix. Both tests now wait for the token (
tokenGone), as the gone and fenced tests already did.Evidence:
session-plane: "hb-acks of the current generation keep the machine online past its lease"
It failed in run 39568222090: the machine was seen offline once.
Cause. The test ran a 1.2 s lease on a 200 ms heartbeat and asserted that the machine never read offline over 2.5 s. That leaves 1 s for each renewal's round trip:
hb-ackback through the Worker and the Machine object toProject.renew.A stall of more than a second anywhere along that path lapses the lease. When the next renewal arrives, the machine comes back online. The deployed lease is 45 s on a 15 s heartbeat, so the hub's behaviour is as designed.
Fix. The test now uses a 3 s lease. Its wait ends 1 s after the lease that the hello started.
Evidence. I paused the client's acks in the middle of the window:
"online": false)The last column shows the fixed test still detects renewals that don't renew.
Rarity. Across about 90 failed gate runs since 10-19, this test failed once (39568222090) and the sweep test failed twice. The lease flake did not reproduce in 40 amplified copies on the pool, nor locally under CPU load. That is why the evidence above injects the stall rather than waiting for one.
Repeat runs under CI's conditions
Each run was on ci-kit's pool, with the unit job at
--maxWorkers=nproc. Each added 20 whole-suite copies of each file to the full suite.The pre-fix runs carried diagnostics (
SWEEP-DIAGandLEASE-DIAGlines in their logs).Gates and review
scripts/ci-gate.sh --gates static,unit: result in a comment.doperpowers:reviewer-low, verdict in a comment.Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)