Repository navigation
feat(sync): restore-time cwd projection and symlink diagnostics (#28, #30) - #32
Merged
Merged
Conversation
…30) - cwdMap projects a cross-OS header.cwd onto a local path at restore time (longest prefix, segment boundary, Windows case-insensitive). Only the local copy's first zstd frame changes; the mirror keeps the origin device's bytes and a push reattaches the original header frame, so appends stay byte-identical across devices. - Unmatched cross-platform cwds land read-only under <sessionRoot>/--unmapped-- and are counted in sync_status. - sync_status reports skipped/followed symlinks and the new cwd projection counters; push results carry the same warning. - followSessionSymlinks (default false) follows only links whose realpath stays inside sessionRoot. - Auto-push listener registration is logged once at mount so hosts that never deliver session/event are diagnosable. - New lib modules: cwdmap (matching + host-compatible projectKey), sessionlog (zstd header-frame read/rewrite), projection (local projection state). - Tests drive the real @deepseek-ai/dsh-session-persistence-jsonl backend to prove the projected layout passes the host's stored-identity check.
Windows CI failed because the unit tests hard-coded POSIX mapping targets and treated a Windows cwd as foreign on Windows (it is native there). Use a native temp target for every mapping and pick the foreign cwd per platform: the reverse direction (POSIX cwd on Windows) exercises the same projection path. Also clear a read-only placeholder bit before unlinking it so remote deletions prune on Windows too.
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
Release 0.3.0: restore-time cwd projection for cross-OS sessions (#28) and symlink diagnostics plus an opt-in follow mode (#30).
#28 —
cwdMapA session synced from another platform carries a
header.cwdthat is not natively absolute on the receiving host:@deepseek-ai/dsh-workspacenever indexes it, andsession-persistence-jsonlcannot even parse a header whose cwd is foreign (so the session is invisible, not just ungrouped).cwdMap: [{ from, to }]— longest matching prefix wins, prefixes end on a path-segment boundary, Windows prefixes compare case-insensitively (C:\Users\me2does not matchC:\Users\me).<projectKey(mapped cwd)>/<sessionId>/<file>(the formula the host validates), and creates the mapped directory.<sessionRoot>/--unmapped--;sync_statusreportscwdUnmapped..git/dsh-session-sync-projection.json); a pull rebuilds it.#30 — symlink diagnostics + opt-in
sync_statusnow reportsskippedSymlinks,skippedSymlinkPaths,followedSymlinks, plus the cwd projection counters; push results carry the same warning.followSessionSymlinks: true(defaultfalse) follows only links whoserealpathstays insidesessionRoot; links that escape are always skipped and counted.session/eventcan be told apart from the plugin not registering.Tests
test/cwdmap.test.mjs— 11 tests. The key ones are host-validated: a synthetic Windows session log is restored, then the real@deepseek-ai/dsh-session-persistence-jsonlbackend (now a devDependency)stat()/list()s it. The host asserts<root>/<projectKey(header.cwd)>/<sessionId>/<file>, which pins ourprojectKeycopy, the directory layout and the header rewrite.typecheck,typecheck:ci,test(117),lint(0 errors),verify:self-contained,verify:artifacts,check:readmes,pnpm pack— all green.Docs
READMEs in five languages (config tables + cross-OS/symlink sections), ARCHITECTURE module map/data flow/safety boundaries, CHANGELOG, and
cordis.patch.ymldocument both new keys.Closes #28. Refs #30 (the app-level auto-push bug is not fixable from the plugin; diagnostics shipped instead).