gabriel / muse public
fix main #24 / 100

fix: three staging bugs found in post-launch sweep

Bug 1 — .museignore not respected by muse code add _walk_tree never loaded ignore patterns, so muse code add . would stage files matched by .museignore. Those files then appeared in the committed snapshot because snapshot() in staged mode skips the ignore walk entirely. Fix: filter collected paths through resolve_patterns / is_ignored in run_add before staging. Staged deletions of previously- tracked files are always permitted regardless of ignore rules.

Bug 2 — muse code add -A did not stage deletions -A is documented as staging all changes including deletions, but the code path was identical to no-args: _walk_tree returns only files that exist on disk. Tracked files deleted from the working tree were silently omitted, making -A behave like . for this case. Fix: when all_files=True, also walk head_manifest for paths absent from disk and append them so they receive mode "D" in run_add. No-args path is now its own separate branch (new + modified only, no deletions — matches git add . semantics).

Bug 3 — write_stage wrote stage.json non-atomically path.write_text() is not crash-safe. A kill mid-write left a truncated or empty stage.json; read_stage returns {} silently in that case, losing all staged entries with no error. Fix: use mkstemp + replace (temp file then rename) matching the pattern already used by stat_cache.py and the object store.

Regression tests added for all three bugs (56 total, all green).

G Gabriel Cardona <gabriel@tellurstori.com> · 1d ago Mar 22, 2026 · 418c9a69 · parent 5b27712b
3
files changed
410
files in snapshot
Files Changed 410 in snapshot
~3

0 comments

No comments yet. Be the first to start the discussion.