Skip to content

Maintain watched file names for CLI collision checks - #1351

Merged
vrtmrz merged 1 commit into
mainfrom
fix/watched-file-path-index
Nov 12, 2026
Merged

vrtmrz merged 1 commit into
mainfrom
fix/watched-file-path-index

Conversation

@vrtmrz

@vrtmrz vrtmrz commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

This reduces CLI daemon collision-check work by maintaining file names from filesystem observations and updating path-identity membership without rescanning every file after content-only edits.

Addresses #1346; the reporter's CPU and syscall results remain to be confirmed with this implementation. #1347 covers a related, separate lookup path.

Changes

  • Share one CLI watcher between name observation and synchronisation delivery. Keep inventory updates independent of synchronisation filtering, and preserve startup replay, fatal-error handling, and shutdown ordering.
  • Reconcile the requested physical directory branches before accepting path candidates. Preserve Legacy/NFC and case-policy rules, hidden-directory exclusions, symlink restrictions, and complete collision candidates.
  • Observe local storage mutations before delayed watcher events, including NFC requests targeting NFD directory names. Generation checks retain newer observations when reads, fresh scans, or subtree removal overlap a mutation.
  • Use a Vault-backed name source in Obsidian while retaining its alias guard and current metadata behaviour. Non-watching CLI commands retain the listing fallback.
  • Use fresh name lists for operations that require a current whole-Vault workset, including reconstruction preflight and bulk conflict resolution.
  • Split inventory, path selection, reconciliation, and watcher operations into independently testable modules with explicit dependencies. Include all storage tests in the CLI unit command.

Dependency and draft status

Depends on Commonlib PR #222, which introduces FilePathIndex and the shared name-query contract.

Local validation used an unpublished packed Commonlib candidate. package.json and package-lock.json still select the published 0.4.3, which does not contain the new APIs. A clean registry install therefore does not yet reproduce the validated environment. Keep this PR in draft until the Commonlib change is published, the exact dependency and lockfile are updated, and clean-install consumer checks pass. The applicable LiveSync PR test workflows skip drafts.

Validation

  • npm run check: type checking, lint, Svelte checks, production build, and compatibility checks passed.
  • Full unit coverage plus the separately run release-process units: 2,205 passed, 1 skipped.
  • npm run test:unit --workspace self-hosted-livesync-cli -- --maxWorkers=1: 393 passed.
  • npm run build --workspace self-hosted-livesync-cli: passed.
  • Regression tests confirmed failures before the fixes and now cover excluded-directory lookup, hidden membership, NFC/NFD mutation visibility, and newer descendant notifications during parent removal.
  • Warm content-edit tests cover all four comparison policies and assert no whole-file enumeration, full index replacement, or unrelated subtree read.
  • Fallow complexity inspection completed; import-graph review found no newly introduced type/runtime cycle.

Real Obsidian/database E2E checks and the reporter's large-Vault daemon measurements remain outstanding. CLI queries still read the relevant directory entries; a large flat directory is not a constant-time lookup, and the watched inventory is not an atomic filesystem snapshot.

Share the CLI watcher with a reconciled name inventory, observe local
mutations, and retain newer notifications across overlapping reads.
Adopt the shared index for Obsidian and preserve fresh bulk operations.
@vrtmrz
vrtmrz merged commit 8316a14 into main Nov 12, 2026
13 checks passed
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