From 2ee7ad463ae5f4129998dcba8f8a3cd8cbe2a420 Mon Sep 17 00:00:00 2001 From: Anso Date: Wed, 9 Sep 2026 19:20:15 -0400 Subject: [PATCH] test(gitops): pin the source-row rollback in the 409 race test The 409 test asserted only the application row; the source row is written by the same transaction, so its survival is what proves the save rolled back whole. --- backend/src/__tests__/git-source-routes.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/__tests__/git-source-routes.test.ts b/backend/src/__tests__/git-source-routes.test.ts index 43672532..e1343973 100644 --- a/backend/src/__tests__/git-source-routes.test.ts +++ b/backend/src/__tests__/git-source-routes.test.ts @@ -2570,10 +2570,14 @@ describe('git-source policy compatibility', () => { .send(putBody({ auto_apply_on_webhook: false, source_policy: 'review' })); expect(res.status).toBe(409); expect(res.body.error).toMatch(/in flight/); - // The whole save rolled back: the policy did not change under the - // refused PUT. + // The whole save rolled back: the policy did not change, and the + // source row keeps its prior configuration (the upsertGitSource + // write sits in the same transaction as the refused transition). const application = GitOpsStore.getInstance().getLiveDirectApplication(stackName); expect(application?.source_policy).toBe('automatic'); + const source = DatabaseService.getInstance().getGitSource(stackName); + expect(source?.branch).toBe(putBody().branch); + expect(source?.pending_commit_sha).toBeNull(); } finally { fetchFromGit.mockRestore(); deleteRows(stackName);