Repository navigation
Watch every file from disk so a save elsewhere syncs; keep each file's history on the account (v0.25.0) - #64
Merged
Conversation
…s history on the account (v0.25.0) The desktop app only checked the open file for changes on disk, so a file saved in another editor never reached the workspace and never synced. Every disk-backed file is now checked (the open one each tick, the rest in rounds, all on focus), including large stored files via a new stat-file IPC. Each file a device changes now gets an end-to-end encrypted version on the account, filed under a key-derived path tag, and the History dialog lists versions from every device with Restore. Shared documents: viewers see history, editors can restore. 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.
Anthony: "i saved the file on my desktop and synced cloud and cloud didn't get the new version so that's a bug. we need a history that we can rollback to as well if we have write access"
The bug. The disk watcher (
checkDiskin site/viewer.ts) only ever looked at the open file, and skipped binaries and large stored files entirely. A file saved in another editor while a different file was open never got back into the workspace, so sync had nothing new to upload. Now every disk-backed file is checked: the open one every 5 s, the rest in rounds of 100, and all of them when the window regains focus. Large stored files are checked by size and time through a newstat-filedesktop IPC (desktop 0.18.0; older desktop builds skip only those) and get a new blob ref, so sync uploads the new bytes.Account history with rollback.
server/file-history.ts(/api/v1/file-history) keeps the newest 50 versions of each file, max 512 MB per account. It is end-to-end encrypted like the workspace: each version is sealed with the sync key and filed underpathTag(path, key), so the server sees neither content nor names. After each sync upload, autosync files a version for every file this device changed, plus the text it had before when the file has no history yet. The History dialog merges this device's local snapshots with the account's versions from every device ("synced from desktop"), each with Restore.Write access. Shared documents: anyone who can view a document now sees its version history; Restore needs edit access (it was owner-only for both before, so editors could not roll back). Viewers see the history without Restore buttons.
Tests: pathTag unit test; server tests for file history (owner isolation, ifEmpty, retention) and for editor restore / viewer refusal; Playwright: a non-open file changed on disk reaches the stored workspace, and the two-device sync test now checks the other device's edit appears in History and can be restored. typecheck, 227 unit, 104 server, 46 site tests pass.
🤖 Generated with Claude Code