Repository navigation
The handoff delivery record is per-machine state and stops travelling (#285) - #287
Merged
Merged
Conversation
…elling (#285) remember.delivered sat inside the subtree the git backup stages, so it was committed and pushed. Its fingerprint is a cksum of the handoff CONTENT, so it matches on every machine that has that handoff — and machine B's first session with a note it had never seen was told it had already been delivered N times since machine A's clock. The record that exists to stop a stale handoff reading as fresh made a fresh one read as stale, in the direction that suppresses action. It also conflicted on every concurrent session start, unrepairably: union emits both key sets and yields a malformed record. The record moves to tmp/, with the locks and the cooldown markers. It now promises only that THIS clone has delivered THIS handoff N times since a local timestamp, and promises nothing about any other machine. The handoff itself still travels. Session start moves an existing record rather than resetting it, and the move is what retires the tracked copy: an ignore rule does nothing to a tracked file, and a `git rm --cached` whose path still exists in the working tree is undone by the next path-limited commit. A record arriving from a pull is discarded, never adopted. The backup hook also gains the exclusion it always assumed existed. Its own comment says "the root-level .gitignore covers logs/tmp exclusions"; the plugin never creates that file, so logs/ and tmp/ were being committed too. They are now maintained in the store's $GIT_DIR/info/exclude — per-clone, needing no user action, editing no tracked file, and unable to reach another machine. Co-Authored-By: Max <noreply>
fdaviddpt
added a commit
that referenced
this pull request
Aug 1, 2026
… and stop the pushing that was still happening (#288) (#289) * fix(git-backup): a store that already tracked logs/ actually stops pushing them (#288) #287's `git rm --cached` could never untrack them: it fails outright on a directory without `-r`, and even with `-r` the backup's `git commit -- "<slug>/"` is a partial commit that rebuilds those paths from the working tree. Measured on a store built by the pre-#287 hook, the upgraded hook still pushed a log line written after the upgrade — and tmp/ is where #287 moved the delivery record, so #285 was not fixed on those stores either. The untracking is now its own commit, of the index rather than of a pathspec, guarded on an otherwise-clean index and rolled back if it cannot finish. It rewrites no history: what is already pushed stays pushed, which is the user's call and is documented as theirs. Co-Authored-By: Max <noreply> * docs: disclose session logs already in a backup remote's history (#288) Untracking stops the pushing; it removes nothing from the commits that already carried the logs, and no later fix on this side can. README gains "Logs in a backup you made before this version": which versions staged logs/ unconditionally, a one-line check for your own store, and the git filter-repo purge with its price in the same breath — every commit ID changes, so every other clone diverges and must be replaced rather than pulled. How many stores this touches is not known and is not estimated. Co-Authored-By: Max <noreply>
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 #285
What was wrong
remember.deliveredwas written to<store>/<slug>/remember.delivered— inside the subtree50-git-backup.shstages — so it was committed and pushed like memory. All three claims in the report reproduce; I re-derived each rather than taking them:scripts/session-start-hook.sh:539(pre-fix) writesfingerprint/first_delivered/deliveriesbeside the handoff slot.git add -- "$SLUG/"with no exclusion, and there is no plugin-owned place to add one — see below._remember_handoff_fingerprint()iscksum < "$1", so it matches on every machine holding the same handoff. That is the mechanism: it is the one field that is globally meaningful, and it is the field that carries the harm.deliveriesis not the only cross-machine-wrong field.first_deliveredis one machine's wall clock anddeliveriesis one machine's session count — two of the three fields are per-clone by construction.fingerprintis the only shareable one, so there was never a shared value the record could have held.The result is the inversion the reporter names: the record exists so a stale handoff cannot read as fresh, and sharing it made a fresh handoff read as stale, in the direction that suppresses action.
The decision, and what the record now promises
The record is per-clone and moves to
tmp/, with the locks and the cooldown markers.remember.mdstill does — it is memory, and it is backed up exactly as before.Namespacing per host was considered and rejected. It would preserve a hedge, not data, and buys a naming scheme plus a garbage-collection question nothing in the store answers (what removes the record for a machine that no longer exists). The cost of not sharing is that a note read on your laptop arrives on your desktop as news — which is the trade #221 already made when it stopped emptying the slot on read. Over-delivery costs a re-read; under-delivery costs the work.
Where I depart from the issue's suggested fix
The suggestion was "exclude at staging (
:(exclude)), thengit rm --cached". Measured, that does not hold —git commit -- <pathspec>is a partial commit that takes its content from the working tree, not the index:addwith:(exclude)+commit -- "$SLUG/"→ the commit re-adds the file, undoing therm --cached.committoo → the staged deletion is never committed and lingers as a permanentDin the user's index..git/info/exclude+rm --cached→ an exclude rule has no effect on a tracked file; the nextaddre-stages it.The only clean migration is for the path to stop existing in the working tree. So session start moves an existing record to its new home — preserving this machine's history, which is still true about this machine — and the ordinary
add/committhen stages the deletion like any other file. A record arriving from someone else's push is discarded, never adopted.Migration is required, not optional. Left tracked, the file would stay permanently modified against a version nothing maintains: noise in the user's own
git status, and a name a latermerge --ff-onlycan refuse over. One rough edge, documented in the CHANGELOG: a machine that pulls the deletion before running the new version has local changes to a file the merge removes, so that one restore can refuse; the next session moves the file aside and it clears.Second fix, in the same seam
The reporter's structural observation is correct and is worth fixing on its own.
50-git-backup.sh:414-416deletes the per-slug.gitignorein external mode, commenting that "the root-level.gitignorecovers logs/tmp exclusions" — and the plugin never creates that file. I confirmed empirically: in a store built entirely by the plugin,logs/is committed and pushed. Thegit rm --cachedat :424 cannot help, becauseaddre-stages anything an ignore rule doesn't cover.The hook now maintains
/<slug>/logs/and/<slug>/tmp/in the store's$GIT_DIR/info/exclude. That location rather than a.gitignore, for the three conditions #261 chose the git common dir for: no user action, no edit by this hook to a tracked file inside the user's own backup repository, and nothing that can itself be committed and land on another machine. Per-clone — exactly the scope of what it excludes. This is what the delivery record's new home depends on, so it is the fix, not adjacent cleanup.Tests
tests/test_delivery_record_per_machine_285.py— one shared bare remote, two clones, one slug: the reported topology.test_first_delivery_on_second_machine_does_not_read_as_already_seen— the behaviour, not a proxy. Machine A delivers twice and backs up; machine B pulls and opens its first session; the handoff must arrive as news. The same test asserts a repeat delivery on machine A is still labelled, so the suite cannot be satisfied by deleting the feature.test_backup_does_not_carry_the_delivery_record— the mechanism, and assertsremember.mdis still tracked so it fails for the right reason.test_a_store_that_already_committed_the_record_is_cleaned_up— migration: the legacy tracked copy is removed and the store comes to rest with a cleangit status.test_path_resolution.py::test_handoff_delivered_and_recorded_at_session_startupdated for the new path, and now also asserts the record is not written where the backup would commit it.RED (before the fix, the reported symptom verbatim):
GREEN:
3 passed, and the full suite1270 passed, 43 skipped, coverage 94.16%.Docs
CHANGELOG.md— new### Fixedsection, both entries, including the rejected alternative and the migration rough edge.README.md— the data-files table (remember.deliveredrow removed;logs/+tmp/marked local and never backed up), the handoff section (a new paragraph stating outright what happens across two machines and why that direction was chosen), and the git-backup section (a "What is not backed up" paragraph — this is where people read what travels).