fix(db): guard duplicate directories migrations — drift self-heals instead of boot crash-loop - #272
Merged
aarontrowbridge merged 3 commits intoAug 31, 2026
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…270) A production database can carry the directories column without the journal row (observed on the erlich hub after a binary-lineage change), and the runner can then replay this migration at boot — the unguarded ADD COLUMN crash-looped the hub (exit ~1s, 29 systemd restarts). With the guard the migration no-ops on drift and the journal self-heals: the runner records the row either way.
… drifted DBs (#270) normal_stryfe (d088a74) re-adds session.directories, which PR #215's 20260820000001 already added. Databases bootstrapped by a #215-era binary have the column and the OLD journal row but not this one, so every binary carrying this migration exits ~1s at boot on them (crash-loop under Restart=always). Guard with a column-existence check; the journal row is recorded either way, reconciling the drift.
aarontrowbridge
force-pushed
the
fix/270-idempotent-directory-migrations
branch
from
August 31, 2026 00:04
1e85a3d to
b026040
Compare
6 tasks
…e skew The default branch's committed generated/types.ts is stale vs its own sources (a question-options default field never made it into the generated file), so the unit lane's check:generated step fails on ANY PR against it — observed on #272 where the only changes are two migration guards. Regenerated with the repo's own bun run generate; no source changes.
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.
Closes #270
Root cause (from a live hub incident, 2026-08-30)
normal_stryfe(d088a74) re-addssession.directories, which PR #215's20260820000001_add_session_directorieshad already added. Databases bootstrapped by a #215-era binary carry the column + the old journal row but not the new one — so every binary whose migration list includesnormal_stryfeexits ~1s into boot on such databases. UnderRestart=alwaysthat is a hub crash-loop. The erlich hub survived only because its running binary predates the duplicate; the next routine upgrade would have bricked it.Verified against a consistent snapshot of the production DB with an isolated
XDG_DATA_HOMEharness:normal_stryfependingduplicate column name: directoriesThe fix
Both
directoriesmigrations get a column-existence guard (PRAGMA table_info) before theirADD COLUMN; the runner records the journal row either way, so journal-vs-schema drift self-heals on next boot instead of crash-looping.