Repository navigation
feat: sync the graph's git repository with its remote - #203
Merged
Merged
Conversation
Since the Vite 8.3 upgrade (#196), a `?worker&url` asset imported from inside a worker is no longer written out. The notes worker imports the subwaytext parser that way, so a production build kept a URL to a file that did not exist: the parser workers failed to start, and every graph read — the note list first — rejected with `undefined`. The dev server, and with it the Playwright suite, was unaffected. Start the parser pool with `new Worker(new URL(…, import.meta.url))`, the form Vite resolves itself, and fail the build whenever an emitted script refers to an asset that is missing, so the next upgrade that drops one is caught at build time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commits made on every save are now pushed to the repository's remote straight away, and what other machines pushed is pulled in: when the folder opens, on window focus (at most once a minute), every five minutes while focused, and whenever a push is rejected. Auto-sync is opt-in per repository (neno.autoSync in .git/config) and uses the branch's upstream or origin; NENO does not manage remotes. Pulls rebase. A conflict goes to the side whose latest commit touching the file is newer: overlapping hunks of text files to that side, edits that do not overlap from both, binary files whole. An edit always beats a deletion. A local commit that loses is kept under refs/neno/. Saving must never wait for the network, so only local steps — writes, commits, the rebase — take the worktree lock; fetch and push run in their own queue with connect and stall limits, non-interactively, and are killed on quit or folder switch. An unreachable remote is a neutral "offline" state, retried with backoff. Repositories that share no history with their remote are refused, and a rebase left behind by a crash is aborted when the folder opens. All git work moves from isomorphic-git in the notes worker to the system git in the Electron main process, so git is now desktop-only and OPFS mode has no version history. isomorphic-git and the buffer polyfill are removed; DatabaseIO can reload just the paths a pull changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md and CONTRIBUTING.md still described git as isomorphic-git in the notes worker, reached through GitFsProxy and nodeFsGit. Describe electron/git/ instead — the worktree lock, the non-interactive runner, when sync pulls and pushes, the conflict rules — and note in the README that versioning needs git and that sync exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #202: merge that first, then delete its branch (or change this PR's base to
main) so this PR shows only its own commits.Summary
Every saved change is already a commit. With auto-sync switched on (per repository, off by default), each commit is pushed to the remote right away, and what other machines pushed is pulled in.
All git work moves from isomorphic-git in the notes worker to the system git in the Electron main process:
Saving never waits for the network: only local steps take the lock.
sequenceDiagram participant Worker as Notes worker participant Main as GitSync (main) participant Remote Worker->>Main: write files (worktree lock) Worker->>Main: git.commit (worktree lock) Main-->>Worker: done — the save is over Main->>Remote: push (network queue, no lock) Remote-->>Main: rejected: non-fast-forward Main->>Remote: fetch (no lock) Main->>Main: rebase, last writer wins (worktree lock) Main-->>Worker: pathsChanged → reload those notes Main->>Remote: pushgit merge-file --ours/--theirs). Edits that don't overlap survive from both sides. Binary files go whole to the newer side. An edit always beats a deletion. A local commit that loses is kept underrefs/neno/overwritten/.onlineevent. Only auth failures, a missing remote and unrelated histories are errors..git/config(neno.autoSync), and the remote is the branch's upstream, elseorigin. A repo whose history is unrelated to its remote is refused. A rebase left behind by a crash is aborted when the folder opens.isomorphic-gitandbufferare removed.Evidence
electron/git/run the real/usr/bin/git, with a bare repo as the remote and two clones as two machines:End to end, the built app (over
neno://, driven with Playwright's Electron driver against a scratch graph, bare remote and second clone) passed all seven checks:npm run test(350),npm run lint,npm run stylelint,npm run build,npm run build:electronandnpm run integration-test(65) pass.Merge Danger
Door: two-way for the code, and one-way for what sync does to a remote
Reverting restores isomorphic-git; repositories stay standard git repositories either way. But once auto-sync is switched on, commits leave the machine. Rebases rewrite unpushed local commits, and a losing local version survives only under
refs/neno/overwritten/.Blast Radius: version history
GIT_SSH_COMMANDis respected, and it bypasses the BatchMode/ConnectTimeout defaults.gitprocesses instead of running isomorphic-git in the worker.🤖 Generated with Claude Code