feat: git object identity + repo state model with IndexedDB storage - #107
Draft
mitschabaude wants to merge 4 commits into
Draft
mitschabaude wants to merge 4 commits into
mitschabaude wants to merge 4 commits into
Conversation
…torage - src/git/: pure functions for blob/tree/commit SHA computation, byte-for-byte compatible with real Git. 38 oracle tests against git CLI. - src/storage/repo-types.ts: TypeScript types for the full repo state model (three-snapshot model, flat path maps, merge state, refs). - src/storage/repo-db.ts: IndexedDB persistence layer with clean async API. 29 tests covering roundtrip, multi-repo isolation, file ops. - docs/vibenote-git-sync-design.md: design doc for the git sync rebuild. Tasks: git-object-identity (done), repo-state-storage (done)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- src/sync/sync-engine.ts: New sync engine implementing the design from vibenote-git-sync-design.md. Operates on RepoState types with a clean GitHubRemote adapter interface. - Sync flow: fetch remote → diff against BASE → three-way merge → commit → push → retry - Merge policies: markdown (custom 3-way via Yjs), binary (theirs wins), other text (remote wins as fallback) - Handles all cases: no-op, local-only push, remote-only pull, both-changed merge, race condition retry (max 3) - 19 tests covering all sync scenarios with in-memory mock GitHub remote Task: sync-engine (done)
- src/sync/github-adapter.ts: Implements GitHubRemote interface against GitHub REST API. Clean adapter bridging sync engine to real backend. - src/data/repo-state-store.ts: Reactive in-memory store wrapping RepoState. Provides file operations (create, rename, move, delete, save) with React subscription model. V2 replacement for localStorage-based LocalStore. - 21 tests for RepoStateStore (file ops, folders, subscriptions, state mgmt) - All modules type-check cleanly, full test suite passes (279 tests) Tasks: wire-app-data-v2 (done)
- src/data/storage-pruning.ts: Policy module that evicts locally-cached files that are fully synced with the remote and haven't been accessed recently. - Supports maxFiles, maxBytes, minAgeMs, and pinnedPaths constraints. - Only evicts files whose blob SHA matches the BASE snapshot (safe to re-fetch). - Evicts oldest files first. - 11 tests covering all pruning scenarios. - Full suite: 290 tests pass, type check clean. Task: storage-pruning (done)
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.
What
Foundation for the data layer V2 rebuild. Two independent pieces built in parallel:
Git object identity library (
src/git/)Pure functions for blob/tree/commit SHA computation, byte-for-byte compatible with real Git. Includes flat-path-map → nested tree reconstruction. 38 tests oracle-verified against
gitCLI.Repo state model + IndexedDB storage (
src/storage/repo-*.ts)TypeScript types for the full repo state model (three-snapshot model: BASE/REMOTE/LOCAL, flat path maps, merge state, refs). IndexedDB persistence with clean async API. 29 tests.
Design doc
docs/vibenote-git-sync-design.md— captures the full design direction for the local git model and sync flow.Next steps
Builds on #104.