Skip to content

refactor: gitsheets 2.11 — sync afterMove, fetch, single-transaction snapshots - #258

Merged
themightychris merged 9 commits into
developfrom
chore/gitsheets-2.11
Oct 16, 2026
Merged

themightychris merged 9 commits into
developfrom
chore/gitsheets-2.11

Conversation

@themightychris

Copy link
Copy Markdown
Member

Implements plans/gitsheets-2.11.md. gitsheets 2.11 shipped the four gaps CfP reported (#329, #330, #331).

  • Reconcile: runs on the serving repo via sync({ fetch: false, afterMove }). The store refresh and in-memory rebuild happen inside afterMove, under the write lock, so the second-handle workaround and the outer withLock are gone. repo.fetch replaces the raw git fetch, and sync notifies the push daemon itself. The outcome names and webhook response are unchanged, and both lock tests pass untouched.
  • Hot reload: its config-change check uses listTree, which removes the last raw git in apps/api/src.
  • scrub-data: builds one orphan transact (configs staged with writeFile, then records), uses repo.tag(…, { force: true }) and listTree. A test is added for re-running with changed content.
  • check-sheet-configs: reads upstream through repo.fetch, listTree and readBlob.

Validation: type-check, lint and tests pass (API 622, web 183, shared 116).

🤖 Generated with Claude Code

https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ

themightychris and others added 9 commits October 15, 2026 19:48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
npm install gitsheets@^2.11.0 -w apps/api

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
gitsheets 2.11 lets repo.sync() await a caller hook under its own write
lock, so the reload's critical section is no longer a withLock around a
sync on a side handle. Same guarantee, new mechanism.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
gitsheets 2.11's repo.sync() awaits an afterMove hook under its write
lock, after the ref moved and live sheets were rebound. The store
refresh and hot-reload rebuild now run there, on the serving
Repository, so the second openRepo handle and the withLock wrapped
around it are gone. No transact can commit between the ref move and
the end of the rebuild, as before.

The raw git fetch becomes repo.fetch() (failure is a value), paired
with sync({ fetch: false }). sync notifies the repository's running
push daemon itself, so the plugin no longer passes a push hand-off;
the option stays for repositories without a daemon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
The incremental-reload guard compared `.gitsheets` tree hashes with a
raw git rev-parse. gitsheets 2.11's listTree returns each entry's hash,
so equal listings mean equal trees; that was the last raw git call in
apps/api/src.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
gitsheets 2.11's tx.sheet() reads configs from the transaction's own
tree, so the .gitsheets/ files staged with tx.writeFile now apply to
the record upserts in the same transaction. The config-root commit,
the staging transaction and the commit-tree + update-ref re-commit
collapse into one transact({ parent: null, branch }); count parity and
PII verification run inside the handler so a failure commits nothing.

A same-seed re-run (branch exists, which an orphan transact refuses)
commits detached, compares root listings, and only then force-moves the
branch with update-ref. The tag goes through repo.tag({ force }) and
config listing through repo.listTree. Adds a test for the changed-
content re-run path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
repo.fetch, listTree and readBlob replace the raw fetch, ls-tree and
show against the throwaway clone. Raw git keeps init --bare and a
remote add, since repo.fetch takes a remote name, not a URL. The fetch
is no longer shallow; the empty branch holds only configs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ
@themightychris
themightychris merged commit 10c9778 into develop Oct 16, 2026
1 check passed
@themightychris
themightychris deleted the chore/gitsheets-2.11 branch October 16, 2026 00:12
@themightychris themightychris mentioned this pull request Oct 16, 2026
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