From e00b3323a53a9afa176d62eddcf40290fff1dbf6 Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 27 Oct 2026 05:07:17 -0500 Subject: [PATCH] Stabilize plugin refresh concurrency setup Co-Authored-By: Paperclip --- doc/plans/2026-10-24-plugin-job-sleep-audit.md | 14 ++++++++++++++ server/src/__tests__/plugin-scheduled-work.test.ts | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/doc/plans/2026-10-24-plugin-job-sleep-audit.md b/doc/plans/2026-10-24-plugin-job-sleep-audit.md index 5c745ecf9c0..119f6a9554b 100644 --- a/doc/plans/2026-10-24-plugin-job-sleep-audit.md +++ b/doc/plans/2026-10-24-plugin-job-sleep-audit.md @@ -88,3 +88,17 @@ This preserves the conservative Cloud sleep blocker for unknown external effects Related proposals: #7905 covers empty manifest sync; this migration needs that behavior on both activation paths. #11571 proposes company-scoped jobs; this migration retains the current instance-scoped contract and does not implement it. + +## Refresh/manual-dispatch test ordering (2026-10-27) + +CI job 122104710882 timed out in the manual-reservation concurrency case. Its +setup created due work before installing the outstanding-run snapshot barrier. +The creation notification could start dispatch first, leaving no runnable job +for the later refresh to query and no read-barrier arrival. An isolated local +run passed, so that retry alone did not establish the cause of the CI failure. + +The test now pauses background admission during setup and resumes it only after +the barrier is installed. It still holds a real database snapshot across the +manual dispatch, verifies the active reservation and concurrency bound, and +checks that all three jobs finish. All 33 plugin scheduling cases pass with +this ordering. Production scheduling, assertions, and test timeouts are unchanged. diff --git a/server/src/__tests__/plugin-scheduled-work.test.ts b/server/src/__tests__/plugin-scheduled-work.test.ts index e5aee58aa0a..64a04534535 100644 --- a/server/src/__tests__/plugin-scheduled-work.test.ts +++ b/server/src/__tests__/plugin-scheduled-work.test.ts @@ -303,6 +303,9 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu it("retains the manual reservation when a refresh read finishes after manual dispatch", async () => { await start(2); await quiet(); + // Creating due work also wakes the scheduler. Keep dispatch paused until + // the snapshot barrier is installed, regardless of notification timing. + draining = true; const row = await due("raced"); let resumeRead!: () => void, enteredRead!: () => void, releaseCall!: () => void; const readGate = new Promise(resolve => { resumeRead = resolve; }); @@ -328,6 +331,7 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu }); return builder; }); + draining = false; const refreshing = scheduler!.tick(); try { await readEntered;