@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.
Files changed (132) hide show
  1. package/dist/bin/sync-runner-installation-id.d.ts +66 -0
  2. package/dist/bin/sync-runner-installation-id.d.ts.map +1 -0
  3. package/dist/bin/sync-runner-installation-id.js +138 -0
  4. package/dist/bin/sync-runner-installation-id.js.map +1 -0
  5. package/dist/bin/sync-runner-manifest.d.ts +120 -0
  6. package/dist/bin/sync-runner-manifest.d.ts.map +1 -0
  7. package/dist/bin/sync-runner-manifest.js +348 -0
  8. package/dist/bin/sync-runner-manifest.js.map +1 -0
  9. package/dist/bin/sync-runner-manifest.test.d.ts +12 -0
  10. package/dist/bin/sync-runner-manifest.test.d.ts.map +1 -0
  11. package/dist/bin/sync-runner-manifest.test.js +510 -0
  12. package/dist/bin/sync-runner-manifest.test.js.map +1 -0
  13. package/dist/bin/sync-runner.d.ts +56 -21
  14. package/dist/bin/sync-runner.d.ts.map +1 -1
  15. package/dist/bin/sync-runner.js +86 -61
  16. package/dist/bin/sync-runner.js.map +1 -1
  17. package/dist/bin/sync-runner.test.js +217 -0
  18. package/dist/bin/sync-runner.test.js.map +1 -1
  19. package/dist/cli/share-presign-transport.test.d.ts +22 -0
  20. package/dist/cli/share-presign-transport.test.d.ts.map +1 -0
  21. package/dist/cli/share-presign-transport.test.js +237 -0
  22. package/dist/cli/share-presign-transport.test.js.map +1 -0
  23. package/dist/cli/share.d.ts.map +1 -1
  24. package/dist/cli/share.js +17 -3
  25. package/dist/cli/share.js.map +1 -1
  26. package/dist/cli/sync.d.ts.map +1 -1
  27. package/dist/cli/sync.js +9 -0
  28. package/dist/cli/sync.js.map +1 -1
  29. package/dist/cli/sync.test.js +123 -0
  30. package/dist/cli/sync.test.js.map +1 -1
  31. package/dist/company-slug.d.ts +31 -0
  32. package/dist/company-slug.d.ts.map +1 -0
  33. package/dist/company-slug.js +52 -0
  34. package/dist/company-slug.js.map +1 -0
  35. package/dist/company-slug.test.d.ts +7 -0
  36. package/dist/company-slug.test.d.ts.map +1 -0
  37. package/dist/company-slug.test.js +43 -0
  38. package/dist/company-slug.test.js.map +1 -0
  39. package/dist/company-vault-transport.d.ts +69 -0
  40. package/dist/company-vault-transport.d.ts.map +1 -0
  41. package/dist/company-vault-transport.js +89 -0
  42. package/dist/company-vault-transport.js.map +1 -0
  43. package/dist/company-vault-transport.test.d.ts +12 -0
  44. package/dist/company-vault-transport.test.d.ts.map +1 -0
  45. package/dist/company-vault-transport.test.js +97 -0
  46. package/dist/company-vault-transport.test.js.map +1 -0
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +5 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/journal-ledger-index.test.d.ts +15 -0
  52. package/dist/journal-ledger-index.test.d.ts.map +1 -0
  53. package/dist/journal-ledger-index.test.js +247 -0
  54. package/dist/journal-ledger-index.test.js.map +1 -0
  55. package/dist/journal.d.ts +110 -0
  56. package/dist/journal.d.ts.map +1 -1
  57. package/dist/journal.js +253 -5
  58. package/dist/journal.js.map +1 -1
  59. package/dist/manifest/US-002.acceptance.test.d.ts +11 -0
  60. package/dist/manifest/US-002.acceptance.test.d.ts.map +1 -0
  61. package/dist/manifest/US-002.acceptance.test.js +160 -0
  62. package/dist/manifest/US-002.acceptance.test.js.map +1 -0
  63. package/dist/manifest/US-004.acceptance.test.d.ts +12 -0
  64. package/dist/manifest/US-004.acceptance.test.d.ts.map +1 -0
  65. package/dist/manifest/US-004.acceptance.test.js +173 -0
  66. package/dist/manifest/US-004.acceptance.test.js.map +1 -0
  67. package/dist/manifest/build-manifest.bench.test.d.ts +22 -0
  68. package/dist/manifest/build-manifest.bench.test.d.ts.map +1 -0
  69. package/dist/manifest/build-manifest.bench.test.js +544 -0
  70. package/dist/manifest/build-manifest.bench.test.js.map +1 -0
  71. package/dist/manifest/build-manifest.d.ts +319 -0
  72. package/dist/manifest/build-manifest.d.ts.map +1 -0
  73. package/dist/manifest/build-manifest.js +1043 -0
  74. package/dist/manifest/build-manifest.js.map +1 -0
  75. package/dist/manifest/build-manifest.test.d.ts +10 -0
  76. package/dist/manifest/build-manifest.test.d.ts.map +1 -0
  77. package/dist/manifest/build-manifest.test.js +1060 -0
  78. package/dist/manifest/build-manifest.test.js.map +1 -0
  79. package/dist/manifest/contract.d.ts +290 -0
  80. package/dist/manifest/contract.d.ts.map +1 -0
  81. package/dist/manifest/contract.js +476 -0
  82. package/dist/manifest/contract.js.map +1 -0
  83. package/dist/manifest/contract.test.d.ts +17 -0
  84. package/dist/manifest/contract.test.d.ts.map +1 -0
  85. package/dist/manifest/contract.test.js +283 -0
  86. package/dist/manifest/contract.test.js.map +1 -0
  87. package/dist/manifest/import-graph.test.d.ts +25 -0
  88. package/dist/manifest/import-graph.test.d.ts.map +1 -0
  89. package/dist/manifest/import-graph.test.js +120 -0
  90. package/dist/manifest/import-graph.test.js.map +1 -0
  91. package/dist/manifest/ledger-shard-isolation.test.d.ts +18 -0
  92. package/dist/manifest/ledger-shard-isolation.test.d.ts.map +1 -0
  93. package/dist/manifest/ledger-shard-isolation.test.js +153 -0
  94. package/dist/manifest/ledger-shard-isolation.test.js.map +1 -0
  95. package/dist/manifest/snapshot-store.d.ts +143 -0
  96. package/dist/manifest/snapshot-store.d.ts.map +1 -0
  97. package/dist/manifest/snapshot-store.js +291 -0
  98. package/dist/manifest/snapshot-store.js.map +1 -0
  99. package/dist/manifest/snapshot-store.test.d.ts +11 -0
  100. package/dist/manifest/snapshot-store.test.d.ts.map +1 -0
  101. package/dist/manifest/snapshot-store.test.js +133 -0
  102. package/dist/manifest/snapshot-store.test.js.map +1 -0
  103. package/dist/manifest/upload-manifest.d.ts +301 -0
  104. package/dist/manifest/upload-manifest.d.ts.map +1 -0
  105. package/dist/manifest/upload-manifest.js +921 -0
  106. package/dist/manifest/upload-manifest.js.map +1 -0
  107. package/dist/manifest/upload-manifest.test.d.ts +10 -0
  108. package/dist/manifest/upload-manifest.test.d.ts.map +1 -0
  109. package/dist/manifest/upload-manifest.test.js +1052 -0
  110. package/dist/manifest/upload-manifest.test.js.map +1 -0
  111. package/dist/manifest-reconcile.d.ts.map +1 -1
  112. package/dist/manifest-reconcile.js +1 -26
  113. package/dist/manifest-reconcile.js.map +1 -1
  114. package/dist/posix-key.d.ts +36 -0
  115. package/dist/posix-key.d.ts.map +1 -0
  116. package/dist/posix-key.js +38 -0
  117. package/dist/posix-key.js.map +1 -0
  118. package/dist/s3.d.ts +2 -18
  119. package/dist/s3.d.ts.map +1 -1
  120. package/dist/s3.js +6 -20
  121. package/dist/s3.js.map +1 -1
  122. package/dist/sync/journal-ledger-stream.d.ts +56 -0
  123. package/dist/sync/journal-ledger-stream.d.ts.map +1 -0
  124. package/dist/sync/journal-ledger-stream.js +191 -0
  125. package/dist/sync/journal-ledger-stream.js.map +1 -0
  126. package/dist/sync/journal-ledger-stream.test.d.ts +12 -0
  127. package/dist/sync/journal-ledger-stream.test.d.ts.map +1 -0
  128. package/dist/sync/journal-ledger-stream.test.js +134 -0
  129. package/dist/sync/journal-ledger-stream.test.js.map +1 -0
  130. package/dist/types.d.ts +18 -7
  131. package/dist/types.d.ts.map +1 -1
  132. package/package.json +2 -1
