Skip to content

ci: run the @cipherstash/migrate database suites in CI - #1295

Merged
tobyhede merged 1 commit into
mainfrom
claude/project-thread-0gkq38
Oct 23, 2026
Merged

tobyhede merged 1 commit into
mainfrom
claude/project-thread-0gkq38

Conversation

@tobyhede

@tobyhede tobyhede commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Toby · project thread

Summary

Before: the @cipherstash/migrate database tests (the package behind stash encrypt backfill and stash decrypt backfill) skipped themselves in CI, because no workflow set PG_TEST_URL. A broken resume, --force or concurrent-write guard could merge on green CI.

After: they run on every PR, in the existing Run Tests job, against its Postgres 16 and 17 containers. A guard test fails if they are switched off again.

Changes

  • tests.yml: a step creates a migrate_test database on the job's Postgres service, and Run tests sets PG_TEST_URL to it. It is a separate database because each migrate suite starts with DROP SCHEMA cipherstash CASCADE, and turbo runs packages in parallel, so in the shared database that drop would race the CLI's live suites.
  • turbo.json: the test task passes PG_TEST_URL through (turbo withholds unlisted variables).
  • scripts/__tests__/cli-live-postgres-ci.test.mjs: fails if PG_TEST_URL, its separate database, or the step that creates that database goes missing.

Verification

  • pnpm run test:scripts: 79 files, 1417 tests pass (1416 before, plus the new guard).
  • Locally against Postgres 16 with PG_TEST_URL set, @cipherstash/migrate runs 132 tests and all pass (the suites use a stub decryption client, so they need no CipherStash credentials and no EQL install).
  • The CI run on this PR is the first real check of the psql step on the runner.

Related

Closes #1294. Follow-up to #1193, whose reverse-backfill suite (decrypt.integration.test.ts) these settings will also pick up once it merges.


Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Added CI coverage to verify that migration tests use a separate PostgreSQL database.
    • Added checks confirming the migration database is created before tests run and remains distinct from the CLI test database.
  • Chores
    • Updated test configuration to pass the migration database connection through the test pipeline.

The migrate integration suites (forward and reverse backfill: resume,
the force obligation, the concurrent dual-write guard) skip unless
PG_TEST_URL is set, and nothing set it, so they ran nowhere and a
skipped suite read as a passing one. The run-tests job now creates a
separate migrate_test database on its existing Postgres service and
passes PG_TEST_URL through turbo. A separate database because each
suite drops the cipherstash schema, which would race the CLI live
suites running in parallel in the shared one. A guard test fails if the
variable, its database or the step that creates it goes missing.

Refs #1294

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018TacM4u97tr5yPAFynxYXW
@changeset-bot

changeset-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a6891cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tobyhede tobyhede self-assigned this Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 24c1b563-04e4-40b4-ba46-45b53062fb91
📥 Commits

Reviewing files that changed from the base of the PR and between 6e9f1ee and a6891cc.

📒 Files selected for processing: 3
  • .github/workflows/tests.yml
  • scripts/__tests__/cli-live-postgres-ci.test.mjs
  • turbo.json

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

The test workflow now provisions a separate PostgreSQL database for migrate integration tests and passes its URL through Turbo. A CI contract test checks the database configuration and setup order.

Changes: Migrate integration test CI

Layer / File(s) Summary
Configure and verify the migrate test database
.github/workflows/tests.yml, turbo.json, scripts/__tests__/cli-live-postgres-ci.test.mjs
Turbo tracks PG_TEST_URL for the test task. The workflow creates the migrate_test database and supplies its URL to tests while retaining STASH_TEST_DATABASE_URL. The contract test checks that the URL is configured, uses a distinct database, and is created before tests run.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Medium

Suggested reviewers: auxesis

Merge Risk: ⚪ Minimal · up to a6891

The migrate suites are configured to use their separate database in both Postgres test jobs. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: running the @cipherstash/migrate database suites in CI.
Linked Issues check Passed The changes satisfy issue #1294. The existing run-tests job uses Postgres 16 and 17 services. It creates migrate_test before Run tests. The Run tests step sets PG_TEST_URL to that database. …
Out of Scope Changes check Passed The changes are limited to the workflow database setup, Turbo environment forwarding, and a CI contract test. Each change supports issue #1294. No unrelated implementation change is shown.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Full details: Linked Issues check

Explanation

The changes satisfy issue #1294. The existing run-tests job uses Postgres 16 and 17 services. It creates migrate_test before Run tests. The Run tests step sets PG_TEST_URL to that database. turbo.json passes PG_TEST_URL through the test task. The contract test checks the variable, separate database, and creation step. Issue #1193 is a follow-up and does not add a requirement for this pull request.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (2 skipped: 2 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@tobyhede
tobyhede marked this pull request as ready for review October 22, 2026 00:20
@tobyhede
tobyhede requested a review from a team as a code owner October 22, 2026 00:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T00:22:23.882613Z a6891cc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cipherstash-agent cipherstash-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review attestation — source: Claude Code /code-review medium plus cross-check-review-findings (company-skills), against head a6891cc.

Result: no critical, blocking, or other findings.

Checked:

  • PG_TEST_URL is read only by the three @cipherstash/migrate integration suites, so no other package starts running.
  • migrate_test is created before Run tests, and the CI image's cipherstash user owns the container, so CREATE DATABASE is permitted.
  • The suites' DROP SCHEMA cipherstash CASCADE stays off the CLI's live database.
  • The migrate vitest config sets fileParallelism: false, so the three suites do not race each other on that schema.
  • turbo.json passes the variable through, and the new guard test covers the URL, the separate database, and the create step's order.
  • No changeset is needed for a CI-only change, and no skills are affected.

Existing review feedback holds no findings (changeset-bot and bot status only), so nothing was deduplicated.


Generated by Claude Code

@tobyhede
tobyhede merged commit 8b097ef into main Oct 23, 2026
32 checks passed
@tobyhede
tobyhede deleted the claude/project-thread-0gkq38 branch October 23, 2026 00:35
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.

@cipherstash/migrate database tests never run in CI: no workflow sets PG_TEST_URL

4 participants