Repository navigation
test(showcase): bring the teardown-race and approval-resume test files under the 10 s budget - #23273
Merged
objectstack-fleet[bot] merged 3 commits intoOct 13, 2026
Merged
Conversation
…owcase test files vitest-console-teardown-race: both legs now run their child vitest with a harness reporter that acknowledges console log N only when log N+1 arrives, so the newest console RPC is always pending at the teardown sweep (window 1, deterministic), and that records every teardown rejection the child's main process received at its exit beside the ones vitest graded (window 2, read rather than raced). One child run per leg replaces up to 8 ablation attempts plus 4 guarded repetitions; the skip path is gone because a silent ablation is now a broken instrument. The premise probe gains the main-process link the hold relies on. approval-resume-relation-expand: the stays-quiet watch ends on a settle point (the stranded run is failed and the delivery outbox owes nothing) instead of waiting out its 5 s window; the fixed 200 ms sleep before reading a run that decide() already resumed to its end is gone. Two new contract cases pin the settle end on read order, not on the clock. Claude-Session: https://claude.ai/code/session_012zwsLMxQBwHUYJgPyrpEvx Co-authored-by: Claude <noreply@anthropic.com>
The settle predicate is asked over a fake run log and a fake outbox: a run in its named status with only final deliveries settles; a pending, in-flight or unknown delivery state, or a run in any other status, keeps the watch open. Claude-Session: https://claude.ai/code/session_012zwsLMxQBwHUYJgPyrpEvx Co-authored-by: Claude <noreply@anthropic.com>
…owcase-slow-tests
objectstack-fleet
Bot
deleted the
claude/issue-23185-showcase-slow-tests
branch
October 13, 2026 14:05
This was referenced Oct 13, 2026
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.
Fixes #23185
Clause-②: no
Brings both
@objectstack/example-showcaserows of #23185 under the 10 s per-file budget. This PR closes both rows:test/vitest-console-teardown-race.test.ts38335967790)test/approval-resume-relation-expand.test.ts38202645321)"File wall" is the vitest JSON reporter's per-file
endTime - startTime, the same module duration the refresh lane reads; module loading is outside it. Before is at the baseafbf960c26and after is at this branch, both on the same 4-vCPU container under the shared verify lock. No timeout was raised, nothing was deleted, and nothing moved to another project. Pin, per the card: the next refresh PR's list no longer names either file.The fix replaces clocks with sync points. Where the time went, per file:
vitest-console-teardown-race.test.ts: from a race with a retry budget to two ordering factsWhere the time went. Each leg spawns a real child vitest, about 1 s each. The ablation leg retried up to 8 times until the teardown race happened to open, and the guarded leg repeated 4 times. On a loaded runner the race rarely opens, so a run paid all 12 children. That is the 20.8 s.
What was measured on the way. The race has two windows, both inside vitest, and a green run exits 1 only when both open:
$rejectPendingCallssweep runs.Instrumented traces of the child's main process showed the second window: in the non-reproducing runs the rejection did happen, and its
catchErrorlanded afteronTestRunEnd.The change. Both legs now run their child with a harness reporter,
test/fixtures/late-console-teardown/hold-console-acks.reporter.ts:onUserConsoleLogsettles. The reporter acknowledges log N only when log N+1 arrives, so the newest console RPC is always unacknowledged, and the sweep always finds one pending. This depends on ordering, not on load. The reporter docblock carries the full argument.stop, after sending its rejection report on the same ordered channel. So the reporter's verdict file recordsdelivered(every teardown rejection the main process received) besidegraded(the ones vitest's exit code saw). The path comes in through vitest's own--outputFile.holdConsoleAcks=...option.As a result, each leg runs once. The ablation grades on
delivered, and whengradedis non-zero it also requires a non-zero exit with the error printed. The guarded leg requiresdelivered == 0and exit 0. The skip path and its retry budget are gone: with the hold in place, a premise-intact ablation that delivers nothing is a broken instrument and fails as one. The premise probe gains a sixth marker for the one link the hold adds: thecli-apichunk's console RPC handler awaiting the reporters.PREMISE CONTROLgains the matching mutation case.The fixture's first
tick()now runs synchronously inside its test, so a console RPC exists before teardown takes itsrpcDone()snapshot. That makes the hold's precondition true by construction.types/node-shim.d.tsgains only the members the new code imports.Prototype measurements (one child per attempt, 4 vCPU, under the verify lock):
The last column is window 2. It is vitest's own race and no reporter hook can close it, which is why the pin grades the defect on the middle column.
approval-resume-relation-expand.test.ts: the stays-quiet watch ends on a settle pointWhere the time went. The pre-fix reverse check spent 5.2 s waiting out the full
INBOX_WATCH_MSwindow on every run, to conclude that nothing arrived. The first case added a fixedsleep(200).The change.
inboxStayedQuiettakes an optionalsettledpredicate. It is asked before the verdict read and ends the observation early.'quiet'still rests only on a fresh read taken after the observation ended, which is the [finding]deliveredInboxreturns SHORT on timeout, so a slow run is asserted as a wrong value — and in one call site that makes the test PASS for the wrong reason #10106 contract, and now recordsendedBy: 'settled' | 'deadline'.inboxSettled: the stranded run isfailed, and everysys_notification_deliveryrow is in a final state (success,deadorsuppressed). Any other state, including one added later, keeps the watch open. These two facts are sufficient because the inbox is a materialization of delivery: no producer writessys_inbox_messagedirectly. The call site assertsendedBy === 'settled', so the 5 s cannot come back silently.INBOX_WATCH_MSis unchanged and still only shrinkable.sleep(200)is gone.decide()awaits the resume (ApprovalService.serviceResumeawaitsautomation.resume), so the run is already terminal when it returns. Measured with a probe:completedright afterdecide, with the inbox row still pending in the outbox. That pending row is whatdeliveredInboxalready waits for.inboxSettledneeds both halves, including fail-safe on an unknown delivery state.Ablations (one-time proofs, nothing left in the tree)
Every mutation went through
node scripts/ablation-replace.mjsin wrap mode. Each one showed the anchor count going 1 to 0, a changed blob hash, and, on restore, a blob equal to HEAD and an emptygit diff HEAD. The expected direction was red each time, and red is what was observed. All runs were at53ed69f184, before the merge of main, which touched no file of this package.disableConsoleIntercept: truefromvitest.config.tsdelivered: 1)Promise.resolve()(no hold)completedinstead offailedendedBy, after paying the 5 s window (file 7.23 s)inboxSettleddrops its outbox halfLocal verification (at
5ea05a3201, the head of this PR)vitest runover the whole package (examples/app-showcase,--maxWorkers=2): 33 files, 412 tests passed, 0 skipped. It ran beside the gate battery, so the box was loaded. The two files read 2.95 s and 2.55 s, and no other showcase file was over 1.8 s.pnpm --filter @objectstack/example-showcase typecheck: exit 0.tsc --listFilescounts all 5 touched files in the program.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 39 derived, 38 exit 0, 1 NOT MEASURED. The reconciliation (--ran, exit codes recorded) reads "39 derived, 38 run, 1 NOT-MEASURED, 0 UNRUN". The NOT MEASURED one ispnpm check:dual-build-cjs-loads: its self-test passed (93 cases), then it exited 3 with PREREQUISITE NOT MET, because 8 packages outside this package's dependency closure (studio,client-react,embedder-openai,knowledge-memory,knowledge-ragflow,organizations,service-cluster-redis,service-knowledge) have nodist/in this worktree. No package'sdist/changes in this diff. CI reads it from a full build.node scripts/check-console-intercept-disarm.mjspassed (74 packages disarmed).pnpm check:nul-bytespassed.eslint.config.mjslints; all five were reported, none ignored. ②--format jsonreports 5 files, 0 errors and 0 warnings. ③ Invariance: this config never enables type-aware linting (noparserOptions.project, noprojectService), so this diff cannot move the verdict for any untouched file. The fullpnpm lintis CI's.@objectstack/example-showcaseis"private": trueand this diff only touches its tests and type shim, so it publishes nothing. Label:skip-changeset.Acceptance notes (observations, not filed)
disableConsoleIntercept: true. Carrier: none.examples/app-showcase/vitest.config.tsand the header ofscripts/check-console-intercept-disarm.mjsstill describe the window as one load-width span insiderpcDone(). The measured second window refines that description but does not contradict either file's prescription, so they are left untouched. Carrier: none.#10106watch-contract cases still spend about 1.1 s on real sleeps, by design (latency fakes). That is under budget and unchanged here.Generated by Claude Code