Skip to content

feat(cli): integrate @cedarjs/pg for local Postgres in dev and test - #2283

Draft
simoncrypta wants to merge 19 commits into
cedarjs:mainfrom
simoncrypta:feat/cedar-pg-local-postgres
Draft

feat(cli): integrate @cedarjs/pg for local Postgres in dev and test#2283
simoncrypta wants to merge 19 commits into
cedarjs:mainfrom
simoncrypta:feat/cedar-pg-local-postgres

Conversation

@simoncrypta

@simoncrypta simoncrypta commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add yarn cedar setup cedar-pg and create-cedar-app --db cedar-pg to provision worktree-isolated local Postgres via @cedarjs/pg@alpha + autopg
  • Hook @cedarjs/pg into cedar dev and api test setups (Jest/Vitest) when CEDAR_PG=1
  • Document the flow in local Postgres setup docs

Test plan

  • yarn cedar setup cedar-pg installs @cedarjs/pg@alpha and configures Postgres/PrismaPg
  • With CEDAR_PG=1, yarn cedar dev ensures a worktree DB and injects DATABASE_URL
  • Api tests provision/dispose a test DB when CEDAR_PG=1
  • Explicit DATABASE_URL / TEST_DATABASE_URL escape hatch still skips ensure (unless CEDAR_PG_FORCE=1)

Add setup/create-app overlay and CLI/testing hooks so CEDAR_PG=1 ensures
per-worktree DBs, keeps them across cedar dev, and disposes after tests.
Ignore .cedar-pg/* in app templates, fixtures, and setup; point the local
test app at a sibling cedar-pg checkout with postgres + CEDAR_PG=1.
Delegate skip policy so stale cpg_* URLs always re-ensure instead of
being treated as an external DATABASE_URL.
Switch Cedar CLI/testing bridges to cedar-pg ensureIfNeeded, and only load .cedar-pg/test.env for Jest workers when provisioning actually ran.
@netlify

netlify Bot commented Aug 2, 2026

Copy link
Copy Markdown

👷 Deploy request for cedarjs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 0e2e6ef

@nx-cloud

nx-cloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 0e2e6ef

Command Status Duration Result
nx run-many -t build:pack --exclude create-ceda... ✅ Succeeded 2s View ↗
nx run-many -t build ✅ Succeeded <1s View ↗
nx run-many -t build --output-style=stream ✅ Succeeded 2m 39s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-05 16:02:58 UTC

Use the published @cedarjs/pg@alpha package instead of a local
cedar-pg file: dependency for setup, create-app, and local testing.
@simoncrypta simoncrypta changed the title Integrate cedar-pg for local Postgres setup in dev and test feat(cli): integrate @cedarjs/pg for local Postgres in dev and test Aug 2, 2026
@github-actions github-actions Bot added this to the next-release milestone Aug 2, 2026
Telemetry/update-check spawns were splitting paths that contain spaces
(e.g. CI's "test project"), producing MODULE_NOT_FOUND for a truncated
path. Also pipe Playwright webServer stderr for clearer smoke failures.
Comment thread packages/cli/src/lib/background.ts Fixed
Apply MSVC CommandLineToArgvW rules so backslashes before quotes are
escaped correctly when spawning background processes with shell: true.
@simoncrypta

Copy link
Copy Markdown
Contributor Author

Babysit status

Metadata is in good shape (feat(cli): … title, next-release milestone, changeset .changesets/2283.md). No unresolved review threads.

CI is green on the cedar-pg / fixture / CodeQL / main smoke paths. Remaining failures on the latest run look like known Windows flakes unrelated to this PR’s feature work:

  • CLI smoke (Windows)yarn add @cedarjs/cli-storybook-vite exited 3221226505 (STATUS_STACK_BUFFER_OVERRUN / Maglev)
  • React 18 smoke (Windows) — Storybook smoke leg

Fork PRs can’t gh run rerun --failed or add the windows label from this account. A maintainer re-run of failed jobs (or applying windows) should clear the status check if those legs pass.

Adopt @cedarjs/pg 0.2.0-alpha (acquireIfNeeded, .cedarpg, Jest test-env
setupFiles) so framework hosts match the published lifecycle and worker env
contract.
Extract prepareApiTestDatabase and cedarPgLifecycle so Jest/Vitest share one
acquire/dispose path, optionalize globalTeardown, and drop redundant
DATABASE_URL env spreads from cedar dev.
Fold main's provider/URL mismatch checks into prepareApiTestDatabase and
keep cedar-pg lifecycle exports alongside checkTestDatabase.
…g PR

Move background process shell quoting and smoke stderr piping to a separate
draft PR. Restore deploy-simplification proseWrap noise and fix .prettierignore
to use .cedarpg.
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