Skip to content

Watch every file from disk so a save elsewhere syncs; keep each file's history on the account (v0.25.0) - #64

Merged
ralyodio merged 1 commit into
mainfrom
fix/desktop-sync-and-history
Oct 28, 2026
Merged

ralyodio merged 1 commit into
mainfrom
fix/desktop-sync-and-history

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

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 (checkDisk in 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 new stat-file desktop 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 under pathTag(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

…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>
@ralyodio
ralyodio merged commit 4c29e1c into main Oct 28, 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