mirror of
https://github.com/sotashimozono/obsidian-remote-ssh.git
synced 2026-07-22 17:10:32 +00:00
#341 was only papered-over on RPC: the adapter fired no writer-side trigger; the daemon fs.watch echo *eventually* reached the model via FsChangeListener, but with a real race (editor could save to a dead path in the window). SFTP was fixed in #346; this makes self-reflect transport-independent so RPC is genuinely fixed too. - LocalOpRegistry (new): short-TTL path set the writer records into synchronously after each applied op (rename records old+new). The daemon echo can only arrive strictly later, so no record/echo race. - SftpDataAdapter: `applied(echoPaths, run)` helper folds the registry.record + the (exception-safe) reflect into one call at every applied-op site (write/writeBinary/appendBinary/mkdir/remove/ rmdir/rename), reusing the !reconnecting guard from #346/C1. - FsChangeListener: subscribe() takes an optional localOpRegistry (stored like lastPathMapper so reconnect-resume reuses the same instance); handleNotification drops a self-originated echo before invalidate+applyChange. One check on action.vaultPath covers every echo shape (incl. watchers that split rename into delete+create) because both old and new were recorded. Other clients' changes never pass through record, so multi-client propagation is intact. - AdapterManager: the reflector is now wired on BOTH transports plus a per-patch LocalOpRegistry; RPC additionally subscribes the listener with that registry. Removed applyWriterReflectPolicy / afterSwapClient (and the main.ts swapClient call): the old RPC=null-reflector strategy that I5/N3 patched is obsolete — the reflector is transport-invariant and the adapter object outlives swapClient, so wiring once in patch() holds for the patched lifetime; double-fire is prevented by the registry, not by nulling. Tests: self-reflect-rpc wires the reflector (now 4/4 green, docblock rewritten); LocalOpRegistry.test.ts (TTL/no-consume/prune/boundary); FsChangeListener echo-dedup unit (self drop / other-client apply / no-registry legacy); removed the now-obsolete AdapterManager afterSwapClient describe. Validation: tsc --noEmit clean, eslint clean, vitest 70 files / 1047 passed / 1 skipped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| helpers | ||
| daemon.deploy.test.ts | ||
| invariants.e2e.test.ts | ||
| invariants.property.e2e.test.ts | ||
| multiclient.rpc.test.ts | ||
| multiclient.sftp.test.ts | ||
| perf.sync.bench.test.ts | ||
| restart-roundtrip.e2e.test.ts | ||
| self-reflect-rpc.e2e.test.ts | ||
| self-reflect.e2e.test.ts | ||
| ssh.integration.test.ts | ||
| sync.e2e.test.ts | ||
| walk.equivalence.test.ts | ||