Maintain watched file names for CLI collision checks

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.
This commit is contained in:
vorotamoroz committed 2026-11-12 14:04:17 +00:00
1 parent 78ebc2d298
commit 2a65fe0117
35 files changed
+5440 -28

No files matched your search

@@ -0,0 +1,29 @@
import { describe, expect, it } from "vitest";
import type { DirectoryEntry } from "@vrtmrz/livesync-commonlib/storage";
import { findInvalidatedDirectoryScopes } from "./CLIFileNameSource.paths";
describe("physical directory scopes for invalidation", () => {
it.each([true, false])(
"retains every Legacy parent admitted by the effective case policy (sensitive: %s)",
(sensitive) => {
const directories = new Map<string, readonly DirectoryEntry[]>([
[
"",
[
{ name: "Docs", kind: "directory" },
{ name: "docs", kind: "directory" },
{ name: "other", kind: "directory" },
],
],
["Docs", []],
["docs", []],
["other", []],
]);
const scopes = findInvalidatedDirectoryScopes(directories, "docs", {
pathNormalizationVersion: 0,
handleFilenameCaseSensitive: sensitive,
});
expect([...scopes].sort()).toEqual(sensitive ? ["docs"] : ["Docs", "docs"]);
}
);
});