Skip to content

chore: backport process-compose follow-up fixes from cala#143

Merged
Lakshyyaa merged 2 commits into
mainfrom
chore/backport-process-compose-fixes-from-cala
Jun 7, 2026
Merged

chore: backport process-compose follow-up fixes from cala#143
Lakshyyaa merged 2 commits into
mainfrom
chore/backport-process-compose-fixes-from-cala

Conversation

@Lakshyyaa

@Lakshyyaa Lakshyyaa commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

What

cala#729 ported the nix process-compose dev-deps setup from es-entity #140. During its review, two follow-up bugs were found and fixed in cala that originate in the shared pattern but were never backported here. This PR brings es-entity to parity.

Fixes

1. flake.nix — always derive DATABASE_URL from PGPORT

es-entity-dev-env derives a per-worktree PGPORT from a CRC32 of the checkout path, but built DATABASE_URL via ${DATABASE_URL:-...} — honoring any pre-set value. That made the URL an independent input that could disagree with the hash-derived port: a stale DATABASE_URL (e.g. a :5432 export from direnv dotenv) keeps the old port while Postgres binds PGPORT, so clients/migrations hit the wrong port → drift.

Drop the :- guard so the URL is always derived from PGPORT. Port = single source of truth, URL = output. PGPORT itself stays overridable. (cala 4041bb2)

2. Makefileset -e in start-deps

Without set -e, a failed nix-deps-base up -D (PC port busy, bad config) falls through to the readiness loop and only errors after the full 5-minute timeout. set -e aborts immediately, matching nextest-runner which already wraps its deps-up flow in set -e. The readiness loop is unaffected: is-ready runs in an if-condition and process list || true is guarded. (cala 496fd1b)

Notes / not included

  • cala's other commits were cala-specific (es-entity version bump, docker-file removal, examples/rust/cala-ledger doctest → PG_CON) or already present here (per-worktree dynamic port, kill -0 liveness guard, bounded readiness wait, book examples already read PG_CON).
  • cala dropped SQLX_OFFLINE=true from its test runner to validate queries online — es-entity's nextest-runner never set it, so no change needed.
  • cala removed a dead test-in-ci Make target because its helpers .unwrap() PG_CON without starting deps. es-entity's test-in-ci has start-deps as a prereq so it isn't broken; left in place (CI uses nix run .#nextest, so it is unused — worth a separate cleanup if desired).

🤖 Generated with Claude Code


Note

Low Risk
Local/CI dev tooling and documentation only; no application runtime, auth, or persistence logic changes.

Overview
Backports two dev-deps fixes from the shared process-compose pattern: DATABASE_URL is always computed from the hash-derived PGPORT in es-entity-dev-env (no longer honoring a pre-set DATABASE_URL), so a stale env export cannot point clients at the wrong port while Postgres listens on PGPORT.

make start-deps now runs under set -e, so a failed nix-deps-base up -D fails immediately instead of waiting through the full readiness timeout.

Docs clarify SQLX_OFFLINE: offline .sqlx/ validation in nix flake check vs live DB for nix run .#nextest. The unused test-in-ci Make target is removed from .PHONY and the Makefile (CI uses nix run .#nextest).

Reviewed by Cursor Bugbot for commit 349a706. Bugbot is set up for automated code reviews on this repo. Configure here.

Lakshyyaa and others added 2 commits June 4, 2026 18:04
Two fixes discovered during review of GaloyMoney/cala#729 (which followed
the process-compose pattern from #140) that never made it back here.

flake.nix: always derive DATABASE_URL from PGPORT instead of honoring a
pre-set DATABASE_URL via ${DATABASE_URL:-...}. The override made the URL
an independent input that could disagree with the hash-derived PGPORT
(e.g. a stale :5432 export from direnv) — Postgres binds PGPORT while
clients read the stale port. Port = single source of truth, URL = output.
(cala 4041bb2)

Makefile: add set -e to start-deps. Without it a failed
`nix-deps-base up -D` (PC port busy, bad config) falls through to the
readiness loop and only errs after the full 5-minute timeout. set -e
aborts immediately, matching the nextest-runner which already wraps the
deps-up flow in set -e. The readiness loop is unaffected: is-ready runs
in an if-condition and `process list || true` is guarded. (cala 496fd1b)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
test-in-ci has been unreferenced since #90 switched CI to
`nix run .#nextest`. Its body had also drifted from the canonical
nextest-runner (no cargo doc / mdbook build), making it a stale
duplicate. cala dropped its equivalent in #729.

Also clarify the SQLX_OFFLINE note in CLAUDE.md: it applies to the
`nix flake check` derivations (no DB); `nix run .#nextest` leaves it
unset and validates query! macros against the live process-compose
Postgres.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Lakshyyaa Lakshyyaa marked this pull request as ready for review June 4, 2026 13:48
@Lakshyyaa Lakshyyaa requested a review from vindard June 5, 2026 11:57
@Lakshyyaa Lakshyyaa merged commit 1894318 into main Jun 7, 2026
7 checks passed
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