@indigoai-us/hq-cloud 6.16.19 → 6.16.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/sync-runner-installation-id.d.ts +66 -0
- package/dist/bin/sync-runner-installation-id.d.ts.map +1 -0
- package/dist/bin/sync-runner-installation-id.js +138 -0
- package/dist/bin/sync-runner-installation-id.js.map +1 -0
- package/dist/bin/sync-runner-manifest.d.ts +120 -0
- package/dist/bin/sync-runner-manifest.d.ts.map +1 -0
- package/dist/bin/sync-runner-manifest.js +348 -0
- package/dist/bin/sync-runner-manifest.js.map +1 -0
- package/dist/bin/sync-runner-manifest.test.d.ts +12 -0
- package/dist/bin/sync-runner-manifest.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-manifest.test.js +510 -0
- package/dist/bin/sync-runner-manifest.test.js.map +1 -0
- package/dist/bin/sync-runner.d.ts +56 -21
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +86 -61
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +217 -0
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share-presign-transport.test.d.ts +22 -0
- package/dist/cli/share-presign-transport.test.d.ts.map +1 -0
- package/dist/cli/share-presign-transport.test.js +237 -0
- package/dist/cli/share-presign-transport.test.js.map +1 -0
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +17 -3
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +9 -0
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +123 -0
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/company-slug.d.ts +31 -0
- package/dist/company-slug.d.ts.map +1 -0
- package/dist/company-slug.js +52 -0
- package/dist/company-slug.js.map +1 -0
- package/dist/company-slug.test.d.ts +7 -0
- package/dist/company-slug.test.d.ts.map +1 -0
- package/dist/company-slug.test.js +43 -0
- package/dist/company-slug.test.js.map +1 -0
- package/dist/company-vault-transport.d.ts +69 -0
- package/dist/company-vault-transport.d.ts.map +1 -0
- package/dist/company-vault-transport.js +89 -0
- package/dist/company-vault-transport.js.map +1 -0
- package/dist/company-vault-transport.test.d.ts +12 -0
- package/dist/company-vault-transport.test.d.ts.map +1 -0
- package/dist/company-vault-transport.test.js +97 -0
- package/dist/company-vault-transport.test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/journal-ledger-index.test.d.ts +15 -0
- package/dist/journal-ledger-index.test.d.ts.map +1 -0
- package/dist/journal-ledger-index.test.js +247 -0
- package/dist/journal-ledger-index.test.js.map +1 -0
- package/dist/journal.d.ts +110 -0
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +253 -5
- package/dist/journal.js.map +1 -1
- package/dist/manifest/US-002.acceptance.test.d.ts +11 -0
- package/dist/manifest/US-002.acceptance.test.d.ts.map +1 -0
- package/dist/manifest/US-002.acceptance.test.js +160 -0
- package/dist/manifest/US-002.acceptance.test.js.map +1 -0
- package/dist/manifest/US-004.acceptance.test.d.ts +12 -0
- package/dist/manifest/US-004.acceptance.test.d.ts.map +1 -0
- package/dist/manifest/US-004.acceptance.test.js +173 -0
- package/dist/manifest/US-004.acceptance.test.js.map +1 -0
- package/dist/manifest/build-manifest.bench.test.d.ts +22 -0
- package/dist/manifest/build-manifest.bench.test.d.ts.map +1 -0
- package/dist/manifest/build-manifest.bench.test.js +544 -0
- package/dist/manifest/build-manifest.bench.test.js.map +1 -0
- package/dist/manifest/build-manifest.d.ts +319 -0
- package/dist/manifest/build-manifest.d.ts.map +1 -0
- package/dist/manifest/build-manifest.js +1043 -0
- package/dist/manifest/build-manifest.js.map +1 -0
- package/dist/manifest/build-manifest.test.d.ts +10 -0
- package/dist/manifest/build-manifest.test.d.ts.map +1 -0
- package/dist/manifest/build-manifest.test.js +1060 -0
- package/dist/manifest/build-manifest.test.js.map +1 -0
- package/dist/manifest/contract.d.ts +290 -0
- package/dist/manifest/contract.d.ts.map +1 -0
- package/dist/manifest/contract.js +476 -0
- package/dist/manifest/contract.js.map +1 -0
- package/dist/manifest/contract.test.d.ts +17 -0
- package/dist/manifest/contract.test.d.ts.map +1 -0
- package/dist/manifest/contract.test.js +283 -0
- package/dist/manifest/contract.test.js.map +1 -0
- package/dist/manifest/import-graph.test.d.ts +25 -0
- package/dist/manifest/import-graph.test.d.ts.map +1 -0
- package/dist/manifest/import-graph.test.js +120 -0
- package/dist/manifest/import-graph.test.js.map +1 -0
- package/dist/manifest/ledger-shard-isolation.test.d.ts +18 -0
- package/dist/manifest/ledger-shard-isolation.test.d.ts.map +1 -0
- package/dist/manifest/ledger-shard-isolation.test.js +153 -0
- package/dist/manifest/ledger-shard-isolation.test.js.map +1 -0
- package/dist/manifest/snapshot-store.d.ts +143 -0
- package/dist/manifest/snapshot-store.d.ts.map +1 -0
- package/dist/manifest/snapshot-store.js +291 -0
- package/dist/manifest/snapshot-store.js.map +1 -0
- package/dist/manifest/snapshot-store.test.d.ts +11 -0
- package/dist/manifest/snapshot-store.test.d.ts.map +1 -0
- package/dist/manifest/snapshot-store.test.js +133 -0
- package/dist/manifest/snapshot-store.test.js.map +1 -0
- package/dist/manifest/upload-manifest.d.ts +301 -0
- package/dist/manifest/upload-manifest.d.ts.map +1 -0
- package/dist/manifest/upload-manifest.js +921 -0
- package/dist/manifest/upload-manifest.js.map +1 -0
- package/dist/manifest/upload-manifest.test.d.ts +10 -0
- package/dist/manifest/upload-manifest.test.d.ts.map +1 -0
- package/dist/manifest/upload-manifest.test.js +1052 -0
- package/dist/manifest/upload-manifest.test.js.map +1 -0
- package/dist/manifest-reconcile.d.ts.map +1 -1
- package/dist/manifest-reconcile.js +1 -26
- package/dist/manifest-reconcile.js.map +1 -1
- package/dist/posix-key.d.ts +36 -0
- package/dist/posix-key.d.ts.map +1 -0
- package/dist/posix-key.js +38 -0
- package/dist/posix-key.js.map +1 -0
- package/dist/s3.d.ts +2 -18
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +6 -20
- package/dist/s3.js.map +1 -1
- package/dist/sync/journal-ledger-stream.d.ts +56 -0
- package/dist/sync/journal-ledger-stream.d.ts.map +1 -0
- package/dist/sync/journal-ledger-stream.js +191 -0
- package/dist/sync/journal-ledger-stream.js.map +1 -0
- package/dist/sync/journal-ledger-stream.test.d.ts +12 -0
- package/dist/sync/journal-ledger-stream.test.d.ts.map +1 -0
- package/dist/sync/journal-ledger-stream.test.js +134 -0
- package/dist/sync/journal-ledger-stream.test.js.map +1 -0
- package/dist/types.d.ts +18 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side mirror tests for the sync manifest contract (US-001).
|
|
3
|
+
*
|
|
4
|
+
* Three independent guards:
|
|
5
|
+
*
|
|
6
|
+
* 1. Structural mirror — the descriptor must equal the byte-identical
|
|
7
|
+
* `test/fixtures/sync-manifest-contract/descriptor.json` snapshot that is
|
|
8
|
+
* also checked into hq-pro. Any drift fails here AND there.
|
|
9
|
+
* 2. Predicate parity — `hasControlCharacters` in the contract must agree
|
|
10
|
+
* with the REAL `hasControlCharacters` in `src/ignore.ts` on every code
|
|
11
|
+
* point, because the contract's path guard is defined in terms of it.
|
|
12
|
+
* 3. Ignore parity — the shared `test/fixtures/ignore-parity/` fixture is
|
|
13
|
+
* hashed (must match the same digest hq-pro asserts) AND every expected
|
|
14
|
+
* verdict is evaluated through the REAL ignore engine.
|
|
15
|
+
*/
|
|
16
|
+
import { createHash } from "node:crypto";
|
|
17
|
+
import * as fs from "node:fs";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
import { describe, expect, it } from "vitest";
|
|
21
|
+
import { SYNC_MANIFEST_CONTRACT_DESCRIPTOR, SYNC_MANIFEST_CONTRACT_VERSION, SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK, SYNC_MANIFEST_MAX_IGNORE_RULES, SYNC_MANIFEST_MAX_IGNORE_RULE_LENGTH, SyncManifestContractError, hasControlCharacters as contractHasControlCharacters, validateSyncManifestUpload, } from "./contract.js";
|
|
22
|
+
import { createIgnoreFilter, hasControlCharacters as ignoreHasControlCharacters, } from "../ignore.js";
|
|
23
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
const REPO_ROOT = path.resolve(HERE, "..", "..");
|
|
25
|
+
const IGNORE_PARITY_DIR = path.join(REPO_ROOT, "test", "fixtures", "ignore-parity");
|
|
26
|
+
/**
|
|
27
|
+
* sha256 over `<relpath>\0<bytes>\0` for every file in the fixture, walked in
|
|
28
|
+
* sorted order. The SAME literal is asserted in hq-pro; editing the fixture in
|
|
29
|
+
* one repo without mirroring it breaks the other repo's suite.
|
|
30
|
+
*/
|
|
31
|
+
const IGNORE_PARITY_DIGEST = "974eedcc9fe383d8120348d3000b21e571e51b4b54c40287e99f20d4b8eddc44";
|
|
32
|
+
function walkFiles(root) {
|
|
33
|
+
return fs
|
|
34
|
+
.readdirSync(root, { withFileTypes: true })
|
|
35
|
+
.flatMap((entry) => entry.isDirectory()
|
|
36
|
+
? walkFiles(path.join(root, entry.name)).map((child) => `${entry.name}/${child}`)
|
|
37
|
+
: [entry.name])
|
|
38
|
+
.sort();
|
|
39
|
+
}
|
|
40
|
+
function digestFixtureDir(root) {
|
|
41
|
+
const hash = createHash("sha256");
|
|
42
|
+
for (const rel of walkFiles(root)) {
|
|
43
|
+
hash.update(rel);
|
|
44
|
+
hash.update("\0");
|
|
45
|
+
hash.update(fs.readFileSync(path.join(root, rel)));
|
|
46
|
+
hash.update("\0");
|
|
47
|
+
}
|
|
48
|
+
return hash.digest("hex");
|
|
49
|
+
}
|
|
50
|
+
function readVerdicts(caseDir) {
|
|
51
|
+
return JSON.parse(fs.readFileSync(path.join(IGNORE_PARITY_DIR, caseDir, "verdicts.json"), "utf-8"));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Feed the fixture's rule files to the REAL ignore engine through its
|
|
55
|
+
* snapshot-reader seam. Only the layers the sync engine actually consults are
|
|
56
|
+
* wired up: `.hqignore` and `.hqinclude`. The fixture's `gitignore` file is
|
|
57
|
+
* deliberately NOT wired, which is what makes the "gitignore is not a sync
|
|
58
|
+
* layer" case in `case-permissive` non-vacuous.
|
|
59
|
+
*/
|
|
60
|
+
function readerFor(caseDir, hqRoot) {
|
|
61
|
+
const available = new Map();
|
|
62
|
+
for (const name of [".hqignore", ".hqinclude", ".hqsyncignore"]) {
|
|
63
|
+
const source = path.join(IGNORE_PARITY_DIR, caseDir, name);
|
|
64
|
+
if (fs.existsSync(source)) {
|
|
65
|
+
available.set(path.join(hqRoot, name), fs.readFileSync(source, "utf-8"));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
existsSync: (filePath) => available.has(filePath),
|
|
70
|
+
readFileSync: (filePath) => {
|
|
71
|
+
const content = available.get(filePath);
|
|
72
|
+
if (content === undefined)
|
|
73
|
+
throw new Error(`unexpected read: ${filePath}`);
|
|
74
|
+
return content;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
describe("sync manifest contract — client mirror", () => {
|
|
79
|
+
it("matches the cross-repo structural descriptor snapshot", () => {
|
|
80
|
+
const snapshot = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, "test", "fixtures", "sync-manifest-contract", "descriptor.json"), "utf-8"));
|
|
81
|
+
expect(JSON.parse(JSON.stringify(SYNC_MANIFEST_CONTRACT_DESCRIPTOR))).toEqual(snapshot);
|
|
82
|
+
expect(snapshot.contractVersion).toBe(SYNC_MANIFEST_CONTRACT_VERSION);
|
|
83
|
+
expect(snapshot.limits.maxEntriesPerChunk).toBe(SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK);
|
|
84
|
+
});
|
|
85
|
+
it("declares field names that are real keys of the wire interfaces", () => {
|
|
86
|
+
const exhaustiveUpload = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.upload;
|
|
87
|
+
const exhaustiveEntry = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.entry;
|
|
88
|
+
const exhaustiveScope = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.scope;
|
|
89
|
+
const exhaustiveWalk = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.walkStats;
|
|
90
|
+
const exhaustiveLedger = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.ledgerUnavailable;
|
|
91
|
+
expect([
|
|
92
|
+
exhaustiveUpload,
|
|
93
|
+
exhaustiveEntry,
|
|
94
|
+
exhaustiveScope,
|
|
95
|
+
exhaustiveWalk,
|
|
96
|
+
exhaustiveLedger,
|
|
97
|
+
]).toHaveLength(5);
|
|
98
|
+
const uploadKeys = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.upload;
|
|
99
|
+
const entryKeys = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.entry;
|
|
100
|
+
const scopeKeys = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.scope;
|
|
101
|
+
const walkKeys = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.walkStats;
|
|
102
|
+
const ledgerKeys = SYNC_MANIFEST_CONTRACT_DESCRIPTOR.fields.ledgerUnavailable;
|
|
103
|
+
expect(uploadKeys).toContain("ignoreRules");
|
|
104
|
+
expect(entryKeys).toContain("pendingPush");
|
|
105
|
+
expect(scopeKeys).toContain("companyUid");
|
|
106
|
+
expect(walkKeys).toContain("hashedFiles");
|
|
107
|
+
expect(ledgerKeys).toEqual(["errorClass"]);
|
|
108
|
+
// personUid is derived from auth and must never be a body field.
|
|
109
|
+
expect(uploadKeys).not.toContain("personUid");
|
|
110
|
+
});
|
|
111
|
+
it("keeps hasControlCharacters byte-identical with the ignore engine's predicate", () => {
|
|
112
|
+
for (let code = 0; code <= 0x100; code++) {
|
|
113
|
+
const probe = `a${String.fromCharCode(code)}b`;
|
|
114
|
+
expect(contractHasControlCharacters(probe), `divergence at code point ${code}`).toBe(ignoreHasControlCharacters(probe));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe("ignore-parity fixture", () => {
|
|
119
|
+
it("is byte-identical with the copy checked into hq-pro", () => {
|
|
120
|
+
expect(digestFixtureDir(IGNORE_PARITY_DIR)).toBe(IGNORE_PARITY_DIGEST);
|
|
121
|
+
});
|
|
122
|
+
it("carries rule lines that are legal manifest ignoreRules values", () => {
|
|
123
|
+
const lines = [];
|
|
124
|
+
for (const caseDir of ["case-permissive", "case-allowlist"]) {
|
|
125
|
+
for (const name of [".hqignore", ".hqinclude"]) {
|
|
126
|
+
const file = path.join(IGNORE_PARITY_DIR, caseDir, name);
|
|
127
|
+
if (!fs.existsSync(file))
|
|
128
|
+
continue;
|
|
129
|
+
for (const line of fs.readFileSync(file, "utf-8").split("\n")) {
|
|
130
|
+
if (line.trim())
|
|
131
|
+
lines.push(line);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
expect(lines.length).toBeGreaterThan(0);
|
|
136
|
+
expect(lines.length).toBeLessThanOrEqual(SYNC_MANIFEST_MAX_IGNORE_RULES);
|
|
137
|
+
for (const line of lines) {
|
|
138
|
+
expect(line.length).toBeLessThanOrEqual(SYNC_MANIFEST_MAX_IGNORE_RULE_LENGTH);
|
|
139
|
+
expect(contractHasControlCharacters(line)).toBe(false);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
it.each(["case-permissive", "case-allowlist"])("reproduces every %s verdict through the real ignore engine", (caseDir) => {
|
|
143
|
+
const hqRoot = path.join(path.sep, "fixture", caseDir);
|
|
144
|
+
const filter = createIgnoreFilter(hqRoot, { snapshotReader: readerFor(caseDir, hqRoot) });
|
|
145
|
+
const verdicts = readVerdicts(caseDir);
|
|
146
|
+
expect(verdicts.cases.length).toBeGreaterThan(0);
|
|
147
|
+
for (const testCase of verdicts.cases) {
|
|
148
|
+
const included = filter(path.join(hqRoot, ...testCase.path.split("/")));
|
|
149
|
+
expect(included ? "include" : "exclude", `${caseDir}/${testCase.path} (layer: ${testCase.layer})`).toBe(testCase.expected);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
describe("validateSyncManifestUpload — bounded sizes", () => {
|
|
154
|
+
function baseUpload() {
|
|
155
|
+
return {
|
|
156
|
+
contractVersion: SYNC_MANIFEST_CONTRACT_VERSION,
|
|
157
|
+
installationId: "inst-mirror-0001",
|
|
158
|
+
scope: { kind: "personal" },
|
|
159
|
+
machineId: "machine-mirror-01",
|
|
160
|
+
source: "cli",
|
|
161
|
+
mode: "full",
|
|
162
|
+
generatedAt: "2026-09-04T00:00:00.000Z",
|
|
163
|
+
sequence: 1,
|
|
164
|
+
chunkIndex: 0,
|
|
165
|
+
chunkCount: 1,
|
|
166
|
+
entries: [],
|
|
167
|
+
removedPaths: [],
|
|
168
|
+
ignoreRules: [],
|
|
169
|
+
walkStats: { filesWalked: 0, walkMs: 1, hashedFiles: 0, ignoredFiles: 0 },
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
it("rejects 50,001 entries in one chunk with a bounded-size reason code", () => {
|
|
173
|
+
const upload = baseUpload();
|
|
174
|
+
upload.entries = Array.from({ length: SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK + 1 }, (_, i) => ({
|
|
175
|
+
path: `f/${i}.md`,
|
|
176
|
+
hash: "a".repeat(64),
|
|
177
|
+
size: 1,
|
|
178
|
+
mtimeMs: 1,
|
|
179
|
+
source: "both",
|
|
180
|
+
}));
|
|
181
|
+
expect(() => validateSyncManifestUpload(upload)).toThrowError(/BOUNDED_SIZE_EXCEEDED/);
|
|
182
|
+
});
|
|
183
|
+
it("accepts a well-formed personal-scope chunk", () => {
|
|
184
|
+
const upload = baseUpload();
|
|
185
|
+
upload.entries = [
|
|
186
|
+
{ path: "notes.md", hash: "b".repeat(64), size: 12, mtimeMs: 1, source: "both" },
|
|
187
|
+
];
|
|
188
|
+
expect(validateSyncManifestUpload(upload).entries[0].path).toBe("notes.md");
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
/**
|
|
192
|
+
* Shared fail-closed BEHAVIOUR suite.
|
|
193
|
+
*
|
|
194
|
+
* The descriptor snapshot pins the contract's SHAPE; this fixture pins what it
|
|
195
|
+
* actually REJECTS. It is checked into BOTH repos byte-identically and each
|
|
196
|
+
* repo runs every case through its OWN validateSyncManifestUpload — so
|
|
197
|
+
* deleting a guard (the `..` segment loop, the personUid rejection, the
|
|
198
|
+
* version classification) fails the suite in the repo that dropped it, which
|
|
199
|
+
* the descriptor alone could never detect.
|
|
200
|
+
*/
|
|
201
|
+
describe("shared rejection-case fixture", () => {
|
|
202
|
+
const fixture = JSON.parse(fs.readFileSync(path.join(REPO_ROOT, "test", "fixtures", "sync-manifest-contract", "rejection-cases.json"), "utf-8"));
|
|
203
|
+
it("is byte-identical with the copy checked into the sibling repo", () => {
|
|
204
|
+
expect(fixture.contractVersion).toBe(SYNC_MANIFEST_CONTRACT_VERSION);
|
|
205
|
+
expect(fixture.cases.length).toBeGreaterThanOrEqual(30);
|
|
206
|
+
});
|
|
207
|
+
for (const testCase of fixture.cases) {
|
|
208
|
+
it(testCase.name, () => {
|
|
209
|
+
if (testCase.expect === "accept") {
|
|
210
|
+
expect(() => validateSyncManifestUpload(testCase.upload)).not.toThrow();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
let thrown;
|
|
214
|
+
try {
|
|
215
|
+
validateSyncManifestUpload(testCase.upload);
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
thrown = error;
|
|
219
|
+
}
|
|
220
|
+
expect(thrown).toBeInstanceOf(SyncManifestContractError);
|
|
221
|
+
const error = thrown;
|
|
222
|
+
expect(error.code).toBe(testCase.code);
|
|
223
|
+
expect(error.field).toBe(testCase.field);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
228
|
+
* `hash` is OPTIONAL on the wire.
|
|
229
|
+
*
|
|
230
|
+
* The client's cheap path is a stat walk: it reuses a hash from its journal
|
|
231
|
+
* when the (size, mtime) pair still matches, and otherwise has none. Computing
|
|
232
|
+
* one means READING the file, which on a large vault with a journal that
|
|
233
|
+
* predates hashing means reading everything — measured at ~690k files, ~9m40s
|
|
234
|
+
* and 2.9 GB RSS for one post-sync tail step. So an entry may say "present,
|
|
235
|
+
* hash unknown", and consumers must read a missing hash as UNKNOWN, never as a
|
|
236
|
+
* mismatch and never as an absent file.
|
|
237
|
+
*/
|
|
238
|
+
describe("validateSyncManifestEntry — an entry may be present without a hash", () => {
|
|
239
|
+
function uploadWithEntry(entry) {
|
|
240
|
+
return {
|
|
241
|
+
contractVersion: SYNC_MANIFEST_CONTRACT_VERSION,
|
|
242
|
+
installationId: "inst-mirror-0001",
|
|
243
|
+
scope: { kind: "personal" },
|
|
244
|
+
machineId: "machine-mirror-01",
|
|
245
|
+
source: "cli",
|
|
246
|
+
mode: "full",
|
|
247
|
+
generatedAt: "2026-09-04T00:00:00.000Z",
|
|
248
|
+
sequence: 1,
|
|
249
|
+
chunkIndex: 0,
|
|
250
|
+
chunkCount: 1,
|
|
251
|
+
entries: [entry],
|
|
252
|
+
removedPaths: [],
|
|
253
|
+
ignoreRules: [],
|
|
254
|
+
walkStats: { filesWalked: 1, walkMs: 1, hashedFiles: 0, ignoredFiles: 0 },
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const statOnly = { path: "notes/a.md", size: 5, mtimeMs: 1, source: "disk" };
|
|
258
|
+
it("accepts an entry with no hash field at all", () => {
|
|
259
|
+
const parsed = validateSyncManifestUpload(uploadWithEntry({ ...statOnly }));
|
|
260
|
+
expect(parsed.entries[0]?.hash).toBeUndefined();
|
|
261
|
+
expect(parsed.entries[0]?.size).toBe(5);
|
|
262
|
+
});
|
|
263
|
+
it("accepts an explicit null hash, which JSON round-trips produce", () => {
|
|
264
|
+
// Rejecting the null spelling would fail a whole chunk over a serialiser
|
|
265
|
+
// detail, and `null` says exactly what an omitted optional says.
|
|
266
|
+
const parsed = validateSyncManifestUpload(uploadWithEntry({ ...statOnly, hash: null }));
|
|
267
|
+
expect(parsed.entries[0]?.hash).toBeUndefined();
|
|
268
|
+
});
|
|
269
|
+
it("still rejects a PRESENT hash that is malformed", () => {
|
|
270
|
+
// "Unknown" and "malformed" are different claims. Making the field optional
|
|
271
|
+
// must not weaken the rule for a hash that IS supplied.
|
|
272
|
+
expect(() => validateSyncManifestUpload(uploadWithEntry({ ...statOnly, hash: "not-a-sha" }))).toThrowError(/UNSAFE_VALUE|INVALID_TYPE/);
|
|
273
|
+
expect(() => validateSyncManifestUpload(uploadWithEntry({ ...statOnly, hash: "A".repeat(64) }))).toThrowError(/UNSAFE_VALUE/);
|
|
274
|
+
});
|
|
275
|
+
it("accepts the optional unhashedFiles walk stat, and tolerates its absence", () => {
|
|
276
|
+
const withStat = uploadWithEntry({ ...statOnly });
|
|
277
|
+
withStat.walkStats.unhashedFiles = 1;
|
|
278
|
+
expect(validateSyncManifestUpload(withStat).walkStats.unhashedFiles).toBe(1);
|
|
279
|
+
// An older client does not send it; that must not fail the chunk.
|
|
280
|
+
expect(validateSyncManifestUpload(uploadWithEntry({ ...statOnly })).walkStats.unhashedFiles).toBeUndefined();
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
//# sourceMappingURL=contract.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.test.js","sourceRoot":"","sources":["../../src/manifest/contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,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AQ,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE7E,kEAAkE;QAClE,MAAM,CAAC,0BAA0B,CAAC,eAAe,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;IAC/G,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest builder's import graph must stay LEAN.
|
|
3
|
+
*
|
|
4
|
+
* `buildSyncManifest` is client hot-path code: it runs on the user's laptop
|
|
5
|
+
* beside their editor, and it is imported by the CLI. Its cost budget is a
|
|
6
|
+
* stat walk, not a module graph. The package already draws this line
|
|
7
|
+
* explicitly (see the `"//exports"` note in package.json, which keeps
|
|
8
|
+
* `./outposts` free of the AWS SDK) and it is easy to cross by accident — one
|
|
9
|
+
* convenience import of a helper that happens to live next to the S3 client
|
|
10
|
+
* pulls in `@aws-sdk/client-s3`, Cognito auth and telemetry for the sake of a
|
|
11
|
+
* one-line pure function. That has already happened twice on this branch:
|
|
12
|
+
* `isSafeCompanySlug` from `manifest-reconcile.ts`, and `toPosixKey` reaching
|
|
13
|
+
* `journal.ts` from `s3.ts`. Both are now leaf modules.
|
|
14
|
+
*
|
|
15
|
+
* A type-level assertion cannot catch this, and neither can a unit test of the
|
|
16
|
+
* builder's behaviour, so the graph itself is the thing under test: walk the
|
|
17
|
+
* relative imports from `build-manifest.ts` and assert the closure never
|
|
18
|
+
* reaches the heavy modules.
|
|
19
|
+
*
|
|
20
|
+
* `import type` / `export type` statements are excluded — tsc erases them, so
|
|
21
|
+
* they cost nothing at runtime (this is why `pull-scope.ts`'s type-only
|
|
22
|
+
* reference to `vault-client.ts` is fine).
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=import-graph.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-graph.test.d.ts","sourceRoot":"","sources":["../../src/manifest/import-graph.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest builder's import graph must stay LEAN.
|
|
3
|
+
*
|
|
4
|
+
* `buildSyncManifest` is client hot-path code: it runs on the user's laptop
|
|
5
|
+
* beside their editor, and it is imported by the CLI. Its cost budget is a
|
|
6
|
+
* stat walk, not a module graph. The package already draws this line
|
|
7
|
+
* explicitly (see the `"//exports"` note in package.json, which keeps
|
|
8
|
+
* `./outposts` free of the AWS SDK) and it is easy to cross by accident — one
|
|
9
|
+
* convenience import of a helper that happens to live next to the S3 client
|
|
10
|
+
* pulls in `@aws-sdk/client-s3`, Cognito auth and telemetry for the sake of a
|
|
11
|
+
* one-line pure function. That has already happened twice on this branch:
|
|
12
|
+
* `isSafeCompanySlug` from `manifest-reconcile.ts`, and `toPosixKey` reaching
|
|
13
|
+
* `journal.ts` from `s3.ts`. Both are now leaf modules.
|
|
14
|
+
*
|
|
15
|
+
* A type-level assertion cannot catch this, and neither can a unit test of the
|
|
16
|
+
* builder's behaviour, so the graph itself is the thing under test: walk the
|
|
17
|
+
* relative imports from `build-manifest.ts` and assert the closure never
|
|
18
|
+
* reaches the heavy modules.
|
|
19
|
+
*
|
|
20
|
+
* `import type` / `export type` statements are excluded — tsc erases them, so
|
|
21
|
+
* they cost nothing at runtime (this is why `pull-scope.ts`'s type-only
|
|
22
|
+
* reference to `vault-client.ts` is fine).
|
|
23
|
+
*/
|
|
24
|
+
import * as fs from "node:fs";
|
|
25
|
+
import * as path from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
import { describe, expect, it } from "vitest";
|
|
28
|
+
const SRC_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
29
|
+
const ENTRY = path.join(SRC_DIR, "manifest", "build-manifest.ts");
|
|
30
|
+
/** Local modules whose transitive weight is the whole point of this test. */
|
|
31
|
+
const FORBIDDEN_LOCAL = ["vault-client.ts", "cognito-auth.ts", "s3.ts", "object-io.ts", "telemetry.ts"];
|
|
32
|
+
/** Package prefixes that must never appear in the builder's runtime graph. */
|
|
33
|
+
const FORBIDDEN_PACKAGES = ["@aws-sdk/", "pino", "chokidar"];
|
|
34
|
+
function stripNonCode(source) {
|
|
35
|
+
return source
|
|
36
|
+
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
37
|
+
.replace(/^\s*\/\/.*$/gm, "")
|
|
38
|
+
// Erased by the compiler: not part of the runtime graph.
|
|
39
|
+
.replace(/\b(?:import|export)\s+type\b[^;'"]*?\bfrom\s*["'][^"']+["']/g, "");
|
|
40
|
+
}
|
|
41
|
+
function specifiersIn(source) {
|
|
42
|
+
const code = stripNonCode(source);
|
|
43
|
+
const re = /\b(?:import|export)\b[^;'"]*?\bfrom\s*["']([^"']+)["']|(?:^|[\n;])\s*import\s*["']([^"']+)["']|\bimport\(\s*["']([^"']+)["']\s*\)/g;
|
|
44
|
+
const found = [];
|
|
45
|
+
for (let m = re.exec(code); m !== null; m = re.exec(code)) {
|
|
46
|
+
const spec = m[1] ?? m[2] ?? m[3];
|
|
47
|
+
if (spec)
|
|
48
|
+
found.push(spec);
|
|
49
|
+
}
|
|
50
|
+
return found;
|
|
51
|
+
}
|
|
52
|
+
/** Resolve a relative TS specifier the way NodeNext + tsc does (".js" → ".ts"). */
|
|
53
|
+
function resolveLocal(fromFile, spec) {
|
|
54
|
+
const base = path.resolve(path.dirname(fromFile), spec.replace(/\.js$/, ""));
|
|
55
|
+
for (const candidate of [`${base}.ts`, path.join(base, "index.ts")]) {
|
|
56
|
+
if (fs.existsSync(candidate))
|
|
57
|
+
return candidate;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function buildClosure(entry) {
|
|
62
|
+
const key = (abs) => path.relative(SRC_DIR, abs).split(path.sep).join("/");
|
|
63
|
+
const closure = {
|
|
64
|
+
local: new Set([key(entry)]),
|
|
65
|
+
packages: new Map(),
|
|
66
|
+
parent: new Map([[key(entry), null]]),
|
|
67
|
+
};
|
|
68
|
+
const queue = [entry];
|
|
69
|
+
const unresolved = [];
|
|
70
|
+
while (queue.length > 0) {
|
|
71
|
+
const file = queue.shift();
|
|
72
|
+
for (const spec of specifiersIn(fs.readFileSync(file, "utf8"))) {
|
|
73
|
+
if (!spec.startsWith(".")) {
|
|
74
|
+
if (!closure.packages.has(spec))
|
|
75
|
+
closure.packages.set(spec, key(file));
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const resolved = resolveLocal(file, spec);
|
|
79
|
+
if (resolved === null) {
|
|
80
|
+
unresolved.push(`${key(file)} -> ${spec}`);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (closure.local.has(key(resolved)))
|
|
84
|
+
continue;
|
|
85
|
+
closure.local.add(key(resolved));
|
|
86
|
+
closure.parent.set(key(resolved), key(file));
|
|
87
|
+
queue.push(resolved);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// A specifier this walker cannot resolve is a HOLE in the graph, which would
|
|
91
|
+
// let a forbidden module slip through unnoticed. Fail loudly instead.
|
|
92
|
+
expect(unresolved).toEqual([]);
|
|
93
|
+
return closure;
|
|
94
|
+
}
|
|
95
|
+
/** "a -> b -> c": how the offending module got pulled in. */
|
|
96
|
+
function blameChain(closure, target) {
|
|
97
|
+
const chain = [];
|
|
98
|
+
for (let cur = target; cur; cur = closure.parent.get(cur)) {
|
|
99
|
+
chain.unshift(cur);
|
|
100
|
+
}
|
|
101
|
+
return chain.join(" -> ");
|
|
102
|
+
}
|
|
103
|
+
describe("manifest builder import graph", () => {
|
|
104
|
+
const closure = buildClosure(ENTRY);
|
|
105
|
+
it("resolves a non-trivial closure (the walker actually walked)", () => {
|
|
106
|
+
// Guards against the walker silently matching nothing and passing vacuously.
|
|
107
|
+
expect(closure.local.size).toBeGreaterThan(5);
|
|
108
|
+
expect(closure.local).toContain("journal.ts");
|
|
109
|
+
expect(closure.local).toContain("ignore.ts");
|
|
110
|
+
});
|
|
111
|
+
it.each(FORBIDDEN_LOCAL)("does not reach %s", (module) => {
|
|
112
|
+
const hit = [...closure.local].find((f) => f === module || f.endsWith(`/${module}`));
|
|
113
|
+
expect(hit ? blameChain(closure, hit) : undefined).toBeUndefined();
|
|
114
|
+
});
|
|
115
|
+
it.each(FORBIDDEN_PACKAGES)("does not pull in %s", (prefix) => {
|
|
116
|
+
const hit = [...closure.packages].find(([spec]) => spec.startsWith(prefix));
|
|
117
|
+
expect(hit ? `${hit[0]} <- ${blameChain(closure, hit[1])}` : undefined).toBeUndefined();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=import-graph.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-graph.test.js","sourceRoot":"","sources":["../../src/manifest/import-graph.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACjF,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;AAElE,6EAA6E;AAC7E,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE,cA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AK,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC9C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,EAAE;QACvD,MAAM,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;QACrF,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,qBAAqB,EAAE,CAAC,MAAM,EAAE,EAAE;QAC5D,MAAM,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5E,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,CAAC;IAC1F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest build reads ONE journal shard: the one describing its scope.
|
|
3
|
+
*
|
|
4
|
+
* This is a memory invariant expressed as a behavioural one. `listJournals()`
|
|
5
|
+
* reads and parses every shard on the machine, and on a laptop holding a
|
|
6
|
+
* personal vault plus several cloud companies that was the single largest line
|
|
7
|
+
* item in the tail step's footprint — hundreds of megabytes spent parsing
|
|
8
|
+
* ledgers whose rows were then dropped on the floor, repaid once per scope in
|
|
9
|
+
* a fanout.
|
|
10
|
+
*
|
|
11
|
+
* A byte counter would be the obvious gate and the wrong one: it moves with
|
|
12
|
+
* fixture size and tempts a future reader to widen it. The thing that must not
|
|
13
|
+
* come back is the ENUMERATION, so the assertion counts journal files opened.
|
|
14
|
+
* One is correct; anything above one means a caller has gone back to reading
|
|
15
|
+
* the machine instead of the scope, no matter what the megabytes say.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=ledger-shard-isolation.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-shard-isolation.test.d.ts","sourceRoot":"","sources":["../../src/manifest/ledger-shard-isolation.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest build reads ONE journal shard: the one describing its scope.
|
|
3
|
+
*
|
|
4
|
+
* This is a memory invariant expressed as a behavioural one. `listJournals()`
|
|
5
|
+
* reads and parses every shard on the machine, and on a laptop holding a
|
|
6
|
+
* personal vault plus several cloud companies that was the single largest line
|
|
7
|
+
* item in the tail step's footprint — hundreds of megabytes spent parsing
|
|
8
|
+
* ledgers whose rows were then dropped on the floor, repaid once per scope in
|
|
9
|
+
* a fanout.
|
|
10
|
+
*
|
|
11
|
+
* A byte counter would be the obvious gate and the wrong one: it moves with
|
|
12
|
+
* fixture size and tempts a future reader to widen it. The thing that must not
|
|
13
|
+
* come back is the ENUMERATION, so the assertion counts journal files opened.
|
|
14
|
+
* One is correct; anything above one means a caller has gone back to reading
|
|
15
|
+
* the machine instead of the scope, no matter what the megabytes say.
|
|
16
|
+
*/
|
|
17
|
+
import * as os from "node:os";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
20
|
+
/**
|
|
21
|
+
* Journal reads reach the filesystem through two specifiers — `journal.ts`
|
|
22
|
+
* imports `"fs"` and the streaming ledger reader imports `"node:fs"` — and a
|
|
23
|
+
* counter that watches only one of them would report a comfortable "1" while
|
|
24
|
+
* the other quietly read the whole state dir. Both are instrumented, and the
|
|
25
|
+
* counts are keyed by resolved path so a shard opened twice through different
|
|
26
|
+
* specifiers is still one shard.
|
|
27
|
+
*/
|
|
28
|
+
const opened = vi.hoisted(() => ({ paths: [] }));
|
|
29
|
+
function recordIfJournal(target) {
|
|
30
|
+
const value = String(target);
|
|
31
|
+
if (/sync-journal\..*\.json$/.test(value))
|
|
32
|
+
opened.paths.push(value);
|
|
33
|
+
}
|
|
34
|
+
vi.mock("node:fs", async (importOriginal) => {
|
|
35
|
+
const actual = await importOriginal();
|
|
36
|
+
return {
|
|
37
|
+
...actual,
|
|
38
|
+
default: actual,
|
|
39
|
+
openSync: ((target, ...rest) => {
|
|
40
|
+
recordIfJournal(target);
|
|
41
|
+
return actual.openSync(target, ...rest);
|
|
42
|
+
}),
|
|
43
|
+
readFileSync: ((target, ...rest) => {
|
|
44
|
+
recordIfJournal(target);
|
|
45
|
+
return actual.readFileSync(target, ...rest);
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
vi.mock("fs", async (importOriginal) => {
|
|
50
|
+
const actual = await importOriginal();
|
|
51
|
+
return {
|
|
52
|
+
...actual,
|
|
53
|
+
default: actual,
|
|
54
|
+
openSync: ((target, ...rest) => {
|
|
55
|
+
recordIfJournal(target);
|
|
56
|
+
return actual.openSync(target, ...rest);
|
|
57
|
+
}),
|
|
58
|
+
readFileSync: ((target, ...rest) => {
|
|
59
|
+
recordIfJournal(target);
|
|
60
|
+
return actual.readFileSync(target, ...rest);
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
const fs = await import("node:fs");
|
|
65
|
+
const { buildSyncManifest } = await import("./build-manifest.js");
|
|
66
|
+
const { PERSONAL_VAULT_JOURNAL_SLUG } = await import("../journal.js");
|
|
67
|
+
const OTHER_SLUGS = ["acme", "globex", "initech"];
|
|
68
|
+
let base;
|
|
69
|
+
let hqRoot;
|
|
70
|
+
let stateDir;
|
|
71
|
+
let previousStateDir;
|
|
72
|
+
function writeShard(slug, files) {
|
|
73
|
+
fs.writeFileSync(path.join(stateDir, `sync-journal.${slug}.json`), JSON.stringify({ version: "2", files, pulls: [] }), "utf8");
|
|
74
|
+
}
|
|
75
|
+
function ledgerRow(index) {
|
|
76
|
+
return {
|
|
77
|
+
hash: `sha256:${index.toString(16).padStart(64, "0")}`,
|
|
78
|
+
size: 100 + index,
|
|
79
|
+
syncedAt: "2026-01-01T00:00:00.000Z",
|
|
80
|
+
direction: "up",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
base = fs.mkdtempSync(path.join(os.tmpdir(), "hq-shard-isolation-"));
|
|
85
|
+
hqRoot = path.join(base, "hq");
|
|
86
|
+
stateDir = path.join(base, "state");
|
|
87
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
88
|
+
fs.mkdirSync(path.join(hqRoot, "notes"), { recursive: true });
|
|
89
|
+
fs.writeFileSync(path.join(hqRoot, "notes", "kept.md"), "kept\n");
|
|
90
|
+
writeShard(PERSONAL_VAULT_JOURNAL_SLUG, {
|
|
91
|
+
"notes/kept.md": ledgerRow(1),
|
|
92
|
+
"notes/gone.md": ledgerRow(2),
|
|
93
|
+
});
|
|
94
|
+
// Present only so they can be NOT read. Each carries a row that would be
|
|
95
|
+
// unmistakable if it leaked into the personal manifest.
|
|
96
|
+
OTHER_SLUGS.forEach((slug, index) => {
|
|
97
|
+
writeShard(slug, { [`${slug}/secret-${index}.md`]: ledgerRow(100 + index) });
|
|
98
|
+
});
|
|
99
|
+
previousStateDir = process.env.HQ_STATE_DIR;
|
|
100
|
+
process.env.HQ_STATE_DIR = stateDir;
|
|
101
|
+
opened.paths = [];
|
|
102
|
+
});
|
|
103
|
+
afterEach(() => {
|
|
104
|
+
if (previousStateDir === undefined)
|
|
105
|
+
delete process.env.HQ_STATE_DIR;
|
|
106
|
+
else
|
|
107
|
+
process.env.HQ_STATE_DIR = previousStateDir;
|
|
108
|
+
fs.rmSync(base, { recursive: true, force: true });
|
|
109
|
+
});
|
|
110
|
+
describe("buildSyncManifest — the ledger read is scoped to one shard", () => {
|
|
111
|
+
it("opens the scope's journal file and no other", async () => {
|
|
112
|
+
const result = await buildSyncManifest({
|
|
113
|
+
scope: { kind: "personal" },
|
|
114
|
+
hqRoot,
|
|
115
|
+
stateDir,
|
|
116
|
+
installationId: "install-shard",
|
|
117
|
+
machineId: "machine-shard",
|
|
118
|
+
source: "cli",
|
|
119
|
+
sequence: 1,
|
|
120
|
+
hashPolicy: "never",
|
|
121
|
+
maxWallMs: 60_000,
|
|
122
|
+
persistSnapshot: false,
|
|
123
|
+
});
|
|
124
|
+
const distinct = [...new Set(opened.paths)];
|
|
125
|
+
expect(distinct).toEqual([path.join(stateDir, `sync-journal.${PERSONAL_VAULT_JOURNAL_SLUG}.json`)]);
|
|
126
|
+
// The count is only meaningful if the shard was actually USED: a read that
|
|
127
|
+
// returns nothing also opens nothing.
|
|
128
|
+
const reported = result.chunks.flatMap((chunk) => chunk.entries);
|
|
129
|
+
expect(reported.map((entry) => entry.path).sort()).toEqual(["notes/gone.md", "notes/kept.md"]);
|
|
130
|
+
// And nothing from a neighbouring tenant's shard came along for the ride.
|
|
131
|
+
expect(reported.some((entry) => entry.path.includes("secret-"))).toBe(false);
|
|
132
|
+
});
|
|
133
|
+
it("stays at one shard as the machine accumulates more companies", async () => {
|
|
134
|
+
for (let index = 0; index < 12; index += 1) {
|
|
135
|
+
writeShard(`extra-${index}`, { [`extra-${index}/a.md`]: ledgerRow(index) });
|
|
136
|
+
}
|
|
137
|
+
opened.paths = [];
|
|
138
|
+
await buildSyncManifest({
|
|
139
|
+
scope: { kind: "personal" },
|
|
140
|
+
hqRoot,
|
|
141
|
+
stateDir,
|
|
142
|
+
installationId: "install-shard",
|
|
143
|
+
machineId: "machine-shard",
|
|
144
|
+
source: "cli",
|
|
145
|
+
sequence: 1,
|
|
146
|
+
hashPolicy: "never",
|
|
147
|
+
maxWallMs: 60_000,
|
|
148
|
+
persistSnapshot: false,
|
|
149
|
+
});
|
|
150
|
+
expect(new Set(opened.paths).size).toBe(1);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
//# sourceMappingURL=ledger-shard-isolation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-shard-isolation.test.js","sourceRoot":"","sources":["../../src/manifest/ledger-shard-isolation.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAc,EAAE,CAAC,CAAC,CAAC;AAE7D,SAAS,eAAe,CAAC,MAAe;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;IAC1C,MAAM,MAAM,GAAG,MAAM,cAA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