From 9a280b2e18ff2999be4f1d98b2739631df9ccdd3 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Wed, 15 Jul 2026 17:41:21 +0100 Subject: [PATCH] fix(state): the "rename it" tip led into the error it was fixing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verifying Bernardo's #107 upgrade path (legacy theme-state.json checkout → new code) turned up a footgun in state-read.nix's own help text. It said: • Still on theme-state.json? Rename it to state.json (…) On a git flake only tracked files exist, so a hand-rename leaves state.json untracked and therefore invisible — producing exactly the "state file is missing" error the tip hangs off. Point at the menu write (which stages the rename via git add --intent-to-add + git rm), name `git add state.json` for the manual path, and add a bullet for "file is on disk but eval says missing", which is otherwise a genuinely confusing dead end. Message verified by rendering the real failure, not by reading the source. The rename itself is safe and needs no code change: with identical content, theme-state.json and state.json produce byte-identical derivations (HM 2yqqy8h…, system 9qp9l3g…), so it cannot change what boots. Legacy eval, the migration write, and re-eval on a dirty/intent-to-add tree all pass. #133 filed: no check pins the compat shim, so it can rot before we drop it. --- agent/BACKLOG.md | 12 ++++++++++++ agent/JOURNAL.md | 23 +++++++++++++++++++++++ modules/state-read.nix | 10 +++++++--- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/agent/BACKLOG.md b/agent/BACKLOG.md index e86f09c..a3b6aa7 100644 --- a/agent/BACKLOG.md +++ b/agent/BACKLOG.md @@ -121,6 +121,18 @@ size, or truncation. Either fix the guest (fontconfig + icon cache in the test node) or document the gap in docs/TESTING.md §5 so the next agent does not chase it — right now nothing warns them. +### 133. No check pins the #107 legacy-name compat shim + +`lib.mkFlake`, doctor and lifecycle all still accept `theme-state.json`, and +`nomarchy-state-sync` migrates it on write — but nothing in `checks.*` +evaluates a checkout that has *only* the legacy name, so the shim can rot +silently while every check stays green. It is load-bearing until every +existing machine has taken one menu write. Add a cheap eval check: a fixture +dir with `theme-state.json` only → `mkFlake` resolves it; plus the write-side +migration (state.json created + git-staged, legacy `git rm`'d). Proven by +hand 2026-07-15 (drvPaths identical across the rename) — this just keeps it +proven. Delete together with the shim + the `nomarchy-theme-sync` alias. + ### 120. A netinstall ISO, next to the fat offline one Bernardo 2026-07-14, after seeing the measured size: **keep the current ISO diff --git a/agent/JOURNAL.md b/agent/JOURNAL.md index c8b3b52..58e262e 100644 --- a/agent/JOURNAL.md +++ b/agent/JOURNAL.md @@ -19,6 +19,29 @@ Template: --- +## 2026-07-15 — #107 upgrade path proven; state-read tip fixed +- **Task:** Bernardo feared rebuilding on the state.json rename ("what if it + doesn't boot"). Verify the real upgrade path from a legacy checkout. +- **Did:** Built a scratch downstream box shaped like his (~/.nomarchy: git + checkout, `theme-state.json`, input → local repo) and drove the whole path. + **The reassurance: the built derivations are byte-identical across the + rename** — HM `2yqqy8h…` and system `9qp9l3g…` from `theme-state.json` and + from `state.json` with identical content. The filename picks the read path + only; it cannot change the closure, so it cannot affect boot. Fixed the + footgun in `modules/state-read.nix`: the tip said "rename it to state.json", + which on a git flake yields an *untracked* (invisible) file and the very + "state file is missing" error the tip is attached to — now it points at the + menu write and names `git add state.json`. +- **Verified:** **V1 (strong)** — real eval of both `homeConfigurations` and + `nixosConfigurations` on the legacy name; migration write (content diff: + only the key I set, no drift); re-eval clean while dirty/intent-to-add via + both `.#` and `git+file://`; untracked-state failure is fail-closed at eval + with the new message (rendered, not assumed). No VM: identical drvPaths are + stronger evidence than booting the same closure twice. +- **Pending:** no permanent check asserts mkFlake accepts the legacy name — + the compat shim could rot silently before it's dropped. Filed #133. +- **Next suggestion:** #133, or #131 label call `[human]`. + ## 2026-07-15 — V2 the menu IA (#105/#111/#110), no code change - **Task:** close the V2 gap on 856a9d1 — it shipped at "V0 menu-back; HM gen builds" for a user-visible menu restructure. diff --git a/modules/state-read.nix b/modules/state-read.nix index 9462a0e..2b38850 100644 --- a/modules/state-read.nix +++ b/modules/state-read.nix @@ -28,8 +28,12 @@ let • Field-level schema (colors, ui, border, …): nomarchy-state-sync validate Eval-time field checks live in modules/home/theme.nix. - • Still on theme-state.json? Rename it to state.json (or just run - any menu write / `nomarchy-state-sync set` — it migrates).''; + • Still on theme-state.json? Easiest is any menu write / + `nomarchy-state-sync set` — it migrates and stages the rename + for you. Renaming by hand needs `git add state.json` too. + • File IS on disk but eval still says missing? On a git flake only + *tracked* files exist — an untracked state.json is invisible: + git add state.json''; missingMsg = '' @@ -37,7 +41,7 @@ let ${pathStr} This file is required (appearance + menu settings). Add state.json to - your flake checkout so evaluation stays pure. + your flake checkout — git-tracked — so evaluation stays pure. ${tip}''; emptyMsg = ''