Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix(system): derive the system id from the canonical root path
KageBinary84a18671ca6d
diff --git a/ix-cli/src/cli/__tests__/system.test.ts b/ix-cli/src/cli/__tests__/system.test.tsindex f8298e6b..35097431 100644--- a/ix-cli/src/cli/__tests__/system.test.ts+++ b/ix-cli/src/cli/__tests__/system.test.ts@@ -284,3 +284,22 @@ describe("manifest reads are bounded and typed", () => {expect(Date.now() - started).toBeLessThan(2000);});});++describe("detectSystem system id", () => {+ it("is the same however the root is spelled (symlink, as a shell cwd may be)", () => {+ const base = fs.realpathSync(fs.mkdtempSync(nodePath.join(os.tmpdir(), "ix-sysid-")));+ try {+ const parent = nodePath.join(base, "systems");+ for (const repo of ["alpha", "beta"]) {+ fs.mkdirSync(nodePath.join(parent, repo, ".git"), { recursive: true });+ }+ const link = nodePath.join(base, "link");+ fs.symlinkSync(parent, link, "dir");+ const direct = detectSystem(parent);+ expect(direct).toBeDefined();+ expect(detectSystem(link)?.systemId).toBe(direct!.systemId);+ } finally {+ fs.rmSync(base, { recursive: true, force: true });+ }+ });+});diff --git a/ix-cli/src/cli/system.ts b/ix-cli/src/cli/system.tsindex c7a5e736..76d5dbbd 100644--- a/ix-cli/src/cli/system.ts+++ b/ix-cli/src/cli/system.ts@@ -422,7 +422,15 @@ export function detectSystem(rootPath: string): DetectedSystem | undefined {.filter(c => isRepoRoot(nodePath.join(rootPath, c.name))).map(c => c.name);if (members.length < 2) return undefined;- const abs = nodePath.resolve(rootPath).split(nodePath.sep).join("/");+ // Canonical, because the id is compared across callers that spell the root+ // differently: `ix map` hashes its realpath'd root, while every read scopes+ // by `detectSystem(process.cwd())`, which on Windows keeps the drive-letter+ // case and 8.3 names the shell used. Different spellings meant a different+ // system_id, and reads scoped to a system that holds nothing.+ let canonicalRoot: string;+ try { canonicalRoot = fs.realpathSync.native(rootPath); }+ catch { canonicalRoot = nodePath.resolve(rootPath); }+ const abs = canonicalRoot.split(nodePath.sep).join("/");const packageRegistry = buildPackageRegistry(rootPath, members);return {systemId: stableId(`system:${abs}`),