Skip to content

fix(claude-memory-backup): make the no-op detectable - #17

Merged
natevick merged 2 commits into
mainfrom
norm/memory-backup-loud-noop
Aug 2, 2026
Merged

fix(claude-memory-backup): make the no-op detectable#17
natevick merged 2 commits into
mainfrom
norm/memory-backup-loud-noop

Conversation

@natevick

@natevick natevick commented Aug 2, 2026

Copy link
Copy Markdown
Owner

claude-memory-backup has been installed on norm's box since 2026-07-03 and has done nothing the entire time. ~/.dotfiles-work was never cloned there, so the repo check hit || exit 0 and returned success every day. 86 memory files, no backup, behind a backup job reporting nothing wrong — "no repo on this machine" and "backed up fine" produced byte-identical output: none.

No-opping without the private repo is correct and unchanged. Being undetectable about it is the bug.

Three of the four exit paths were silent failures. The fourth (nothing changed) is legitimate, but went unrecorded — so the status couldn't distinguish "ran, no diff" from "hasn't run in weeks".

Now: every path writes an outcome to ${XDG_STATE_HOME:-$HOME/.local/state}/claude-memory-backup.status, and the three that mean you have no backup also write stderr so launchd captures them. Success reports the file count.

$ cat ~/.local/state/claude-memory-backup.status
2026-08-02T15:08:09Z OK 2 files at 0ab8748

Verified against fixtures — all four paths

case stderr status file exit
no private repo ✅ loud SKIPPED no-clone:… - NOTHING WAS BACKED UP 0
happy path OK 2 files at 0ab8748 0
nothing changed — (correctly quiet) UNCHANGED 2 files mirrored, no diff 0
source missing ✅ loud SKIPPED no-source:… - NOTHING WAS BACKED UP 0

The working path still mirrors, commits and pushes — regression-checked against a real local remote, not just read.

sh -n clean. shellcheck unavailable on this box (no mise version pinned), so that's unverified.

Not fixed here

This makes the failure visible; it doesn't back anything up. Norm's 86 memory files still have no off-box copy until ~/.dotfiles-work is cloned on that machine — which is yours to decide, since it's a private repo and an agent box would be pushing to it.

🤖 Generated with Claude Code

Norm and others added 2 commits August 2, 2026 08:08
Installed on norm's box 2026-07-03 and did nothing for a month. `~/.dotfiles-work`
was never cloned there, so the repo check hit `|| exit 0` and returned success every
day. 86 memory files sat unbacked-up behind a backup job reporting nothing wrong —
"no repo on this machine" and "backed up fine" produced byte-identical output: none.

No-opping without the private repo is correct and unchanged. Being undetectable about
it is the bug. Three of the four exit paths were silent failures; the fourth (nothing
changed) is legitimate but went unrecorded, so the status could not distinguish
"ran, no diff" from "has not run in weeks".

Now every path writes an outcome to
${XDG_STATE_HOME:-$HOME/.local/state}/claude-memory-backup.status, and the three
meaning "you have no backup" also write stderr so launchd captures them. Success
reports the file count.

Verified all four paths against fixtures (no-repo / happy / unchanged / no-source):
loud where it should be, silent where it should be, exit 0 throughout, and the
working path still mirrors and pushes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CI caught this; I had shipped the file saying shellcheck was unverified, and it was.

`cd "$WORK" && git pull … || true` is pre-existing, but shellcheck is right that it is a
latent bug and not just style: in `A && B || C` the `|| true` swallows a failed `cd` as
well as a failed pull. With `set -eu` a bare `cd` aborts on failure, which is what we
want — mirroring into the wrong directory is worse than not mirroring. Only the pull is
allowed to fail (another machine may have pushed, or we may be offline).

Verified with the real shellcheck 0.11.0 binary this time. The mise *shim* refuses to run
inside this repo (mise.toml untrusted) and returns exit 1, which reads exactly like a
finding — invoked the binary directly instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@natevick
natevick merged commit c18c28e into main Aug 2, 2026
3 checks passed
@natevick
natevick deleted the norm/memory-backup-loud-noop branch August 2, 2026 15:21
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.

1 participant