From c6bceaef37c2ed3fdd59434115272eee5615a1fb Mon Sep 17 00:00:00 2001 From: rays Date: Sat, 12 Sep 2026 01:59:05 +0000 Subject: [PATCH] Docs: a slow migration and a CLI run at the same time Every ipx command migrates when it opens the database, so the healthcheck collided with the daemon while it dropped the old entries columns. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TAC7sLVqfKmY6rsTLXzNgk --- CLAUDE.md | 4 ++++ docs/history.md | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1be1ebd..b96138e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -115,6 +115,10 @@ Non-trivial logic leaves one runnable check behind. Pure functions (`merge_polic fighting over the database, with the stale one still holding the port. * `/api/settings` answering `200` does **not** mean the worker is alive — it is a different task. Probe the control socket (`ipx status`) to check that. +* **Every `ipx` command runs `migrate()` when it opens the database**, the healthcheck's + `ipx status` included. A migration that rewrites a big table (`DROP COLUMN`) takes seconds on + production, and a command run meanwhile fails with `migrating schema`. It changes nothing; wait + for `daemon started` in the log. Copy `state.db` aside before deploying one. ## House style diff --git a/docs/history.md b/docs/history.md index 33b0279..5fd8c98 100644 --- a/docs/history.md +++ b/docs/history.md @@ -23,7 +23,11 @@ A whole-repo audit for over-engineering listed twelve things to cut, and all of accounts. The adoption's copy was their last reader, but `record_entry` still wrote them, and still reset `read` when a title changed, which nothing looked at. Two bugs came from queries reading them. `migrate()` now drops them from an existing database (SQLite has had `DROP COLUMN` - since 3.35), and a test builds an old table to prove it. + since 3.35), and a test builds an old table to prove it. On production each drop rewrote the + 66 MB `entries` table, about four seconds apiece, so the first start took thirteen. An + `ipx status` run in that window failed with `migrating schema`: every `ipx` command migrates when + it opens the database, and it collided with the daemon doing the same. A failed `ALTER TABLE` + changes nothing, and the database had been copied to `backup/` first anyway. - **`interval_mins`**, which `schedule` replaced. An old config that still has the key loads; the key is ignored, and the config test carries it to keep that true. - **Three dependencies.** `infer` was only asked whether a file is a torrent, and the check after