Repository navigation
test(adoption): handshake real-child waits and size generation budgets for load (HACK-1319) - #551
Conversation
…dgets from load (HACK-1319) - Binding: the cancellation tests wait for the hanging fake Docker child by handshake (PID published, or the operation settled first) instead of a 15 s wall-clock wait, and give that probe the largest deadline the product admits. The timeout test pins Date.now() so its 150 ms deadline is armed after the spawn and always has a child to reap. - Generation: named budgets replace the 20/30/60/90 s literals. Retained operations get the public command's deadline; each case's budget covers its adoption work plus one deadline per operation, so a slow host ends in the product's own refusal rather than a Bun timeout that blocks every later case. Expiry tests name their deadline and refusal slack. Hanging fake children publish PIDs by rename, and the cancelled-effect wait is a handshake. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review (GPT-6-Astra, codex-dio): VERDICT: CLEAN at 75cf412. Reviewer thread mcp:cc4af3dc-6c8a-4e2e-9932-af0330123e26. Static review of the exact-head diff against origin/next. GraphQL reviewThreads pagination returned no threads. The ordered signed merge from next and exact-head required test gate remain before READY. No PR merge performed. |
|
Independent review (GPT-6-Astra, codex-dio): VERDICT: CLEAN at 116509d. Reviewer thread mcp:cc4af3dc-6c8a-4e2e-9932-af0330123e26. Re-reviewed after the verified signed merge of next at 472ec94. No manual conflict-resolution changes. Fresh paginated GraphQL reviewThreads returned zero threads. The independent review is static; hosted exact-head required test remains pending. No READY line until that check is green and the branch remains current. No PR merge performed. |
Closes HACK-1319. This changes tests only: no product timeout or product code changes.
Findings
"moving job snapshot" fails locally (environmental, not a product defect). When the ticket was filed, this case's ordered start had a fixed 20 s deadline and a 30 s test limit. On the pre-#487 test at load average ~100, it timed out after 30 s; at ~58 it finished in 18 s of its 20 s deadline. Each fake Docker query is a cold Bun process, so the start was budgeting host process start-up, not product behavior. #495 (HACK-1452) already sizes that deadline from the counted freshness checks (
ORDERED_START_FRESHNESS_CHECKS). On this branch's base, the case passed in every loaded full-file run below. This PR does not change it."real child" tests used wall-clock waits.
Date.now()when it is created and spawns later, so a stall between the two could use up the whole deadline before any child existed (children.length > 0failed).Generation v5/v7 (and static7) cases outgrew their 20/30/60 s limits. With every limit lifted at load average ~90 (20 cores), the slowest cases took 27 s (plain saved adoption), 44 s (retained operations) and 60 s (public static7 up/down). The public adopted command gives each operation a 90 s deadline (
DEFAULT_COMPOSE_STARTUP_TIMEOUT_MS), but those tests allowed 60 s in total. A Bun timeout leaves the owner running, so the file's settlement guard makes every later case refuse: one timeout produced 118 failures.Changes
tests/native-compose-adoption-binding.test.tsstartedChild(pending)is a handshake: it returns when the child publishes its PID, and fails with a distinct message if the operation settles first. It has no clock of its own. Both cancellation tests give their probeCANCELLED_CHILD_PROBE_DEADLINE_MS(60 s, the largest deadline the product admits), so only the abort ends it.Date.now()(setSystemTime) while it acquires. The probe then arms its wholeEXPIRING_PROBE_DEADLINE_MS(150 ms) as a real timer after the spawn, so there is always a child to reap. The clock is restored infinally, and the reaping assertions are unchanged.tests/native-compose-adoption-generation.test.tsADOPTION_CASE_TIMEOUT_MS: 120 s, for saved-adoption and CLI cases (~4× the measured worst).RETAINED_OPERATION_DEADLINE_MS: the public command's 90 s deadline, replacing the 16Date.now() + 20_000caller deadlines.retainedOperationCaseTimeout(n): adoption budget plus one deadline per operation, so a slow host ends in the product's own refusal before Bun's timeout.EXPIRING_OPERATION_DEADLINE_MS(15 s, was 5 s, so the pre-callback probes fit) andDEADLINE_REFUSAL_SLACK_MS(5 s, was 1.5 s). The cancelled-effect bound is namedCANCELLED_EFFECT_REFUSAL_BOUND_MS(10 s, was 4 s). It stays far below the 60 s fake child and the deadline, so only cancellation can satisfy it.Verification
tsc --noEmit: clean for both files.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.