fix(test): snapshot postHookActions array in test helper to match production drain

The test drainPostHookActions helper iterated the live array, but
triggerInternalHook snapshots with [...(event.postHookActions ?? [])]
before draining. Align test helper to match production semantics.
This commit is contained in:
zeroaltitude 2026-03-08 21:50:57 -07:00
parent a0073bfb9b
commit c032cfbec5
No known key found for this signature in database
GPG Key ID: 77592FB1C703882E

View File

@ -578,7 +578,11 @@ describe("session-memory hook", () => {
async function drainPostHookActions(event: {
postHookActions: Array<() => Promise<void> | void>;
}) {
for (const action of event.postHookActions) {
// Snapshot before draining — matches triggerInternalHook's production
// semantics (prevents self-scheduling actions from executing in the
// same drain cycle).
const pending = [...event.postHookActions];
for (const action of pending) {
try {
await action();
} catch {