@@ -0,0 +1,544 @@
1
+ /**
2
+ * Stat-walk benchmark for the manifest builder (US-002).
3
+ *
4
+ * The acceptance bar is a cost bar, not a correctness one: a 70,000-file HQ
5
+ * root must be enumerable in under 2 seconds and under 64 MB of resident
6
+ * growth, because this runs in the background on a laptop that is also
7
+ * running the user's editor. A regression here does not break the audit — it
8
+ * makes the machine feel slow, which is the failure mode that gets the whole
9
+ * feature switched off.
10
+ *
11
+ * The measurement is deliberately narrow:
12
+ *
13
+ * - the fixture is built ONCE in `beforeAll` and excluded from the timing;
14
+ * - files are empty, so the numbers describe directory traversal + `lstat`,
15
+ * not disk throughput;
16
+ * - `hashPolicy: "ledger-only"` guarantees not a single byte of content is
17
+ * read, so sha256 throughput cannot mask a walk regression;
18
+ * - only `walkStats.walkMs` is asserted — the builder's own measurement of
19
+ * the walk, not the harness's view of the whole call.
20
+ */
21
+ import * as fs from "node:fs";
22
+ import * as os from "node:os";
23
+ import * as path from "node:path";
24
+ import * as v8 from "node:v8";
25
+ import * as vm from "node:vm";
26
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
27
+ import { buildSyncManifest } from "./build-manifest.js";
28
+ import { PERSONAL_VAULT_JOURNAL_SLUG } from "../journal.js";
29
+ import { runManifestUploadPass } from "./upload-manifest.js";
30
+ const FILE_COUNT = 70_000;
31
+ const DIRECTORY_COUNT = 700;
32
+ /**
33
+ * The cost bar: 2 seconds of walk for 70,000 files.
34
+ *
35
+ * Asserted unconditionally. This file does NOT run in `pnpm test` — it has its
36
+ * own config (`vitest.bench.config.ts`, `pnpm run bench:manifest`) that runs it
37
+ * alone in a single fork, and its own CI job, because a wall clock measured
38
+ * against ~150 concurrently-scheduled suites is not a measurement. The same
39
+ * code timed 1.3s alone, 1.6s in one full run and 3.3s in the next; isolating
40
+ * the run removes that spread rather than widening the budget to swallow it.
41
+ */
42
+ const MAX_WALK_MS = 2_000;
43
+ const MAX_RSS_GROWTH_BYTES = 64 * 1024 * 1024;
44
+ /**
45
+ * Cold-ledger hash benchmark: how much does the FIRST pass after an upgrade
46
+ * cost when the journal has no reusable hash for anything?
47
+ *
48
+ * This is the case that broke on a real machine. The personal vault held
49
+ * ~690k files, the journal predated hashing, and the then-default `auto`
50
+ * policy therefore READ every one of them: 9m40s and 2.9 GB peak RSS for a
51
+ * step that runs after every sync cycle. The stat walk is not the problem —
52
+ * opening files is.
53
+ *
54
+ * 5,000 files is enough to measure per-file open+read+digest cost honestly
55
+ * while keeping the fixture buildable in CI; the numbers are printed so the
56
+ * README can quote a measured figure rather than a guess.
57
+ */
58
+ const HASH_FILE_COUNT = 5_000;
59
+ const HASH_FILE_BYTES = 4 * 1024;
60
+ /**
61
+ * A real collection before each measurement. Vitest does not run workers with
62
+ * `--expose-gc`, so without this the delta reports whatever heap V8 happened
63
+ * to grab and never returned — noise that swamps the signal and makes the
64
+ * budget flaky in both directions. Falls back to `null` (no forced GC) if the
65
+ * runtime refuses, in which case the generous budget still holds.
66
+ */
67
+ function acquireGc() {
68
+ const existing = globalThis.gc;
69
+ if (typeof existing === "function")
70
+ return existing;
71
+ try {
72
+ v8.setFlagsFromString("--expose-gc");
73
+ const exposed = vm.runInNewContext("gc");
74
+ v8.setFlagsFromString("--no-expose-gc");
75
+ return typeof exposed === "function" ? exposed : null;
76
+ }
77
+ catch {
78
+ return null;
79
+ }
80
+ }
81
+ let base;
82
+ let hqRoot;
83
+ let stateDir;
84
+ describe("buildSyncManifest stat-walk benchmark", () => {
85
+ beforeAll(() => {
86
+ base = fs.mkdtempSync(path.join(os.tmpdir(), "hq-manifest-bench-"));
87
+ hqRoot = path.join(base, "hq");
88
+ stateDir = path.join(base, "state");
89
+ fs.mkdirSync(stateDir, { recursive: true });
90
+ // 700 directories x 100 files: wide enough that per-directory `readdir`
91
+ // overhead is represented, shallow enough to stay realistic for an HQ root.
92
+ const perDirectory = FILE_COUNT / DIRECTORY_COUNT;
93
+ for (let dirIndex = 0; dirIndex < DIRECTORY_COUNT; dirIndex++) {
94
+ const dir = path.join(hqRoot, "bench", `d${dirIndex}`);
95
+ fs.mkdirSync(dir, { recursive: true });
96
+ for (let fileIndex = 0; fileIndex < perDirectory; fileIndex++) {
97
+ fs.writeFileSync(path.join(dir, `f${fileIndex}.md`), "");
98
+ }
99
+ }
100
+ }, 300_000);
101
+ afterAll(() => {
102
+ fs.rmSync(base, { recursive: true, force: true });
103
+ });
104
+ it(`walks ${FILE_COUNT} files within budget`, async () => {
105
+ // A GC before the baseline (when the runner exposes one) keeps the delta
106
+ // from charging this walk for garbage the fixture build left behind.
107
+ const forceGc = acquireGc();
108
+ forceGc?.();
109
+ const rssBefore = process.memoryUsage().rss;
110
+ const result = await buildSyncManifest({
111
+ scope: { kind: "personal" },
112
+ hqRoot,
113
+ stateDir,
114
+ installationId: "install-bench",
115
+ machineId: "machine-bench",
116
+ source: "cli",
117
+ sequence: 1,
118
+ hashPolicy: "ledger-only",
119
+ listJournalsImpl: () => [],
120
+ // Well above the budget: the assertion below is what fails on a
121
+ // regression, not a truncated walk that would silently "pass" fast.
122
+ maxWallMs: 120_000,
123
+ persistSnapshot: false,
124
+ });
125
+ forceGc?.();
126
+ const rssAfter = process.memoryUsage().rss;
127
+ // Print the numbers so a CI run records the trend, not just pass/fail.
128
+ process.stdout.write(`manifest stat-walk: ${result.walkStats.walkMs}ms, ` +
129
+ `${((rssAfter - rssBefore) / (1024 * 1024)).toFixed(1)}MB RSS for ${FILE_COUNT} files\n`);
130
+ expect(result.walkStats.truncated).toBe(false);
131
+ expect(result.walkStats.filesWalked).toBe(FILE_COUNT);
132
+ expect(result.walkStats.hashedFiles).toBe(0);
133
+ expect(result.walkStats.walkMs).toBeLessThan(MAX_WALK_MS);
134
+ expect(rssAfter - rssBefore).toBeLessThan(MAX_RSS_GROWTH_BYTES);
135
+ }, 120_000);
136
+ });
137
+ /**
138
+ * The cost of a COLD ledger, and the guarantee that the default never pays it.
139
+ *
140
+ * Separate fixture from the stat-walk bench above: that one uses empty files
141
+ * (so it measures traversal), while this one needs real bytes to measure
142
+ * open + read + sha256.
143
+ */
144
+ describe("buildSyncManifest cold-ledger hash cost", () => {
145
+ let hashBase;
146
+ let hashRoot;
147
+ let hashStateDir;
148
+ beforeAll(() => {
149
+ hashBase = fs.mkdtempSync(path.join(os.tmpdir(), "hq-manifest-hash-bench-"));
150
+ hashRoot = path.join(hashBase, "hq");
151
+ hashStateDir = path.join(hashBase, "state");
152
+ fs.mkdirSync(hashStateDir, { recursive: true });
153
+ const body = "x".repeat(HASH_FILE_BYTES);
154
+ const perDirectory = 100;
155
+ for (let index = 0; index < HASH_FILE_COUNT; index += 1) {
156
+ const dir = path.join(hashRoot, "bench", `d${Math.floor(index / perDirectory)}`);
157
+ fs.mkdirSync(dir, { recursive: true });
158
+ fs.writeFileSync(path.join(dir, `f${index}.md`), body);
159
+ }
160
+ }, 300_000);
161
+ afterAll(() => {
162
+ fs.rmSync(hashBase, { recursive: true, force: true });
163
+ });
164
+ function optionsFor(overrides) {
165
+ return {
166
+ scope: { kind: "personal" },
167
+ hqRoot: hashRoot,
168
+ stateDir: hashStateDir,
169
+ installationId: "install-bench",
170
+ machineId: "machine-bench",
171
+ source: "cli",
172
+ sequence: 1,
173
+ listJournalsImpl: () => [],
174
+ maxWallMs: 600_000,
175
+ persistSnapshot: false,
176
+ ...overrides,
177
+ };
178
+ }
179
+ it(`measures the unbounded first-pass hash cost for ${HASH_FILE_COUNT} cold files`, async () => {
180
+ const forceGc = acquireGc();
181
+ forceGc?.();
182
+ const rssBefore = process.memoryUsage().rss;
183
+ const startedAt = Date.now();
184
+ const result = await buildSyncManifest(optionsFor({ hashPolicy: "full" }));
185
+ const elapsedMs = Date.now() - startedAt;
186
+ forceGc?.();
187
+ const rssGrowthMb = (process.memoryUsage().rss - rssBefore) / (1024 * 1024);
188
+ // Recorded, not asserted as a budget: this measures the path the default
189
+ // deliberately avoids, and its absolute cost varies wildly by disk. The
190
+ // README quotes these numbers.
191
+ process.stdout.write(`manifest cold-ledger hash (hashPolicy="full"): ${HASH_FILE_COUNT} files: ` +
192
+ `${elapsedMs}ms / ${rssGrowthMb.toFixed(1)}MB RSS ` +
193
+ `(${((HASH_FILE_COUNT * HASH_FILE_BYTES) / (1024 * 1024)).toFixed(1)}MB read)\n`);
194
+ expect(result.walkStats.hashedFiles).toBe(HASH_FILE_COUNT);
195
+ expect(result.walkStats.unhashedFiles).toBe(0);
196
+ }, 600_000);
197
+ it("the DEFAULT policy reads nothing at all on the same cold fixture", async () => {
198
+ // The guarantee the fix rests on. Every file is still REPORTED — the
199
+ // manifest is complete — it is just stat-only, so the first pass after an
200
+ // upgrade costs a walk instead of a full read of the vault.
201
+ const startedAt = Date.now();
202
+ const result = await buildSyncManifest(optionsFor({}));
203
+ const elapsedMs = Date.now() - startedAt;
204
+ process.stdout.write(`manifest cold-ledger stat-only (default): ${HASH_FILE_COUNT} files: ${elapsedMs}ms\n`);
205
+ expect(result.walkStats.hashedFiles).toBe(0);
206
+ expect(result.walkStats.unhashedFiles).toBe(HASH_FILE_COUNT);
207
+ expect(result.walkStats.filesWalked).toBe(HASH_FILE_COUNT);
208
+ expect(result.chunks.flatMap((chunk) => chunk.entries)).toHaveLength(HASH_FILE_COUNT);
209
+ }, 300_000);
210
+ it("`auto` spreads the cost across passes instead of paying it all at once", async () => {
211
+ const result = await buildSyncManifest(optionsFor({ hashPolicy: "auto", maxHashedFiles: 500, maxHashMs: 60_000 }));
212
+ expect(result.walkStats.hashedFiles).toBe(500);
213
+ expect(result.walkStats.unhashedFiles).toBe(HASH_FILE_COUNT - 500);
214
+ // Bounded, but never lossy: the scope is still fully described.
215
+ expect(result.chunks.flatMap((chunk) => chunk.entries)).toHaveLength(HASH_FILE_COUNT);
216
+ }, 300_000);
217
+ });
218
+ // ─────────────────────────────────────────────────────────────────────────────
219
+ // Ledger read cost (memory)
220
+ // ─────────────────────────────────────────────────────────────────────────────
221
+ /**
222
+ * The manifest tail step's memory footprint, measured on the shape that
223
+ * actually hurt: a vault whose JOURNAL is large.
224
+ *
225
+ * WHY THIS IS A GATE, NOT A REPORT
226
+ * --------------------------------
227
+ * On a real operator vault this step peaked at 1,112 MB of resident memory for
228
+ * a 199k-entry personal scope. It is a background audit that runs after every
229
+ * sync pass on a laptop that is also running the user's editor, so a gigabyte
230
+ * is not a slow audit — it is the reason a user switches the feature off.
231
+ *
232
+ * FOUR CAUSES, ALL IN THE LEDGER READ, NONE IN THE WALK
233
+ * -----------------------------------------------------
234
+ * Measured on a 200,000-file synthetic tree, the walk itself costs ~220 MB and
235
+ * the build's chunking and snapshot add ~10 MB. Everything else was spent
236
+ * before the walk statted its first file:
237
+ *
238
+ * 1. `listJournals()` read and parsed EVERY journal shard on the machine to
239
+ * keep the one that describes this scope, and did it again for every
240
+ * scope in a fanout. `readLedger` now reads one shard, and
241
+ * `ledger-shard-isolation.test.ts` counts the journal files opened so
242
+ * that cannot quietly become "all of them" again.
243
+ * 2. `readJournal()` deep-clones every journal it returns into the writer
244
+ * baseline WeakMap. A read-only caller pays double for a baseline it will
245
+ * never diff against. The read-only path skips it.
246
+ * 3. Reading that one shard still cost its file size TWICE — once as a UTF-8
247
+ * string, once as a parsed object graph — before a single row was looked
248
+ * at. `streamJournalLedgerRows` scans the document in 256 KB chunks and
249
+ * parses each row on its own instead, so the transient set is bounded by
250
+ * a chunk rather than by the vault.
251
+ * 4. The derived map retained the parsed `JournalEntry` objects, which pinned
252
+ * the whole parse result behind the index built FROM it. The index now
253
+ * holds a six-field projection with the repeated strings shared, so the
254
+ * parse is collectable the moment the read returns.
255
+ *
256
+ * (1) and (2) took a 200,000-FILE measurement from 1,113 MB to 599 MB. (3) and
257
+ * (4) took the ledger read on this fixture from 113.6 MB to 24 MB of resident
258
+ * growth, and the same 200,000-file measurement to ~437 MB peak — under the
259
+ * 500 MB bar this step has to clear to be worth leaving switched on.
260
+ *
261
+ * IN-PROCESS, NOT A CHILD WITH `--max-old-space-size`
262
+ * --------------------------------------------------
263
+ * A heap ceiling would fail the run with an OOM abort, which reports "the
264
+ * child died" rather than a number, and it bounds only V8's heap — while most
265
+ * of the regression showed up as resident growth outside it. This file already
266
+ * runs alone, in a single fork, on its own CI runner (see
267
+ * `vitest.bench.config.ts`), which is the isolation a memory measurement needs;
268
+ * sampling RSS there measures the thing the budget is actually about.
269
+ */
270
+ const LEDGER_ENTRY_COUNT = 200_000;
271
+ const LEDGER_COMPANY_COUNT = 4;
272
+ const LEDGER_COMPANY_ENTRY_COUNT = 50_000;
273
+ const LEDGER_DISK_FILE_COUNT = 2_000;
274
+ /**
275
+ * 30 MB of resident growth for this fixture — the measurement plus 20%.
276
+ *
277
+ * Measured: 24.1, 24.2 and 24.1 MB across three isolated runs, which is the
278
+ * spread this file's single-fork, own-CI-runner isolation buys. The previous
279
+ * budget was 260 MB against a 113.6 MB measurement, and headroom that wide
280
+ * stops being headroom: it would have absorbed every regression this gate
281
+ * names without anyone noticing. Re-reading every shard (`listJournals()`)
282
+ * puts this fixture back near 356 MB, materialising the shard whole puts it
283
+ * near 114 MB, and both are now loudly out of budget rather than comfortably
284
+ * inside it.
285
+ *
286
+ * If this trips on a slower or differently-sized CI runner, the honest fix is
287
+ * to re-measure and move the number WITH a note saying what it measured — not
288
+ * to widen it until it stops complaining.
289
+ *
290
+ * This fixture understates the whole-vault picture on purpose: it pairs a
291
+ * 200k-entry ledger with a 2,000-file tree, because the walk's own cost is
292
+ * already gated by the stat-walk bench above and does not need paying for
293
+ * twice. On a real 200k-FILE vault the same code measures ~437 MB peak.
294
+ */
295
+ const MAX_LEDGER_RSS_GROWTH_BYTES = 30 * 1024 * 1024;
296
+ describe("buildSyncManifest ledger read cost", () => {
297
+ let ledgerBase;
298
+ let ledgerRoot;
299
+ let ledgerStateDir;
300
+ let previousStateDir;
301
+ function writeLegacyJournal(stateDir, slug, entryCount) {
302
+ const files = {};
303
+ for (let index = 0; index < entryCount; index += 1) {
304
+ files[`ledger/d${Math.floor(index / 100)}/f${index}.md`] = {
305
+ hash: `sha256:${index.toString(16).padStart(64, "0")}`,
306
+ size: 1024 + index,
307
+ syncedAt: "2026-01-01T00:00:00.000Z",
308
+ direction: "up",
309
+ };
310
+ }
311
+ fs.writeFileSync(path.join(stateDir, `sync-journal.${slug}.json`), JSON.stringify({ version: "2", files, pulls: [] }), "utf8");
312
+ }
313
+ beforeAll(() => {
314
+ ledgerBase = fs.mkdtempSync(path.join(os.tmpdir(), "hq-manifest-ledger-bench-"));
315
+ ledgerRoot = path.join(ledgerBase, "hq");
316
+ ledgerStateDir = path.join(ledgerBase, "state");
317
+ fs.mkdirSync(ledgerStateDir, { recursive: true });
318
+ // The journal reader resolves its own state dir from the environment, so
319
+ // the fixture has to own it for the duration of this suite. Without this
320
+ // the bench would read the DEVELOPER'S real journals — which is how the
321
+ // original 1.1 GB measurement was first reproduced, and is not something a
322
+ // CI budget can be built on.
323
+ previousStateDir = process.env.HQ_STATE_DIR;
324
+ process.env.HQ_STATE_DIR = ledgerStateDir;
325
+ writeLegacyJournal(ledgerStateDir, PERSONAL_VAULT_JOURNAL_SLUG, LEDGER_ENTRY_COUNT);
326
+ // The other shards exist only to be NOT read. Before the fix they were
327
+ // parsed on every build, for every scope.
328
+ for (let index = 0; index < LEDGER_COMPANY_COUNT; index += 1) {
329
+ writeLegacyJournal(ledgerStateDir, `company-${index}`, LEDGER_COMPANY_ENTRY_COUNT);
330
+ }
331
+ const perDirectory = 100;
332
+ for (let index = 0; index < LEDGER_DISK_FILE_COUNT; index += 1) {
333
+ const dir = path.join(ledgerRoot, "ledger", `d${Math.floor(index / perDirectory)}`);
334
+ fs.mkdirSync(dir, { recursive: true });
335
+ fs.writeFileSync(path.join(dir, `f${index}.md`), "");
336
+ }
337
+ }, 600_000);
338
+ afterAll(() => {
339
+ if (previousStateDir === undefined)
340
+ delete process.env.HQ_STATE_DIR;
341
+ else
342
+ process.env.HQ_STATE_DIR = previousStateDir;
343
+ fs.rmSync(ledgerBase, { recursive: true, force: true });
344
+ });
345
+ it(`builds a ${LEDGER_ENTRY_COUNT}-entry ledger scope within the memory budget`, async () => {
346
+ const forceGc = acquireGc();
347
+ forceGc?.();
348
+ const rssBefore = process.memoryUsage().rss;
349
+ let peakRss = rssBefore;
350
+ const sampler = setInterval(() => {
351
+ peakRss = Math.max(peakRss, process.memoryUsage().rss);
352
+ }, 20);
353
+ let result;
354
+ try {
355
+ result = await buildSyncManifest({
356
+ scope: { kind: "personal" },
357
+ hqRoot: ledgerRoot,
358
+ stateDir: ledgerStateDir,
359
+ installationId: "install-bench",
360
+ machineId: "machine-bench",
361
+ source: "cli",
362
+ sequence: 1,
363
+ hashPolicy: "never",
364
+ // Deliberately NOT stubbed: reading the ledger off disk is the thing
365
+ // being measured.
366
+ maxWallMs: 600_000,
367
+ persistSnapshot: false,
368
+ });
369
+ }
370
+ finally {
371
+ clearInterval(sampler);
372
+ }
373
+ const peakGrowth = peakRss - rssBefore;
374
+ process.stdout.write(`manifest ledger read: ${LEDGER_ENTRY_COUNT} ledger entries + ` +
375
+ `${LEDGER_COMPANY_COUNT * LEDGER_COMPANY_ENTRY_COUNT} entries in other shards, ` +
376
+ `${LEDGER_DISK_FILE_COUNT} files on disk: ` +
377
+ `${(peakGrowth / (1024 * 1024)).toFixed(1)}MB peak RSS growth\n`);
378
+ // The scope is fully described — the budget is never met by reporting less.
379
+ expect(result.walkStats.truncated).toBe(false);
380
+ expect(result.walkStats.filesWalked).toBe(LEDGER_DISK_FILE_COUNT);
381
+ const reported = result.chunks.flatMap((chunk) => chunk.entries);
382
+ expect(reported.length).toBe(LEDGER_ENTRY_COUNT);
383
+ expect(reported.filter((entry) => entry.source === "ledger").length).toBe(LEDGER_ENTRY_COUNT - LEDGER_DISK_FILE_COUNT);
384
+ expect(peakGrowth).toBeLessThan(MAX_LEDGER_RSS_GROWTH_BYTES);
385
+ }, 600_000);
386
+ });
387
+ /**
388
+ * Upload-pass memory benchmark: 200,000 entries, streamed.
389
+ *
390
+ * WHAT THIS GATES
391
+ * ---------------
392
+ * The upload half of the pass must stay inside the same 500 MB bar the build
393
+ * half does — below it the audit is worth leaving switched on beside a user's
394
+ * editor, above it the honest answer is to switch it off. The pass now mints
395
+ * one `SyncManifestUpload` at a time from a `ManifestChunkPlan` instead of
396
+ * materialising the whole chunk set before the first POST, and serialises the
397
+ * local snapshot incrementally instead of through one `JSON.stringify` of
398
+ * every entry. `peakLiveChunks` is asserted alongside the budget because it is
399
+ * the STRUCTURAL property the budget rests on: a future edit that collects the
400
+ * chunks again would still fit this fixture long before it fits a real vault.
401
+ *
402
+ * WHAT THIS DOES NOT CLAIM
403
+ * ------------------------
404
+ * Measured honestly, on this fixture and on a 200,000-FILE variant of it, the
405
+ * streaming change does not move peak RSS: ~348 MB before and after. It should
406
+ * not be quoted as the fix for the 642 MB seen on the operator's real 199k
407
+ * scope. A chunk's `entries` is a `slice` — 200,000 POINTERS, ~1.6 MB — not a
408
+ * copy of the entries, so the chunk set was never the term that dominates.
409
+ * What does dominate is inherent to a single-pass build: the walk's records,
410
+ * the entry objects, and the snapshot map, each O(entries) and each live at
411
+ * once because the delta decision needs the whole set before the first chunk
412
+ * can be sized. Cutting THAT needs a two-pass build, which is a separate
413
+ * change; this gate exists so the upload half cannot quietly re-add a copy on
414
+ * top of it.
415
+ *
416
+ * WHY IT MEASURES THE UPLOAD PASS AND NOT THE BUILDER
417
+ * --------------------------------------------------
418
+ * The builder alone never sees the chunk set — that is the point of the plan
419
+ * being lazy — so benchmarking `buildSyncManifest` would report a number this
420
+ * regression cannot move.
421
+ */
422
+ const STREAM_ENTRY_COUNT = 200_000;
423
+ const STREAM_DISK_FILE_COUNT = 2_000;
424
+ /**
425
+ * 500 MB of peak HEAP growth for a 200,000-entry upload pass.
426
+ *
427
+ * The product bar, not a measurement plus headroom. Measured at ~90 MB on this
428
+ * fixture across runs, so the gate is loose today — deliberately: it is the
429
+ * BUDGET this step has to live inside, and tightening it to the current
430
+ * measurement would fail the next legitimate entry-shape change rather than
431
+ * the next regression. `peakLiveChunks` is the tight assertion here.
432
+ */
433
+ const MAX_STREAM_HEAP_GROWTH_BYTES = 500 * 1024 * 1024;
434
+ describe("runManifestUploadPass streaming cost", () => {
435
+ let streamBase;
436
+ let streamRoot;
437
+ let streamStateDir;
438
+ let previousStateDir;
439
+ beforeAll(() => {
440
+ streamBase = fs.mkdtempSync(path.join(os.tmpdir(), "hq-manifest-stream-bench-"));
441
+ streamRoot = path.join(streamBase, "hq");
442
+ streamStateDir = path.join(streamBase, "state");
443
+ fs.mkdirSync(streamStateDir, { recursive: true });
444
+ previousStateDir = process.env.HQ_STATE_DIR;
445
+ process.env.HQ_STATE_DIR = streamStateDir;
446
+ const files = {};
447
+ for (let index = 0; index < STREAM_ENTRY_COUNT; index += 1) {
448
+ files[`ledger/d${Math.floor(index / 100)}/f${index}.md`] = {
449
+ hash: `sha256:${index.toString(16).padStart(64, "0")}`,
450
+ size: 1024 + index,
451
+ mtimeMs: 1_700_000_000_000 + index,
452
+ syncedAt: "2026-01-01T00:00:00.000Z",
453
+ direction: "up",
454
+ };
455
+ }
456
+ fs.writeFileSync(path.join(streamStateDir, `sync-journal.${PERSONAL_VAULT_JOURNAL_SLUG}.json`), JSON.stringify({ version: "2", lastSync: "", files, pulls: [] }), "utf8");
457
+ for (let index = 0; index < STREAM_DISK_FILE_COUNT; index += 1) {
458
+ const dir = path.join(streamRoot, "ledger", `d${Math.floor(index / 100)}`);
459
+ fs.mkdirSync(dir, { recursive: true });
460
+ fs.writeFileSync(path.join(dir, `f${index}.md`), "");
461
+ }
462
+ }, 600_000);
463
+ afterAll(() => {
464
+ if (previousStateDir === undefined)
465
+ delete process.env.HQ_STATE_DIR;
466
+ else
467
+ process.env.HQ_STATE_DIR = previousStateDir;
468
+ fs.rmSync(streamBase, { recursive: true, force: true });
469
+ });
470
+ it(`streams a ${STREAM_ENTRY_COUNT}-entry pass within the memory budget`, async () => {
471
+ const forceGc = acquireGc();
472
+ forceGc?.();
473
+ // HEAP, not RSS, for this one. The other benches in this file run first
474
+ // and leave the process holding hundreds of megabytes of resident pages
475
+ // that the allocator happily REUSES, so resident *growth* reads near zero
476
+ // whether the chunk set is streamed or materialised — it measures the page
477
+ // cache, not the code. `heapUsed` is what the duplicate chunk set actually
478
+ // consumed, and it is what a forced GC can honestly re-baseline.
479
+ const heapBefore = process.memoryUsage().heapUsed;
480
+ const rssBefore = process.memoryUsage().rss;
481
+ let peakHeap = heapBefore;
482
+ let peakRss = rssBefore;
483
+ const sampler = setInterval(() => {
484
+ const usage = process.memoryUsage();
485
+ peakHeap = Math.max(peakHeap, usage.heapUsed);
486
+ peakRss = Math.max(peakRss, usage.rss);
487
+ }, 20);
488
+ let liveChunks = 0;
489
+ let peakLiveChunks = 0;
490
+ let sentChunks = 0;
491
+ let sentEntries = 0;
492
+ let result;
493
+ try {
494
+ result = await runManifestUploadPass({
495
+ scope: { kind: "personal" },
496
+ hqRoot: streamRoot,
497
+ stateDir: streamStateDir,
498
+ installationId: "install-bench",
499
+ machineId: "machine-bench",
500
+ source: "cli",
501
+ hashPolicy: "never",
502
+ maxWallMs: 600_000,
503
+ uploadWallMs: 600_000,
504
+ env: {},
505
+ transport: async (chunk) => {
506
+ // Serialise exactly as a real transport would: the JSON of the chunk
507
+ // in flight is part of the peak this budget covers.
508
+ liveChunks += 1;
509
+ peakLiveChunks = Math.max(peakLiveChunks, liveChunks);
510
+ sentEntries += chunk.entries.length;
511
+ sentChunks += 1;
512
+ const body = JSON.stringify(chunk);
513
+ if (body.length === 0)
514
+ throw new Error("empty chunk body");
515
+ liveChunks -= 1;
516
+ return {
517
+ status: 200,
518
+ body: {
519
+ status: "accepted",
520
+ snapshotId: "0123456789abcdef0123456789abcdef",
521
+ completed: sentChunks === chunk.chunkCount,
522
+ materialised: sentChunks === chunk.chunkCount,
523
+ },
524
+ };
525
+ },
526
+ });
527
+ }
528
+ finally {
529
+ clearInterval(sampler);
530
+ }
531
+ const peakHeapGrowth = peakHeap - heapBefore;
532
+ process.stdout.write(`manifest upload stream: ${STREAM_ENTRY_COUNT} entries in ${sentChunks} chunk(s): ` +
533
+ `${(peakHeapGrowth / (1024 * 1024)).toFixed(1)}MB peak heap growth, ` +
534
+ `${((peakRss - rssBefore) / (1024 * 1024)).toFixed(1)}MB peak RSS growth\n`);
535
+ // The budget is never met by reporting less: the whole scope went out.
536
+ expect(result.status).toBe("uploaded");
537
+ expect(sentEntries).toBe(STREAM_ENTRY_COUNT);
538
+ expect(sentChunks).toBeGreaterThan(1);
539
+ // One chunk alive at a time — the property the budget actually rests on.
540
+ expect(peakLiveChunks).toBe(1);
541
+ expect(peakHeapGrowth).toBeLessThan(MAX_STREAM_HEAP_GROWTH_BYTES);
542
+ }, 600_000);
543
+ });
544
+ //# sourceMappingURL=build-manifest.bench.test.js.map
@@ -0,0 +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