test(runtime-host): bound owned-Host lifecycle tests to kernel contracts - #4814
Open
ggbdpq wants to merge 1 commit into
Open
test(runtime-host): bound owned-Host lifecycle tests to kernel contracts#4814ggbdpq wants to merge 1 commit into
ggbdpq wants to merge 1 commit into
Conversation
Fixes the intermittent failures reported in apache#4776. The test-side analysis and fix shape are @UncertaintyDeterminesYou4ndMe's (proposed in apache#4784 and donated in the issue after that PR was withdrawn); this commit implements it so the findings are not lost. - The launch-owner exit test gated its assertion on the Client's own `connection.closed`, which the Client aborts after a 2 s unanswered liveness probe, so a merely busy Host resolved it while still running. The assertion now waits on the process itself with a 20 s bound derived from the kernel's `shutdownGraceMs` contract, below the launcher's new 60 s idle grace. - The owned launch fixture's `idleGraceMs` (10 s) could expire mid-test and let an idle exit masquerade as an owner-loss exit; it now sits at 60 s with an explicit `initialConnectionTimeoutMs`. - "Exits promptly" now asserts shutdown start (the kernel's published `draining` registration) separately from shutdown completion, and the settle bound (15 s) sits above the kernel's own 10 s grace instead of inside it, so a starved-but-clean Host no longer reports an unclean exit. Fixes apache#4776 Generated-by: GLM-5.3-Flash (ZCode)
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
Fixes #4776 (intermittent owned-Host lifecycle failures). The root-cause analysis and the fix shape are @UncertaintyDeterminesYou4ndMe's, proposed in #4784 and donated to the issue after that PR was withdrawn; this commit implements the test-side fix so the findings are not lost, with small adaptations to the current tree.
Three waits were bounded by numbers the kernel does not promise:
connection.closed— the Client aborts that transport after a 2 s unanswered liveness probe, so a merely busy Host resolved it while still running, and the exit budget started at a moment unrelated to shutdown. The assertion now waits on the process directly (waitForProcessExit(pid, 20_000)), a bound derived from the kernel contract: owner loss cannot close a composition before startup settles, and the following shutdown is bounded byshutdownGraceMs(10 s). 20 s sits above every legitimate exit and below the launcher's new 60 s idle grace, so an idle exit cannot satisfy it.idleGraceMs: 10_000, which could expire mid-test and let an idle exit masquerade as an owner-loss exit. It now runs at 60 s with an explicitinitialConnectionTimeoutMs: 10_000so a Candidate no Client ever reaches still exits on its own.settlebound sat inside the kernel's own 10 sshutdownGraceMs— a starved-but-clean Host was force-terminated and reportedfalse !== true. The test now asserts shutdown start separately (polling the control directory until the registration disappears or reportsdraining, the state the kernel publishes before any shutdown work) and then settles at 15 s.Verification
node --test --test-name-pattern=…on both dist tests (fresh build)node --test owned-candidate.test.jsnode --test host-kernel.test.jsanswers an admitted bootstrap with draining after shutdown commits(EPIPE)npm run format:checkHonest limits: the full Runtime Host suite was also started on this Windows machine and stalled after ~350 tests on a file unrelated to this diff (an environment issue worth its own investigation; the UDS-inspect tests adjacent to the stall are Windows-skipped). The authoritative full-suite result will come from CI on Linux/macOS. The flake itself was reported on macOS arm64; per the issue's data (2/10 and 1/10 focused failures) the tightened bounds remove both timing holes the analysis identified.
AI use
Implemented with ZCode (GLM-5.3-Flash) from @UncertaintyDeterminesYou4ndMe's donated analysis and #4784 patch, adapted to the current tree and re-verified. The commit carries the
Generated-bytrailer.Checklist
shutdownGraceMs, idle grace), not magic numbers