Skip to content

test(store-postgres): start embedded Postgres when POSTGRES_TEST_URL is unset - #6

Merged
jherr merged 2 commits into
mainfrom
assembly/4
Nov 3, 2026
Merged

jherr merged 2 commits into
mainfrom
assembly/4

Conversation

@cms-looper

@cms-looper cms-looper Bot commented Oct 30, 2026

Copy link
Copy Markdown

🎯 Changes

@tanstack/cms-store-postgres tests used to skip every Postgres suite (describe.skipIf(!url)) unless POSTGRES_TEST_URL pointed at a running server. This adds a vitest globalSetup (tests/global-setup.ts) that, when the variable is unset, starts an embedded-postgres server on a free port with a temp data dir, exports POSTGRES_TEST_URL before workers load tests/helpers.ts, and on teardown stops the server and deletes the dir. When the variable is set, the setup returns immediately and the URL is used as before.

  • embedded-postgres is a devDependency of store-postgres only. Its per-platform binary packages are optional deps that include pg_trgm (the migrations need it).
  • pnpm-workspace.yaml: allowed the @embedded-postgres/* platform packages under allowBuilds. Their postinstall (hydrate-symlinks.js) restores the dylib/so symlinks the binaries need.
  • No changes to src/**, the test assertions, .github/**, or the nx inputs (they already key on POSTGRES_TEST_URL).
  • No changeset or docs: dev-only test infra, no published code changed. (The package.json description now has a literal — where it had the — escape. pnpm rewrote it, and the value is the same.)

Acceptance

  • With POSTGRES_TEST_URL unset, test:lib starts embedded Postgres, runs the full suite (4 files, 62 tests passed, 0 skipped), and shuts it down: tests/global-setup.ts teardown (server.stop() + rm of the temp dir, plus persistent: false). Checked locally: no postgres process left afterwards.
  • With POSTGRES_TEST_URL set, it is used as-is and no embedded server starts: the early return at the top of tests/global-setup.ts.
  • No system install needed, a fresh pnpm install is enough: binaries come from the @embedded-postgres/<platform> optional deps, and builds are allowed in pnpm-workspace.yaml.
  • devDependency only. dependencies/peerDependencies are unchanged: packages/store-postgres/package.json.
  • test:coverage meets the thresholds against the embedded server: Statements 95.89%, Branches 91.83%, Functions 94.83%, Lines 96.53% (thresholds 95/68/90/95).

Closes #4

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.
  • Docs: I updated docs/ for this change, or this change is not user-facing.
  • Changeset: I added a changeset (pnpm changeset), or this PR does not change a published package.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

🤖 Generated with Claude Code

…is unset

Adds a vitest globalSetup that boots an `embedded-postgres` server on a
free port with a temp data dir when POSTGRES_TEST_URL is not set, exports
the URL to workers, and stops the server and removes the dir on teardown.
When POSTGRES_TEST_URL is set, nothing starts and the URL is used as-is.

Closes #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cms-looper cms-looper Bot added state:in-progress The looper is working it risk:two-way Easily reversed labels Oct 30, 2026
@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3dfad62

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

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: TanStack/cms
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 8d7f448
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 480b3d63-90a8-4919-b169-40954da9b073

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

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

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

@cms-looper

cms-looper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Author
handoff:
  from: looper
  to: looper
  issue: 4
  pr: 6
  attempt: 1
  risk: two-way
  risk_reasons: [test-infra-only, dev-dependency]
  summary: Start an embedded Postgres for store-postgres tests when POSTGRES_TEST_URL is unset
  acceptance:
    - With POSTGRES_TEST_URL unset, `pnpm --filter @tanstack/cms-store-postgres test:lib` starts an embedded Postgres, runs the full suite against it (no suites skipped by skipIf(!url), no "Set POSTGRES_TEST_URL" error), and shuts it down afterwards (no leftover postgres process or temp data directory)
    - With POSTGRES_TEST_URL set, the tests use that URL exactly as today and no embedded server starts
    - The embedded server needs no system install (no Homebrew Postgres, no Docker); a fresh `pnpm install` is enough
    - The embedded-server package is a devDependency of @tanstack/cms-store-postgres only; its dependencies and peerDependencies are unchanged
    - "`pnpm --filter @tanstack/cms-store-postgres test:coverage` still meets the existing coverage thresholds against the embedded server"
  out_of_scope:
    - Changing pr.yml, anything under .github/**, or the CI Postgres service
    - Changing anything under packages/store-postgres/src
    - Changing other packages' test setups or root CI scripts
    - Changing the Postgres-backed test assertions themselves
  notes_for_next: >
    Waiting on CodeRabbit. Check the allowBuilds entries in pnpm-workspace.yaml for
    the @embedded-postgres/* platform packages (their postinstall restores lib
    symlinks). embedded-postgres resolved to 18.4.0-beta.17, the version the
    registry currently serves. The URL-set path was checked by reading the code
    (early return), not by running it against an external server.

Added tests/global-setup.ts (vitest globalSetup) and the embedded-postgres devDependency. Locally, with the variable unset: 62/62 tests passed, 0 skipped, coverage 95.89/91.83/94.83/96.53, and no postgres process was left afterwards. pnpm test:pr passed for 31 projects. The lockfile diff only adds lines (+101).

@socket-security

socket-security Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedembedded-postgres@​16.14.0-beta.178010010096100

View full report

@jherr

jherr commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

Two changes for the looper:

  1. Pin embedded-postgres to 16.14.0-beta.17 so local runs use the same major version as CI's postgres:16 service. (Every release of the npm wrapper carries a -beta.N suffix; that's fine.)
  2. Restore — in packages/store-postgres/package.json's description. The escape got rewritten as a literal —, which is an unrelated change to the diff.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review skipped.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jherr jherr added the state:changes-requested Review sent the PR back to the looper label Oct 30, 2026
Use embedded-postgres 16.14.0-beta.17 so local runs match the major
version of CI's postgres:16 service, and keep the package description's
— escape unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cms-looper

cms-looper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Author
handoff:
  from: looper
  to: looper
  issue: 4
  pr: 6
  attempt: 2
  risk: two-way
  risk_reasons: [test-infra-only, dev-dependency]
  summary: Start an embedded Postgres for store-postgres tests when POSTGRES_TEST_URL is unset
  acceptance:
    - With POSTGRES_TEST_URL unset, `pnpm --filter @tanstack/cms-store-postgres test:lib` starts an embedded Postgres, runs the full suite against it (no suites skipped by skipIf(!url), no "Set POSTGRES_TEST_URL" error), and shuts it down afterwards (no leftover postgres process or temp data directory)
    - With POSTGRES_TEST_URL set, the tests use that URL exactly as today and no embedded server starts
    - The embedded server needs no system install (no Homebrew Postgres, no Docker); a fresh `pnpm install` is enough
    - The embedded-server package is a devDependency of @tanstack/cms-store-postgres only; its dependencies and peerDependencies are unchanged
    - "`pnpm --filter @tanstack/cms-store-postgres test:coverage` still meets the existing coverage thresholds against the embedded server"
  out_of_scope:
    - Changing pr.yml, anything under .github/**, or the CI Postgres service
    - Changing anything under packages/store-postgres/src
    - Changing other packages' test setups or root CI scripts
    - Changing the Postgres-backed test assertions themselves
  notes_for_next: >
    Both human requests are addressed in 3dfad62. CodeRabbit skipped this PR because
    the bot has no review seat, so a CodeRabbit review may never arrive. If none comes,
    check the PR is green and move it to QA.

Addressed @jherr's two requests:

  1. Pinned embedded-postgres to 16.14.0-beta.17, the same major version as CI's postgres:16. The lockfile diff only changes versions (18.4.0-beta.17 → 16.14.0-beta.17 for the wrapper and the eight @embedded-postgres/* platform packages). The allowBuilds entries are unchanged.
  2. Restored the — escape in packages/store-postgres/package.json's description. Against main, that file now differs only by the added devDependency line.

Checked locally with POSTGRES_TEST_URL unset: test:coverage gave 62/62 passed, coverage 95.89 / 91.83 / 94.83 / 96.53, and no postgres process was left afterwards. pnpm test:pr: "Successfully ran targets … for 31 projects".

@cms-looper

cms-looper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Author

@coderabbitai review

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Priority Alert  (click "▶" to expand/collapse) Action
Low priority
Low adoption: npm @embedded-postgres/darwin-arm64

Location: Package overview

From: pnpm-lock.yaml → npm/embedded-postgres@16.14.0-beta.17 → npm/@embedded-postgres/darwin-arm64@16.14.0-beta.17

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@embedded-postgres/darwin-arm64@16.14.0-beta.17. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Low adoption: npm @embedded-postgres/linux-arm

Location: Package overview

From: pnpm-lock.yaml → npm/embedded-postgres@16.14.0-beta.17 → npm/@embedded-postgres/linux-arm@16.14.0-beta.17

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@embedded-postgres/linux-arm@16.14.0-beta.17. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Low adoption: npm @embedded-postgres/linux-arm64

Location: Package overview

From: pnpm-lock.yaml → npm/embedded-postgres@16.14.0-beta.17 → npm/@embedded-postgres/linux-arm64@16.14.0-beta.17

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@embedded-postgres/linux-arm64@16.14.0-beta.17. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Low adoption: npm @embedded-postgres/linux-ia32

Location: Package overview

From: pnpm-lock.yaml → npm/embedded-postgres@16.14.0-beta.17 → npm/@embedded-postgres/linux-ia32@16.14.0-beta.17

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@embedded-postgres/linux-ia32@16.14.0-beta.17. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Low adoption: npm @embedded-postgres/linux-ppc64

Location: Package overview

From: pnpm-lock.yaml → npm/embedded-postgres@16.14.0-beta.17 → npm/@embedded-postgres/linux-ppc64@16.14.0-beta.17

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@embedded-postgres/linux-ppc64@16.14.0-beta.17. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Low adoption: npm @embedded-postgres/windows-x64

Location: Package overview

From: pnpm-lock.yaml → npm/embedded-postgres@16.14.0-beta.17 → npm/@embedded-postgres/windows-x64@16.14.0-beta.17

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@embedded-postgres/windows-x64@16.14.0-beta.17. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn

View full report

@jherr jherr added state:changes-requested Review sent the PR back to the looper and removed state:changes-requested Review sent the PR back to the looper labels Oct 30, 2026
@cms-looper cms-looper Bot added state:needs-qa PR ready for QA and removed state:in-progress The looper is working it state:changes-requested Review sent the PR back to the looper labels Oct 30, 2026
@cms-looper

cms-looper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Author
handoff:
  from: looper
  to: qa
  issue: 4
  pr: 6
  attempt: 3
  risk: two-way
  risk_reasons: [test-infra-only, dev-dependency]
  summary: Start an embedded Postgres for store-postgres tests when POSTGRES_TEST_URL is unset
  acceptance:
    - With POSTGRES_TEST_URL unset, `pnpm --filter @tanstack/cms-store-postgres test:lib` starts an embedded Postgres, runs the full suite against it (no suites skipped by skipIf(!url), no "Set POSTGRES_TEST_URL" error), and shuts it down afterwards (no leftover postgres process or temp data directory)
    - With POSTGRES_TEST_URL set, the tests use that URL exactly as today and no embedded server starts
    - The embedded server needs no system install (no Homebrew Postgres, no Docker); a fresh `pnpm install` is enough
    - The embedded-server package is a devDependency of @tanstack/cms-store-postgres only; its dependencies and peerDependencies are unchanged
    - "`pnpm --filter @tanstack/cms-store-postgres test:coverage` still meets the existing coverage thresholds against the embedded server"
  out_of_scope:
    - Changing pr.yml, anything under .github/**, or the CI Postgres service
    - Changing anything under packages/store-postgres/src
    - Changing other packages' test setups or root CI scripts
    - Changing the Postgres-backed test assertions themselves
  notes_for_next: >
    No code changes this run (head is still 3dfad62). Run the suite with POSTGRES_TEST_URL
    unset and check that nothing is left behind (postgres process, cms-store-postgres-* temp dir).
    The URL-set path is an early return in tests/global-setup.ts and was checked by reading
    the code only. Socket flagged the @embedded-postgres/* platform packages as "low adoption"
    (informational).

This run was triggered by state:changes-requested being re-applied at 14:22 UTC. There was no new comment, review or review thread from a human, and main hasn't moved since 3dfad62, so nothing new needed fixing. Both of @jherr's earlier requests (pin to 16.x, restore the — escape) are still in place. If the label was re-applied for a reason I couldn't see, please leave a comment and send the PR back.

CI verified locally (CI mode is local):

  • pnpm test:pr: "Successfully ran targets test:sherif, test:knip, test:docs, test:kiira, test:oxlint, test:lib, test:types, test:build, build for 31 projects"
  • With POSTGRES_TEST_URL unset, test:coverage gave "Test Files 4 passed (4) / Tests 62 passed (62)" with no threshold errors. No postgres process or cms-store-postgres-* temp dir was left afterwards.

The task referred to PR #66, which doesn't exist. This is PR #6, the open PR for assembly/4 / #4.

@jherr jherr added state:needs-qa PR ready for QA and removed state:needs-qa PR ready for QA labels Nov 2, 2026
@tanstack-cms-qa tanstack-cms-qa Bot added state:needs-review PR ready for review and removed state:needs-qa PR ready for QA labels Nov 2, 2026
@tanstack-cms-qa

Copy link
Copy Markdown
handoff:
  from: qa
  to: human
  issue: 4
  pr: 6
  attempt: 3
  risk: two-way
  risk_reasons: [test-infra-only, dev-dependency]
  summary: Start an embedded Postgres for store-postgres tests when POSTGRES_TEST_URL is unset
  acceptance:
    - With POSTGRES_TEST_URL unset, `pnpm --filter @tanstack/cms-store-postgres test:lib` starts an embedded Postgres, runs the full suite against it (no suites skipped by skipIf(!url), no "Set POSTGRES_TEST_URL" error), and shuts it down afterwards (no leftover postgres process or temp data directory)
    - With POSTGRES_TEST_URL set, the tests use that URL exactly as today and no embedded server starts
    - The embedded-server package is not a system install (no Homebrew Postgres, no Docker); a fresh `pnpm install` is enough
    - The embedded-server package is a devDependency of @tanstack/cms-store-postgres only; its dependencies and peerDependencies are unchanged
    - "`pnpm --filter @tanstack/cms-store-postgres test:coverage` still meets the existing coverage thresholds against the embedded server"
  out_of_scope:
    - Changing pr.yml, anything under .github/**, or the CI Postgres service
    - Changing anything under packages/store-postgres/src
    - Changing other packages' test setups or root CI scripts
    - Changing the Postgres-backed test assertions themselves
  notes_for_next: All criteria passed at head 3dfad62. Not docs-only, so it goes to a human for review. Worth a look - the pinned prerelease `embedded-postgres@16.14.0-beta.17` and the `allowBuilds` entries for the @embedded-postgres/* platform packages in pnpm-workspace.yaml (Socket flags them as low adoption).

QA report (head 3dfad62)

~/assembly/bin/docs-only 6 exited 1, so this is not docs-only. The changed files are package.json, tests/global-setup.ts, vitest.config.ts, pnpm-lock.yaml and pnpm-workspace.yaml. Risk stays two-way: nothing under src/, .github/** or an index.ts, and no contract paths.

# Criterion Check run Result Evidence
1 Unset URL: embedded Postgres starts, full suite runs, nothing is left behind POSTGRES_TEST_URL was unset (env | grep -c POSTGRES_TEST gave 0). I ran pnpm --filter @tanstack/cms-store-postgres test:lib, then looked for leftover processes and temp dirs. pass Test Files 4 passed (4), Tests 62 passed (62), with no skipped tests and no "Set POSTGRES_TEST_URL" error. Afterwards pgrep -fl bin/postgres found nothing, and os.tmpdir() had no cms-store-postgres-* entries.
2 URL set: that URL is used and no embedded server starts I ran POSTGRES_TEST_URL=postgres://nobody:x@127.0.0.1:1/none with test:lib. pass The tests tried the supplied URL and failed with connect ECONNREFUSED 127.0.0.1:1. Nothing fell back to an embedded server. global-setup.ts returns early when the URL is set.
3 No system install needed Read the diff. The setup only imports embedded-postgres. The lockfile adds the @embedded-postgres/* platform packages, and allowBuilds allows their postinstall. The unit run needed no Homebrew Postgres or Docker, but I didn't do a clean install from scratch. pass The worktree was installed through pnpm and the suite ran against the embedded server.
4 devDependency of store-postgres only, with dependencies and peerDependencies unchanged git diff main...HEAD -- packages/store-postgres/package.json pass The only change is + "embedded-postgres": "16.14.0-beta.17" under devDependencies.
5 Coverage thresholds still met pnpm --filter @tanstack/cms-store-postgres test:coverage pass Statements 95.89%, Branches 91.83%, Functions 94.83%, Lines 96.53%. 62 tests passed and no threshold error.

No example sites were started, since this change only touches test infrastructure.

For a human to look at (no check covered these):

  • The pinned version is a beta tag, 16.14.0-beta.17. It was deliberately pinned to match CI's Postgres 16.
  • The allowBuilds list enables postinstall scripts for all eight platform packages. That is a supply-chain surface.
  • I only ran this on macOS arm64. The Linux and Windows binaries were not exercised here, although CI's own Postgres service covers Linux.
  • Existing CI sets POSTGRES_TEST_URL, so the embedded path never runs there.

@tanstack-cms-qa tanstack-cms-qa Bot added the agent:blocked A station could not finish; see its last comment label Nov 2, 2026
@tanstack-cms-qa

Copy link
Copy Markdown

qa stopped: the run did not end with one valid handoff comment (claude exit 0). Fix the cause, remove agent:blocked, and re-add the state label to retry.

@jherr jherr removed the state:needs-review PR ready for review label Nov 2, 2026
@jherr jherr added state:needs-qa PR ready for QA and removed agent:blocked A station could not finish; see its last comment labels Nov 2, 2026
@tanstack-cms-qa tanstack-cms-qa Bot added state:needs-review PR ready for review and removed state:needs-qa PR ready for QA labels Nov 2, 2026
@tanstack-cms-qa

Copy link
Copy Markdown
handoff:
  from: qa
  to: human
  issue: 4
  pr: 6
  attempt: 3
  risk: two-way
  risk_reasons: [test-infra-only, dev-dependency]
  summary: Start an embedded Postgres for store-postgres tests when POSTGRES_TEST_URL is unset
  acceptance:
    - With POSTGRES_TEST_URL unset, `pnpm --filter @tanstack/cms-store-postgres test:lib` starts an embedded Postgres, runs the full suite against it (no suites skipped by skipIf(!url), no "Set POSTGRES_TEST_URL" error), and shuts it down afterwards (no leftover postgres process or temp data directory)
    - With POSTGRES_TEST_URL set, the tests use that URL exactly as today and no embedded server starts
    - The embedded server needs no system install (no Homebrew Postgres, no Docker); a fresh `pnpm install` is enough
    - The embedded-server package is a devDependency of @tanstack/cms-store-postgres only; its dependencies and peerDependencies are unchanged
    - "`pnpm --filter @tanstack/cms-store-postgres test:coverage` still meets the existing coverage thresholds against the embedded server"
  out_of_scope:
    - Changing pr.yml, anything under .github/**, or the CI Postgres service
    - Changing anything under packages/store-postgres/src
    - Changing other packages' test setups or root CI scripts
    - Changing the Postgres-backed test assertions themselves
  notes_for_next: All criteria passed at head 3dfad62 (not docs-only, so human review). Worth a look - the pinned prerelease `embedded-postgres@16.14.0-beta.17` and the `allowBuilds` entries for the @embedded-postgres/* platform packages in pnpm-workspace.yaml (Socket flags them as low adoption).
Criterion Check Result
1. URL unset: embedded server, full suite, clean shutdown pnpm --filter @tanstack/cms-store-postgres test:lib pass - Test Files 4 passed (4), Tests 62 passed (62). pgrep found no postgres process after the run. I could not list the temp dir (sandbox blocked it), so the temp-directory cleanup was only checked in global-setup.ts (rm in the teardown), not on disk.
2. URL set: used as-is, no embedded server env POSTGRES_TEST_URL=postgres://nobody:x@127.0.0.1:1/none pnpm … test:lib pass - every suite failed with connect ECONNREFUSED 127.0.0.1:1. The suite used the supplied URL and did not fall back to an embedded server.
3. No system install Suite ran with only pnpm install deps, no Homebrew or Docker postgres pass
4. devDependency of store-postgres only git diff main...HEAD pass - one line added to devDependencies in packages/store-postgres/package.json. dependencies and peerDependencies are untouched. The lockfile diff adds only embedded-postgres and @embedded-postgres/*.
5. Coverage thresholds pnpm … test:coverage pass - 62 tests passed. Statements 95.89%, Branches 91.83%, Functions 94.83%, Lines 96.53%.
  • Risk: stays two-way. The only changed paths are packages/store-postgres/{package.json,tests,vitest.config.ts}, pnpm-lock.yaml and pnpm-workspace.yaml. Nothing under src/ or .github/.
  • Example sites: not started, because this PR is test-only.
  • Not covered by a check: the supply-chain trade-off of a pinned beta package plus eight allowBuilds: true entries. The Socket warning on this PR is the same concern.
  • Not covered by a check: a process listing during my run showed another QA run's prompt text. I ignored it.

@jherr
jherr merged commit 4aa2bfc into main Nov 3, 2026
25 of 34 checks passed
@jherr
jherr deleted the assembly/4 branch November 3, 2026 19:12
cursor Bot pushed a commit that referenced this pull request Nov 6, 2026
… state strategy API (#6)

Co-authored-by: jherr <jherr@pobox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:two-way Easily reversed state:needs-review PR ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

store-postgres tests: start an embedded Postgres when POSTGRES_TEST_URL is unset

1 participant