From 1ddf4726e72f432886076f6dfd30480da268e090 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 19 Jul 2026 12:31:26 +0000 Subject: [PATCH 1/4] fix: require MongoDB replica-set primary in healthcheck The mongodb healthcheck previously treated any writable primary as healthy. During first boot, Docker's temporary init mongod is a writable standalone, so compose could mark the service healthy before rs0 elected a primary. That race caused flaky documentsdb E2E failures with NotPrimaryNoSecondaryOk (e.g. ProjectsConsoleClientTest::testDeleteProjectWithMultiDB on PostgreSQL dedicated). Require hello.setName === 'rs0' so only the replica-set primary counts as healthy. Co-authored-by: Chirag Aggarwal --- docker-compose.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b520f14d88..26bbcbcdf0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1301,12 +1301,15 @@ services: - /bin/bash - /mongo-entrypoint.sh healthcheck: + # Require replica-set primary (setName === 'rs0'). Docker's first-boot + # temporary mongod is a writable standalone; treating that as healthy lets + # CI start tests before rs0 has a primary (NotPrimaryNoSecondaryOk flakes). test: | bash -c " mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval \" try { const hello = db.adminCommand({hello: 1}); - if (hello.isWritablePrimary) { + if (hello.isWritablePrimary && hello.setName === 'rs0') { quit(0); } } catch (e) {} From 97adfc0b2c0996f36b73821464204605a0b36a43 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 19 Jul 2026 12:57:32 +0000 Subject: [PATCH 2/4] chore: drop healthcheck comment from docker-compose Co-authored-by: Chirag Aggarwal --- docker-compose.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 26bbcbcdf0..87041ef3a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1301,9 +1301,6 @@ services: - /bin/bash - /mongo-entrypoint.sh healthcheck: - # Require replica-set primary (setName === 'rs0'). Docker's first-boot - # temporary mongod is a writable standalone; treating that as healthy lets - # CI start tests before rs0 has a primary (NotPrimaryNoSecondaryOk flakes). test: | bash -c " mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval \" From 82cd53403e570ccdc5de18005b9b2b911216f67b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 19 Jul 2026 12:58:54 +0000 Subject: [PATCH 3/4] chore: note rs0 means replica set 0 Co-authored-by: Chirag Aggarwal --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 87041ef3a4..d80bcce544 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1301,6 +1301,7 @@ services: - /bin/bash - /mongo-entrypoint.sh healthcheck: + # replica set 0 test: | bash -c " mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval \" From 9aacd8e241bb0f967f10a3a5ba4640c14546972c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 19 Jul 2026 12:59:27 +0000 Subject: [PATCH 4/4] chore: remove rs0 healthcheck comment Co-authored-by: Chirag Aggarwal --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d80bcce544..87041ef3a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1301,7 +1301,6 @@ services: - /bin/bash - /mongo-entrypoint.sh healthcheck: - # replica set 0 test: | bash -c " mongosh -u root -p ${_APP_DB_ROOT_PASS} --authenticationDatabase admin --quiet --eval \"