Repository navigation
test(daemon-client): stop waiting out the contention budget in real time - #4856
Merged
Merged
Conversation
`ensureDaemon` judges a contended state directory once per attempt and waits `JUDGE_AGAIN_DELAY_MS` between attempts, for `ceil(DAEMON_TEARDOWN_GRACE_MS / JUDGE_AGAIN_DELAY_MS)` attempts. The file already mocks `sleep`, so the waits cost nothing, but every attempt re-reads the registration, and one read of a held lock runs one host process-table snapshot. 300 snapshots of a registration the case keeps alive and unchanged is what made these two tests the slowest in the file and pushed them past the slow-test budget on 2-core runners, and to the 5 s test timeout inside the Stryker dry run. Read the registration's lock inspection once, from the real host, and replay it for the rest of the loop, scoped to that one lock path. The budget is now asserted through the waits it asks for instead of being waited out, so shrinking the loop in production fails these tests.
Contributor
Size Report
Startup median (7 runs, lower is better):
|
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
Member
Author
|
The change at c241f8c looks correct, with no problems found in the diff. It only touches tests, and all 14 checks pass. There are no conflicts. Not verified here: the tests and the mutation were not run locally. |
thymikee
deleted the
fix/0.22-daemon-client-contention-test-real-wait
branch
November 20, 2026 20:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Same commit as #4855, cherry-picked onto
0.22. The patch is identical, so the next0.22rebase ofmaindrops it rather than conflicting.daemon-client-ensure-explicit-lifecycle.test.tsproved the contention budget by exhausting it.ensureDaemonjudges a contended state directory once per attempt and waitsJUDGE_AGAIN_DELAY_MSbetween attempts, forceil(DAEMON_TEARDOWN_GRACE_MS / JUDGE_AGAIN_DELAY_MS)= 300 attempts. The file already mockssleep, so the waits were free — but every attempt re-reads the registration, and one read of a held lock runs one host process-table snapshot. 300 snapshots of a registration the case keeps alive and unchanged is the real wall clock, and it is what broke the slow-test gate and the 5 s test timeout in the Stryker dry run (see #4855).The two
daemon-lifecycle-contendedtests now read that lock inspection once, from the real host, and replay it for the rest of the loop, scoped to that one lock path, and assert the attempt budget through the waits it asks for instead of waiting it out. No production change, no new option.Measured locally, solo file,
--project unit-core, base and head on the same install and machine:7216f2a2a6Validation
Head
c241f8ca5a, focused checks (no localcheck:affected, per task):packages/daemon-client: 40 files, 352 passed (the 3 gate warnings left are pre-existing, other files)pnpm typecheck,pnpm check:layering,pnpm format,fallow audit --base origin/0.22: cleanENSURE_ATTEMPTShalved →2 failed | 22 passed(150 judge-again waits of 250ms must just cover the 75000ms teardown grace (37500ms)), reverted by handUnresolved, as on #4855: unrelated tests here still do 1–5 real 100–250 ms probe waits (max 1.1 s). Bounding those means the virtual clock
daemon-client-ensure-drain.test.tsalready has — separate work.