Repository navigation
test(store-postgres): start embedded Postgres when POSTGRES_TEST_URL is unset - #6
Conversation
…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>
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@coderabbitai review Two changes for the looper:
|
|
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>
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:
Checked locally with |
|
@coderabbitai review |
|
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.
|
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 CI verified locally (CI mode is local):
The task referred to PR #66, which doesn't exist. This is PR #6, the open PR for |
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)
No example sites were started, since this change only touches test infrastructure. For a human to look at (no check covered these):
|
|
qa stopped: the run did not end with one valid handoff comment (claude exit 0). Fix the cause, remove |
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).
|
… state strategy API (#6) Co-authored-by: jherr <jherr@pobox.com>
🎯 Changes
@tanstack/cms-store-postgrestests used to skip every Postgres suite (describe.skipIf(!url)) unlessPOSTGRES_TEST_URLpointed at a running server. This adds a vitestglobalSetup(tests/global-setup.ts) that, when the variable is unset, starts anembedded-postgresserver on a free port with a temp data dir, exportsPOSTGRES_TEST_URLbefore workers loadtests/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-postgresis a devDependency of store-postgres only. Its per-platform binary packages are optional deps that includepg_trgm(the migrations need it).pnpm-workspace.yaml: allowed the@embedded-postgres/*platform packages underallowBuilds. Their postinstall (hydrate-symlinks.js) restores the dylib/so symlinks the binaries need.src/**, the test assertions,.github/**, or the nx inputs (they already key onPOSTGRES_TEST_URL).descriptionnow has a literal—where it had the—escape. pnpm rewrote it, and the value is the same.)Acceptance
POSTGRES_TEST_URLunset,test:libstarts embedded Postgres, runs the full suite (4 files, 62 tests passed, 0 skipped), and shuts it down:tests/global-setup.tsteardown (server.stop()+rmof the temp dir, pluspersistent: false). Checked locally: nopostgresprocess left afterwards.POSTGRES_TEST_URLset, it is used as-is and no embedded server starts: the earlyreturnat the top oftests/global-setup.ts.pnpm installis enough: binaries come from the@embedded-postgres/<platform>optional deps, and builds are allowed inpnpm-workspace.yaml.dependencies/peerDependenciesare unchanged:packages/store-postgres/package.json.test:coveragemeets 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
pnpm run test:pr, or these tests do not apply to this pull request.docs/for this change, or this change is not user-facing.pnpm changeset), or this PR does not change a published package.🚀 Release Impact
🤖 Generated with Claude Code