chore: backport process-compose follow-up fixes from cala#143
Merged
Conversation
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>
vindard
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 deriveDATABASE_URLfromPGPORTes-entity-dev-envderives a per-worktreePGPORTfrom a CRC32 of the checkout path, but builtDATABASE_URLvia${DATABASE_URL:-...}— honoring any pre-set value. That made the URL an independent input that could disagree with the hash-derived port: a staleDATABASE_URL(e.g. a:5432export from direnvdotenv) keeps the old port while Postgres bindsPGPORT, so clients/migrations hit the wrong port → drift.Drop the
:-guard so the URL is always derived fromPGPORT. Port = single source of truth, URL = output.PGPORTitself stays overridable. (cala4041bb2)2.
Makefile—set -einstart-depsWithout
set -e, a failednix-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 -eaborts immediately, matchingnextest-runnerwhich already wraps its deps-up flow inset -e. The readiness loop is unaffected:is-readyruns in anif-condition andprocess list || trueis guarded. (cala496fd1b)Notes / not included
examples/rust/cala-ledgerdoctest →PG_CON) or already present here (per-worktree dynamic port,kill -0liveness guard, bounded readiness wait, book examples already readPG_CON).SQLX_OFFLINE=truefrom its test runner to validate queries online — es-entity'snextest-runnernever set it, so no change needed.test-in-ciMake target because its helpers.unwrap()PG_CONwithout starting deps. es-entity'stest-in-cihasstart-depsas a prereq so it isn't broken; left in place (CI usesnix 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_URLis always computed from the hash-derivedPGPORTines-entity-dev-env(no longer honoring a pre-setDATABASE_URL), so a stale env export cannot point clients at the wrong port while Postgres listens onPGPORT.make start-depsnow runs underset -e, so a failednix-deps-base up -Dfails immediately instead of waiting through the full readiness timeout.Docs clarify
SQLX_OFFLINE: offline.sqlx/validation innix flake checkvs live DB fornix run .#nextest. The unusedtest-in-ciMake target is removed from.PHONYand the Makefile (CI usesnix run .#nextest).Reviewed by Cursor Bugbot for commit 349a706. Bugbot is set up for automated code reviews on this repo. Configure here.