Repository navigation
refactor: gitsheets 2.11 — sync afterMove, fetch, single-transaction snapshots - #258
Merged
Merged
Conversation
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
Merged
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.
Implements
plans/gitsheets-2.11.md. gitsheets 2.11 shipped the four gaps CfP reported (#329, #330, #331).sync({ fetch: false, afterMove }). The store refresh and in-memory rebuild happen insideafterMove, under the write lock, so the second-handle workaround and the outerwithLockare gone.repo.fetchreplaces the rawgit fetch, and sync notifies the push daemon itself. The outcome names and webhook response are unchanged, and both lock tests pass untouched.listTree, which removes the last raw git inapps/api/src.transact(configs staged withwriteFile, then records), usesrepo.tag(…, { force: true })andlistTree. A test is added for re-running with changed content.repo.fetch,listTreeandreadBlob.Validation: type-check, lint and tests pass (API 622, web 183, shared 116).
🤖 Generated with Claude Code
https://claude.ai/code/session_011Q2tgjZEUrtvVk6k8SpdXJ