11---
2- status : in-progress
2+ status : done
33depends : [gitsheets-sync, gitsheets-scripts-2.9]
44specs :
55 - specs/behaviors/storage.md
@@ -72,21 +72,21 @@ follow-up), any behavior change to the webhook, boot or snapshot outputs.
7272
7373## Validation
7474
75- - [ ] ` gitsheets@^2.11.0 ` in ` apps/api/package.json ` ;
75+ - [x ] ` gitsheets@^2.11.0 ` in ` apps/api/package.json ` ;
7676 ` @gitsheets/core-napi-linux-x64-musl ` present in ` package-lock.json `
77- - [ ] Reconcile runs through the serving handle; no second ` openRepo ` and
77+ - [x ] Reconcile runs through the serving handle; no second ` openRepo ` and
7878 no surrounding ` withLock `
79- - [ ] ` internal-reload.test.ts ` "serializes a write issued during a hot
79+ - [x ] ` internal-reload.test.ts ` "serializes a write issued during a hot
8080 reload; neither change is lost" and "holds the write lock from the
8181 ref move through the rebuild" pass unchanged
82- - [ ] Outcome vocabulary, webhook response shape, conflict branch naming and
82+ - [x ] Outcome vocabulary, webhook response shape, conflict branch naming and
8383 boot behavior unchanged (existing tests)
84- - [ ] scrub-data writes the snapshot in one orphan transaction; snapshot
84+ - [x ] scrub-data writes the snapshot in one orphan transaction; snapshot
8585 tests (parentless commit, HEAD + tag, same-seed no-op, failure leaves
8686 no ref) pass
87- - [ ] Every remaining raw ` git ` call in ` apps/api/src ` and ` apps/api/scripts `
87+ - [x ] Every remaining raw ` git ` call in ` apps/api/src ` and ` apps/api/scripts `
8888 is listed in Notes with its reason
89- - [ ] ` type-check ` + ` lint ` + full test suite green
89+ - [x ] ` type-check ` + ` lint ` + full test suite green
9090
9191## Risks / unknowns
9292
@@ -98,4 +98,66 @@ follow-up), any behavior change to the webhook, boot or snapshot outputs.
9898
9999## Notes
100100
101+ - ** Why ` afterMove ` keeps the guarantee.** ` sync ` acquires the serving
102+ repository's write lock — the FIFO mutex every ` transact ` queues on —
103+ moves the ref, rebinds live sheets, and awaits ` afterMove ` before
104+ releasing it. The store refresh and the in-memory rebuild run in that
105+ hook, so a write queued during a reload acquires the lock only after the
106+ rebuild finished. That is the same critical section the old
107+ ` withLock ` around a side-handle sync gave, now on one handle. Both
108+ ` internal-reload.test.ts ` lock tests pass with no change to the file;
109+ the lock-holding test's mechanism (` publicRepo.withLock ` hold +
110+ ` onMoved ` ) never referenced the side handle.
111+ - ** A throw in ` afterMove ` ** propagates after the lock is released with the
112+ ref moved, same as a throw inside the old ` withLock ` . The webhook still
113+ 500s with "pod restart required".
114+ - ** Push hand-off.** ` sync ` notifies the repository's running push daemon
115+ of an ahead/replayed tip itself, so the plugin no longer passes ` push ` .
116+ Passing it as well would notify twice. ` reconcileDataRepo ` keeps the
117+ option for a repository without a daemon (the unit tests use it). At
118+ boot there's no daemon yet, and its startup backlog pushes, as before.
119+ - ** Fetch-failed** now reports the branch's commit (` refs/heads/<branch> ` )
120+ rather than ` HEAD ` 's; the app's HEAD always points at that branch.
121+ - ** reload.ts.** The incremental reload's config-change guard used raw
122+ ` git rev-parse <commit>:.gitsheets ` . It now compares
123+ ` repo.listTree(commit, '.gitsheets') ` listings (each entry carries its
124+ hash, so equal listings mean equal trees). That was the last raw git in
125+ ` apps/api/src ` .
126+ - ** scrub-data re-run.** An orphan ` transact ` still refuses an existing
127+ branch. A same-seed re-run commits detached, compares root ` listTree `
128+ listings with the branch (replacing ` rev-parse HEAD^{tree} ` ), and returns
129+ no commit when they match. When they differ it force-moves the branch
130+ with ` update-ref ` . New test covers the changed-content re-run. The
131+ commit date is now gitsheets' clock rather than the message timestamp
132+ fed through ` GIT_*_DATE ` ; the message still carries the timestamp.
133+ - ** check-sheet-configs** loses ` --depth=1 ` : ` repo.fetch ` has no depth
134+ option. The ` empty ` branch holds only ` .gitsheets/ ` , so the full fetch
135+ is small. Verified by hand against a local bare remote (match → exit 0,
136+ drift → exit 1, bad remote → throws).
137+ - ** Raw ` git ` left:**
138+ - ` apps/api/src ` : none.
139+ - ` scrub-data.ts `
140+ - ` rev-parse --git-dir ` , ` init ` , ` config ` : init the target. gitsheets
141+ has no init.
142+ - ` rev-parse --absolute-git-dir ` / ` --is-bare-repository ` : locate a
143+ non-bare target's git dir and detect a working tree.
144+ - ` update-ref ` : same-seed re-run with changed content. gitsheets can't
145+ repoint an existing branch at an unrelated commit.
146+ - ` symbolic-ref HEAD ` : the snapshot workflow pushes HEAD's branch, and
147+ gitsheets never moves HEAD.
148+ - ` reset --hard ` : sync a non-bare target's working tree. gitsheets is
149+ bare-style.
150+ - ` check-sheet-configs.ts ` : ` init --bare ` (no init API) and
151+ ` remote add ` (` repo.fetch ` takes a remote name, not a URL).
152+ - ` backfill-laddr-events.ts ` , ` backfill-meetup-hack-nights.ts ` : one
153+ create-only ` update-ref ` each. Unchanged; see Follow-ups.
154+
101155## Follow-ups
156+
157+ - Tracked as: the ` gitsheets-scripts-2.9 ` follow-up for the two
158+ ` backfill-* ` scripts (no-op-transact reads and create-only ` update-ref ` )
159+ stays open.
160+ - Tracked as: gitsheets gap. A way to point an existing branch at a given
161+ commit (or an orphan transact that may replace a branch) would retire
162+ scrub-data's last ` update-ref ` . A ` repo.init ` would retire the init
163+ plumbing in scrub-data and check-sheet-configs.
0 commit comments