Skip to content

A start refuses a volume that holds a prices database and no primary (spec 086) - #415

Merged
plainprogrammer merged 26 commits into
mainfrom
086-start-refuses-orphan-prices
Nov 13, 2026
Merged

plainprogrammer merged 26 commits into
mainfrom
086-start-refuses-orphan-prices

Conversation

@plainprogrammer

Copy link
Copy Markdown
Owner

Closes #375.

What

A server start (the image's default command, or any command that ends in ./bin/rails server) now refuses a volume that holds a prices database file, or one of its -wal, -shm or -journal files, and no primary database. It stops before db:prepare creates anything, exits 1, and its log says what it found, why it stops and what to do. A volume with neither file is a new instance, and one with a primary starts as before.

The state is what backup:restore leaves when it is killed between placing the prices file and the primary (spec 081 decision 8). Before this, a start there created a blank primary and kept the stale prices, which the new catalog's printing ids would then attach to the wrong printings.

  • bin/docker-entrypoint runs bin/rails start:check before db:prepare, in the same if.
  • Collector::StartCheck (lib/collector/start_check.rb) decides from file existence and size only, and opens no database. It reads the files' places through Collector::Backup::Databases, so a start and a restore look in the same places. lib/tasks/start.rake has no :environment prerequisite, and nothing in the boot path names the check.
  • A primary is "there" only if it exists following a symlink and isn't empty (spec decision 7).
  • The restore's refusal now says that a start refuses the volume too, instead of "never start Collector on it".
  • bin/backup-smoke gains a leg that restores a backup, removes the primary, and runs the image on that volume: it must exit 1 with the message and create no primary; then it removes the prices files and the start must be a blank instance.
  • Documents: README.md, docs/backup-restore.md, docs/releasing.md, the release and deploy and prices area docs, the roadmap and CLAUDE.md.

No Dockerfile, workflow or deploy file changed.

Maintainer's rulings (2026-11-13)

All three scope decisions as recommended: the check lives in the entrypoint, calling a task (not an initializer); the test is that a prices file or sidecar exists, not that it holds rows; development gets no check.

Evidence

  • Spec 086 v0.3.2, plan, verification.md (AC table, the image runs, the implementation review: SPEC-ALIGNED WITH FINDINGS, all fixed).
  • Targeted specs: spec/lib/collector/start_check_spec.rb and spec/start_check_spec.rb (the real entrypoint, a real SIGKILL of a restore between its placings, a production boot with no secret, the way out).
  • Image runs on colima (local builds): bin/backup-smoke collector:s086 OK including the new leg; with an image of origin/main as the restore image it fails at the new leg with spec 086 AC-4.1 ... (still running after 120 s).
  • Full bin/ci ran as the push's hook and passed; 4903 examples.

Known limit (accepted in the spec)

A one-off command that connects to the primary through the application on an orphan volume writes WAL mode's first page, so the next start finds a primary and passes. The message tells the operator to run nothing else on the volume meanwhile.

🤖 Generated with Claude Code

plainprogrammer and others added 25 commits November 13, 2026 12:25
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts:
#	docs/specs/README.md
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rimary (#375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…primary (#375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the roadmap (#375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…pec 086 (v0.3.2)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e message and the README (#375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
#375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…(spec 027 D4)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…375)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts:
#	docs/architecture/release-and-deploy.md
#	docs/specs/README.md
@plainprogrammer
plainprogrammer marked this pull request as ready for review November 13, 2026 21:42
@plainprogrammer plainprogrammer self-assigned this Nov 13, 2026
# Conflicts:
#	CLAUDE.md
#	docs/architecture/prices.md
#	docs/roadmap.md
#	docs/specs/README.md
@plainprogrammer
plainprogrammer merged commit 053224d into main Nov 13, 2026
9 checks passed
@plainprogrammer
plainprogrammer deleted the 086-start-refuses-orphan-prices branch November 13, 2026 22:26
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.

A start refuses a volume that holds a prices database and no primary

1 participant