Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: isolate handoff polling from filesystem timing (#13227)

Adam Eivy708b8641c519
diff --git a/server/services/cosMergeHandoff.test.js b/server/services/cosMergeHandoff.test.js
index 227bb0c62d..df5f0a3ffa 100644
--- a/server/services/cosMergeHandoff.test.js
+++ b/server/services/cosMergeHandoff.test.js
@@ -49,6 +49,13 @@ vi.mock('./untrustedContent.js', () => ({ screenUntrustedContent: async () => ({
vi.mock('./codeReview.js', () => ({
resolveReviewLoopOptions: async () => ({ reviewers: f.reviewers, usernames: [], optionalReviewers: f.optionalReviewers, reviewerMaxRounds: {} }),
}));
+// This synthetic managed app has no merged-tree capability. Keep its fake-time
+// poll tests independent of real filesystem scheduling; pendingMergeGuard.test
+// exercises the actual capability probe and checkout/command boundary.
+vi.mock('./pendingMergeGuard.js', async importOriginal => ({
+ ...await importOriginal(),
+ preparePendingMergeGuard: async () => ({ ok: true, evidence: null }),
+}));
const mergePrMock = vi.fn();
vi.mock('./git.js', () => ({ mergePR: (...args) => mergePrMock(...args) }));
const notifyMock = vi.fn(async () => ({ id: 'notification-1' }));
@@ -581,7 +588,7 @@ describe('handoff follow-up poll', () => {
// The coordinator's lazy imports load from disk, which a setImmediate drain
// does not wait for; warm them so a fresh worker settles like a warm one.
- beforeAll(() => Promise.all(['./prReviewerSecurity.js', '../lib/validation.js'].map((m) => import(m))));
+ beforeAll(() => Promise.all(['./prReviewerSecurity.js', './pendingMergeGuard.js', '../lib/validation.js'].map((m) => import(m))));
beforeEach(async () => {
vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout', 'Date'] });