Skip to content

Commit 109008b

Browse files
os-warrenclaude
andauthored
fix(app-showcase): shut down kernels before disconnecting drivers in approval-resume-relation-expand.test.ts (#10767)
* fix(app-showcase): shut down kernels before disconnecting drivers in approval-resume-relation-expand.test.ts The afterEach in this test disconnected the drivers before shutting down the kernels, so every kernel's own teardown ran against a driver that was already gone. Swap the order: stop the producers, then remove the resource they depend on. packages/services/service-messaging/src/plugin-shutdown-stops-dispatchers.test.ts (#9371) already does it in the right order; the comment explaining why is carried across verbatim. Measured (not assumed): on current main this file's own DATABASE_ERROR console lines are all "no such table" probes against sys_organization/ sys_user/sys_member/sys_user_position/sys_user_permission_set/sys_position (tables this harness's bootShowcaseApprovals() never provisions) -- not post-disconnect reads. Before/after/ablation-restore all measure identically (31 DATABASE_ERROR lines in isolated runs, 36 in the full 24-file suite, byte-for-byte identical breakdown each time), so the reordering is a no-op for this file's console volume today. The fix still stands on the ordering principle itself, not on savings: draining a kernel against an already-disconnected driver is the wrong order regardless. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0f14f70b-575c-5f2b-a235-4000a55db042 * fix(app-showcase): correct the teardown comment to match the measurement The comment landed in the previous commit asserted that reversing the kernel/driver teardown order is what makes this file's DATABASE_ERROR lines appear -- but the PR's own before/after measurement shows the opposite: those lines are "no such table" probes bootShowcaseApprovals() never provisions, unaffected by the swap (36/31, identical before and after). Restate the comment as two separate claims: the ordering rule (why the change is correct regardless of today's cost) and the measured fact about this file's own DATABASE_ERROR lines (why the swap didn't move them). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PnJHU45vPJj5UQrxe946Bx --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 112a8c6 commit 109008b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

examples/app-showcase/test/approval-resume-relation-expand.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,20 @@ const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
6868
const openKernels: Array<{ shutdown?: () => Promise<void> }> = [];
6969
const openDrivers: Array<{ disconnect?: () => Promise<void> }> = [];
7070
afterEach(async () => {
71-
while (openDrivers.length) {
72-
try { await openDrivers.pop()?.disconnect?.(); } catch { /* noop */ }
73-
}
71+
// Kernels first, drivers second: the kernel's own teardown still wants a
72+
// live driver to drain against -- that is the rule, regardless of what it
73+
// costs on any given day.
74+
//
75+
// Measured here (#10373): this file's own DATABASE_ERROR lines are all
76+
// "no such table" probes against sys_* tables bootShowcaseApprovals()
77+
// never provisions, not post-disconnect reads -- swapping the order left
78+
// the count unchanged (36 suite-wide / 31 in this file, before and after).
7479
while (openKernels.length) {
7580
try { await openKernels.pop()?.shutdown?.(); } catch { /* noop */ }
7681
}
82+
while (openDrivers.length) {
83+
try { await openDrivers.pop()?.disconnect?.(); } catch { /* noop */ }
84+
}
7785
});
7886

7987
interface Booted {

0 commit comments

Comments
 (0)