Skip to content

fix(db-gate): stop the unit test from killing other worktrees' gates - #96

Merged
Programcode merged 1 commit into
mainfrom
fix/db-gate-test-docker
Oct 2, 2026
Merged

Programcode merged 1 commit into
mainfrom
fix/db-gate-test-docker

Conversation

@Programcode

Copy link
Copy Markdown
Owner

Running npm test anywhere on the VPS killed any database gate or verify stack running in another worktree. This had already cost at least eight 10-to-13-minute gate runs.

Cause. src/test/scripts/db-gate.test.ts runs the real .superset/db-gate.sh with HOME pointed at a temp directory and only supabase and npm stubbed. The temp HOME puts the lock somewhere else, so the test never waits for the shared lock. The script fails at npm run test:db as the test intends, and its cleanup then runs the real docker rm -f debatelab-fake-openrouter. That container belongs to whichever worktree is running a gate.

Fix.

  • db-gate.sh removes the fake provider in cleanup only if this run started it. verify.sh already guards its own cleanup the same way (FAKE_STARTED).
  • The test stubs docker and writes its calls to the same log, so the existing exact-match assertion fails if cleanup ever calls docker on this path again. TMPDIR points at the test's temp root so a failed run doesn't leave a runtime directory in /tmp.

Verification.

  • Reproduced first. With the docker stub added and the script unchanged, the test failed and the log showed docker rm -f debatelab-fake-openrouter between npm run test:db and supabase stop.
  • With the script fix the test passes. bash -n is clean.
  • I deliberately didn't run the old test against real docker: a verify stack from another worktree held the lock the whole time, and running it would have killed that stack.

Overlap: the chore/test-diet worktree has an uncommitted, different edit to the same test that stubs docker but still expects the docker call. Whichever lands second needs a small rebase.

🤖 Generated with Claude Code

db-gate.test.ts runs the real .superset/db-gate.sh with HOME pointed at
a temp directory, which skips the shared stack lock. The script's
cleanup then ran the real `docker rm -f debatelab-fake-openrouter`, so
any `npm test` on the VPS killed a gate or verify stack running in
another worktree.

The cleanup now removes the fake provider only when this run started
it, the same guard verify.sh uses. The test also stubs docker and keeps
mktemp output inside its temp root, so it fails if the cleanup ever
calls docker again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 18:21
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Oct 2, 2026 6:22pm UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 0269eb20-e288-4604-8af2-b9ac7d2ee5a2

📥 Commits

Reviewing files that changed from the base of the PR and between 918b58d and a94eb50.

📒 Files selected for processing (2)
  • .superset/db-gate.sh
  • src/test/scripts/db-gate.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

@Programcode
Programcode merged commit 4305c36 into main Oct 2, 2026
8 checks passed
@Programcode
Programcode deleted the fix/db-gate-test-docker branch October 2, 2026 18:44

This branch was successfully deployed

1 active deployment
Preview — a94eb507 Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants