@indigoai-us/hq-cloud 6.16.20 → 6.16.22

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 (110) 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 +55 -0
  14. package/dist/bin/sync-runner.d.ts.map +1 -1
  15. package/dist/bin/sync-runner.js +69 -0
  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/company-slug.d.ts +31 -0
  20. package/dist/company-slug.d.ts.map +1 -0
  21. package/dist/company-slug.js +52 -0
  22. package/dist/company-slug.js.map +1 -0
  23. package/dist/company-slug.test.d.ts +7 -0
  24. package/dist/company-slug.test.d.ts.map +1 -0
  25. package/dist/company-slug.test.js +43 -0
  26. package/dist/company-slug.test.js.map +1 -0
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +5 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/journal-ledger-index.test.d.ts +15 -0
  32. package/dist/journal-ledger-index.test.d.ts.map +1 -0
  33. package/dist/journal-ledger-index.test.js +247 -0
  34. package/dist/journal-ledger-index.test.js.map +1 -0
  35. package/dist/journal.d.ts +110 -0
  36. package/dist/journal.d.ts.map +1 -1
  37. package/dist/journal.js +253 -5
  38. package/dist/journal.js.map +1 -1
  39. package/dist/manifest/US-002.acceptance.test.d.ts +11 -0
  40. package/dist/manifest/US-002.acceptance.test.d.ts.map +1 -0
  41. package/dist/manifest/US-002.acceptance.test.js +160 -0
  42. package/dist/manifest/US-002.acceptance.test.js.map +1 -0
  43. package/dist/manifest/US-004.acceptance.test.d.ts +12 -0
  44. package/dist/manifest/US-004.acceptance.test.d.ts.map +1 -0
  45. package/dist/manifest/US-004.acceptance.test.js +173 -0
  46. package/dist/manifest/US-004.acceptance.test.js.map +1 -0
  47. package/dist/manifest/build-manifest.bench.test.d.ts +22 -0
  48. package/dist/manifest/build-manifest.bench.test.d.ts.map +1 -0
  49. package/dist/manifest/build-manifest.bench.test.js +563 -0
  50. package/dist/manifest/build-manifest.bench.test.js.map +1 -0
  51. package/dist/manifest/build-manifest.d.ts +355 -0
  52. package/dist/manifest/build-manifest.d.ts.map +1 -0
  53. package/dist/manifest/build-manifest.js +1139 -0
  54. package/dist/manifest/build-manifest.js.map +1 -0
  55. package/dist/manifest/build-manifest.test.d.ts +10 -0
  56. package/dist/manifest/build-manifest.test.d.ts.map +1 -0
  57. package/dist/manifest/build-manifest.test.js +1172 -0
  58. package/dist/manifest/build-manifest.test.js.map +1 -0
  59. package/dist/manifest/contract.d.ts +356 -0
  60. package/dist/manifest/contract.d.ts.map +1 -0
  61. package/dist/manifest/contract.js +542 -0
  62. package/dist/manifest/contract.js.map +1 -0
  63. package/dist/manifest/contract.test.d.ts +17 -0
  64. package/dist/manifest/contract.test.d.ts.map +1 -0
  65. package/dist/manifest/contract.test.js +304 -0
  66. package/dist/manifest/contract.test.js.map +1 -0
  67. package/dist/manifest/import-graph.test.d.ts +25 -0
  68. package/dist/manifest/import-graph.test.d.ts.map +1 -0
  69. package/dist/manifest/import-graph.test.js +120 -0
  70. package/dist/manifest/import-graph.test.js.map +1 -0
  71. package/dist/manifest/ledger-shard-isolation.test.d.ts +18 -0
  72. package/dist/manifest/ledger-shard-isolation.test.d.ts.map +1 -0
  73. package/dist/manifest/ledger-shard-isolation.test.js +153 -0
  74. package/dist/manifest/ledger-shard-isolation.test.js.map +1 -0
  75. package/dist/manifest/snapshot-store.d.ts +160 -0
  76. package/dist/manifest/snapshot-store.d.ts.map +1 -0
  77. package/dist/manifest/snapshot-store.js +300 -0
  78. package/dist/manifest/snapshot-store.js.map +1 -0
  79. package/dist/manifest/snapshot-store.test.d.ts +11 -0
  80. package/dist/manifest/snapshot-store.test.d.ts.map +1 -0
  81. package/dist/manifest/snapshot-store.test.js +133 -0
  82. package/dist/manifest/snapshot-store.test.js.map +1 -0
  83. package/dist/manifest/upload-manifest.d.ts +336 -0
  84. package/dist/manifest/upload-manifest.d.ts.map +1 -0
  85. package/dist/manifest/upload-manifest.js +1022 -0
  86. package/dist/manifest/upload-manifest.js.map +1 -0
  87. package/dist/manifest/upload-manifest.test.d.ts +10 -0
  88. package/dist/manifest/upload-manifest.test.d.ts.map +1 -0
  89. package/dist/manifest/upload-manifest.test.js +1116 -0
  90. package/dist/manifest/upload-manifest.test.js.map +1 -0
  91. package/dist/manifest-reconcile.d.ts.map +1 -1
  92. package/dist/manifest-reconcile.js +1 -26
  93. package/dist/manifest-reconcile.js.map +1 -1
  94. package/dist/posix-key.d.ts +36 -0
  95. package/dist/posix-key.d.ts.map +1 -0
  96. package/dist/posix-key.js +38 -0
  97. package/dist/posix-key.js.map +1 -0
  98. package/dist/s3.d.ts +2 -18
  99. package/dist/s3.d.ts.map +1 -1
  100. package/dist/s3.js +6 -20
  101. package/dist/s3.js.map +1 -1
  102. package/dist/sync/journal-ledger-stream.d.ts +56 -0
  103. package/dist/sync/journal-ledger-stream.d.ts.map +1 -0
  104. package/dist/sync/journal-ledger-stream.js +191 -0
  105. package/dist/sync/journal-ledger-stream.js.map +1 -0
  106. package/dist/sync/journal-ledger-stream.test.d.ts +12 -0
  107. package/dist/sync/journal-ledger-stream.test.d.ts.map +1 -0
  108. package/dist/sync/journal-ledger-stream.test.js +134 -0
  109. package/dist/sync/journal-ledger-stream.test.js.map +1 -0
  110. package/package.json +2 -1
@@ -0,0 +1,542 @@
1
+ /**
2
+ * Sync manifest wire contract (sync-reconciliation-audit US-001) — CLIENT MIRROR.
3
+ *
4
+ * ONE versioned contract, mirrored type-identically in two repos:
5
+ *
6
+ * - hq-pro src/sync/server/sync-manifest-contract.ts (reference)
7
+ * - hq-cloud src/manifest/contract.ts (this file)
8
+ *
9
+ * This file is a deliberate copy, NOT an import: hq-cloud ships to end-user
10
+ * machines and must never depend on the server repo. Drift is caught by
11
+ * {@link SYNC_MANIFEST_CONTRACT_DESCRIPTOR}, which both repos assert against
12
+ * the byte-identical `test/fixtures/sync-manifest-contract/descriptor.json`
13
+ * snapshot — a renamed field or a changed bound breaks a test in BOTH repos.
14
+ *
15
+ * Everything below this header must stay byte-identical with the hq-pro file.
16
+ *
17
+ * Design rules (modeled on hq-pro `client-health-contract.ts`):
18
+ *
19
+ * - Closed enums as `as const` arrays; a typed
20
+ * {@link SyncManifestContractError} on every rejection.
21
+ * - FAIL CLOSED on values, TOLERANT of unknown extra fields.
22
+ * - Identity comes from AUTH, not the body: `personUid` is deliberately not
23
+ * a field, and supplying one is rejected outright.
24
+ * - Bounded by construction (see {@link SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK}).
25
+ * - {@link hasControlCharacters} is kept in lock-step with the predicate of
26
+ * the same name in `src/ignore.ts` (asserted by this repo's mirror test).
27
+ */
28
+ // ─── Contract version ────────────────────────────────────────────────────────
29
+ /**
30
+ * Bump ONLY for a wire-visible change. Both repos pin the same integer and the
31
+ * mirrored descriptor snapshot (`sync-manifest-contract-descriptor.json`)
32
+ * fails in BOTH repos when they drift.
33
+ */
34
+ export const SYNC_MANIFEST_CONTRACT_VERSION = 1;
35
+ // ─── Closed enums ────────────────────────────────────────────────────────────
36
+ /** Which vault a manifest describes. `company` additionally carries `companyUid`. */
37
+ export const SYNC_MANIFEST_SCOPE_KINDS = ["personal", "company"];
38
+ /** Which client produced the manifest. Same split as the client-health contract. */
39
+ export const SYNC_MANIFEST_SOURCES = ["desktop", "cli"];
40
+ /**
41
+ * `full` = the manifest enumerates the whole scope as of `generatedAt`.
42
+ * `delta` = it enumerates only what changed since `baseSnapshotId`, and
43
+ * `removedPaths` is meaningful.
44
+ */
45
+ export const SYNC_MANIFEST_MODES = ["full", "delta"];
46
+ /**
47
+ * Where the client learned about an entry.
48
+ *
49
+ * - `ledger` — present in the v3 journal projection but NOT on disk.
50
+ * - `disk` — found by the walk but the journal has no entry for it.
51
+ * - `both` — the healthy case: journal entry and disk file agree.
52
+ *
53
+ * The three values are what makes a wedged daemon detectable server-side: a
54
+ * scope whose entries are overwhelmingly `disk` means the journal stopped
55
+ * tracking; entries that are `ledger`-only mean the local copy vanished.
56
+ */
57
+ export const SYNC_MANIFEST_ENTRY_SOURCES = ["ledger", "disk", "both"];
58
+ /** Journal `direction`: `up` = pushed / locally authored, `down` = pulled. */
59
+ export const SYNC_MANIFEST_LEDGER_DIRECTIONS = ["up", "down"];
60
+ // ─── Bounds ──────────────────────────────────────────────────────────────────
61
+ /**
62
+ * Hard cap on entries in ONE chunk. A client with more files splits across
63
+ * `chunkIndex`/`chunkCount`; 50,001 in a single chunk is a contract violation
64
+ * ({@link SYNC_MANIFEST_BOUNDED_SIZE_REASON_CODE}), never a silent truncation.
65
+ */
66
+ export const SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK = 50_000;
67
+ export const SYNC_MANIFEST_MAX_REMOVED_PATHS_PER_CHUNK = 50_000;
68
+ export const SYNC_MANIFEST_MAX_PATH_LENGTH = 1024;
69
+ /** Merged client ignore-rule list (DEFAULT_IGNORES + .gitignore + .hqignore/.hqsyncignore + .hqinclude). */
70
+ export const SYNC_MANIFEST_MAX_IGNORE_RULES = 2000;
71
+ export const SYNC_MANIFEST_MAX_IGNORE_RULE_LENGTH = 1024;
72
+ export const SYNC_MANIFEST_MAX_ID_LENGTH = 64;
73
+ export const SYNC_MANIFEST_MAX_CHUNK_COUNT = 10_000;
74
+ /**
75
+ * Hard cap the SERVER enforces on one chunk's raw request body, measured as
76
+ * `Buffer.byteLength(rawBody, "utf8")` before `JSON.parse`. Mirrored from
77
+ * hq-pro `sync-manifest-store.ts`, which imports this constant rather than
78
+ * declaring its own — one number, one source of truth, asserted by the
79
+ * descriptor snapshot in BOTH repos.
80
+ *
81
+ * WHY A BYTE BOUND EXISTS AT ALL, NEXT TO THE ENTRY BOUND
82
+ * ------------------------------------------------------
83
+ * {@link SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK} bounds the COUNT, not the size,
84
+ * and an entry is not a fixed-width record: its `path` alone may be up to
85
+ * {@link SYNC_MANIFEST_MAX_PATH_LENGTH} bytes. 50,000 entries is therefore
86
+ * anywhere from ~4 MiB to ~55 MiB of JSON, so a count-only bound bounds
87
+ * nothing that a transport cares about.
88
+ *
89
+ * This is what @indigoai-us/hq-cloud 6.16.21 shipped without: a 199,394-entry
90
+ * personal scope planned four count-sized chunks of 15.9-17.9 MiB and API
91
+ * Gateway refused chunk 0 with a 413 long before this handler ran (the HTTP
92
+ * API's own payload ceiling is 10 MB, and it answers with an opaque gateway
93
+ * error rather than a reason code).
94
+ */
95
+ export const SYNC_MANIFEST_MAX_CHUNK_BYTES = 5 * 1024 * 1024;
96
+ /**
97
+ * The budget a CLIENT plans against — deliberately below
98
+ * {@link SYNC_MANIFEST_MAX_CHUNK_BYTES}, which is the server's REJECTION line.
99
+ *
100
+ * The gap is margin, and it is margin for things the planner cannot see. The
101
+ * planner measures the JSON body it hands the transport; what the gateway
102
+ * counts is whatever that transport actually puts on the wire, plus headers.
103
+ * hq-cloud does not compress — {@link ManifestUploadTransport} is injected by
104
+ * hq-sync/hq-cli and hq-cloud never sets `Content-Encoding` — so today the
105
+ * planned bytes ARE the counted bytes. That is exactly the kind of fact that
106
+ * changes without this file being touched (a transport that gains gzip, a
107
+ * proxy that re-encodes, a Lambda proxy integration that base64-inflates a
108
+ * body it decides is binary and multiplies it by 4/3), so the client aims a
109
+ * full MiB below the server's line and 6 MiB below the gateway's.
110
+ *
111
+ * A client that guesses wrong is not stuck: a 413 halves this budget for the
112
+ * next pass (see `MANIFEST_CHUNK_BYTE_BUDGET_FLOOR` in `upload-manifest.ts`).
113
+ */
114
+ export const SYNC_MANIFEST_DEFAULT_CHUNK_BYTE_BUDGET = 4 * 1024 * 1024;
115
+ /**
116
+ * Machine-matchable reason code the server returns with a 413 for a chunk
117
+ * whose raw body exceeded {@link SYNC_MANIFEST_MAX_CHUNK_BYTES}.
118
+ *
119
+ * A CLIENT-side configuration fault, not a server answer about the scope:
120
+ * the same manifest planned with a smaller budget succeeds. The upload pass
121
+ * classifies it accordingly (failure backoff + a halved budget), which is the
122
+ * distinction 6.16.21 got wrong — it armed the 24h throttle on this and hid
123
+ * the fault for a day per attempt.
124
+ */
125
+ export const SYNC_MANIFEST_CHUNK_TOO_LARGE_REASON_CODE = "chunk_too_large";
126
+ /**
127
+ * Machine-matchable reason code the server returns with a 413 when the FOLDED
128
+ * view for a scope would exceed its total-entry ceiling.
129
+ *
130
+ * Shares a status code with {@link SYNC_MANIFEST_CHUNK_TOO_LARGE_REASON_CODE}
131
+ * and nothing else. This one is a statement about the SCOPE — re-sending it at
132
+ * any chunk size gets the same answer — so a client must not treat it as a
133
+ * sizing fault to be retried smaller.
134
+ */
135
+ export const SYNC_MANIFEST_TOO_LARGE_REASON_CODE = "manifest_too_large";
136
+ /** 1 TiB — larger than any syncable object; a bigger value is a bug, not a file. */
137
+ export const SYNC_MANIFEST_MAX_FILE_SIZE_BYTES = 1_099_511_627_776;
138
+ /** 2100-01-01T00:00:00Z. Guards against overflowed/garbage mtimes. */
139
+ export const SYNC_MANIFEST_MAX_MTIME_MS = 4_102_444_800_000;
140
+ export const SYNC_MANIFEST_MAX_ETAG_LENGTH = 128;
141
+ export const SYNC_MANIFEST_MAX_ERROR_CLASS_LENGTH = 64;
142
+ export const SYNC_MANIFEST_MAX_WALK_STAT = 100_000_000;
143
+ /**
144
+ * Ceiling on a CLAIMED `contractVersion`. Anything above this is garbage, not
145
+ * a future client; anything in `1..this` that we do not implement reports
146
+ * {@link SyncManifestContractErrorCode} `UNSUPPORTED_CONTRACT_VERSION` so a
147
+ * newer client can tell "upgrade the server" apart from "your value is junk".
148
+ */
149
+ export const SYNC_MANIFEST_MAX_CONTRACT_VERSION = 1000;
150
+ /**
151
+ * The single reason code a bounded-size rejection reports. Callers match on
152
+ * this rather than on prose, so the 50,001-entry case is machine-classifiable.
153
+ */
154
+ export const SYNC_MANIFEST_BOUNDED_SIZE_REASON_CODE = "BOUNDED_SIZE_EXCEEDED";
155
+ export const SYNC_MANIFEST_CONTRACT_ERROR_CODES = [
156
+ "MISSING_FIELD",
157
+ "INVALID_TYPE",
158
+ "UNKNOWN_ENUM_VALUE",
159
+ "UNSAFE_VALUE",
160
+ "OUT_OF_BOUNDS",
161
+ "BOUNDED_SIZE_EXCEEDED",
162
+ "UNSUPPORTED_CONTRACT_VERSION",
163
+ ];
164
+ export class SyncManifestContractError extends Error {
165
+ code;
166
+ field;
167
+ constructor(code, field, detail) {
168
+ super(`sync-manifest contract violation [${code}] at ${field}${detail ? `: ${detail}` : ""}`);
169
+ this.name = "SyncManifestContractError";
170
+ this.code = code;
171
+ this.field = field;
172
+ }
173
+ }
174
+ // ─── Value validators (fail closed) ──────────────────────────────────────────
175
+ const IDENTIFIER = /^[A-Za-z0-9][A-Za-z0-9_.:-]{1,63}$/;
176
+ const SHA256_HEX = /^[0-9a-f]{64}$/;
177
+ const ERROR_CLASS = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
178
+ const ISO_UTC = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/;
179
+ /**
180
+ * True when `value` contains a character the vault key validator rejects (C0
181
+ * controls plus DEL). Kept byte-for-byte in lock-step with hq-cloud
182
+ * `hasControlCharacters` in `src/ignore.ts`: a path this returns `true` for
183
+ * can never be stored, so accepting it into a manifest only manufactures a
184
+ * guaranteed per-file failure downstream.
185
+ */
186
+ export function hasControlCharacters(value) {
187
+ // eslint-disable-next-line no-control-regex
188
+ return /[\x00-\x1F\x7F]/.test(value);
189
+ }
190
+ /**
191
+ * True when `value` contains an UNPAIRED surrogate code unit. Such a string
192
+ * has no valid UTF-8 encoding, so it can never become a vault key — accepting
193
+ * it into a manifest only manufactures a guaranteed per-file failure later.
194
+ */
195
+ export function hasLoneSurrogate(value) {
196
+ return /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/.test(value);
197
+ }
198
+ /**
199
+ * True when `value` contains a bidi override or a Unicode line separator.
200
+ * These render a path as something other than what it addresses (U+202E turns
201
+ * `report.fdp.md` into a visual `report.md.pdf`) and break line-oriented
202
+ * ignore-rule handling, so they fail closed alongside control characters.
203
+ */
204
+ export function hasBidiOrLineSeparator(value) {
205
+ return /[\u200E\u200F\u202A-\u202E\u2066-\u2069\u2028\u2029]/.test(value);
206
+ }
207
+ function asRecord(field, value) {
208
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
209
+ throw new SyncManifestContractError("INVALID_TYPE", field, "expected object");
210
+ }
211
+ return value;
212
+ }
213
+ function assertString(field, value, maxLength) {
214
+ if (value === undefined || value === null)
215
+ throw new SyncManifestContractError("MISSING_FIELD", field);
216
+ if (typeof value !== "string")
217
+ throw new SyncManifestContractError("INVALID_TYPE", field, "expected string");
218
+ if (value.length === 0 || value.length > maxLength) {
219
+ throw new SyncManifestContractError("OUT_OF_BOUNDS", field, `length must be 1..${maxLength}`);
220
+ }
221
+ if (hasControlCharacters(value)) {
222
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "control characters are not permitted");
223
+ }
224
+ if (hasLoneSurrogate(value)) {
225
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "unpaired surrogate is not encodable");
226
+ }
227
+ if (hasBidiOrLineSeparator(value)) {
228
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "bidi or line-separator characters are not permitted");
229
+ }
230
+ return value;
231
+ }
232
+ function assertIdentifier(field, value) {
233
+ const safe = assertString(field, value, SYNC_MANIFEST_MAX_ID_LENGTH);
234
+ if (!IDENTIFIER.test(safe)) {
235
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "expected an opaque identifier");
236
+ }
237
+ return safe;
238
+ }
239
+ function assertIsoUtc(field, value) {
240
+ const safe = assertString(field, value, SYNC_MANIFEST_MAX_ID_LENGTH);
241
+ if (!ISO_UTC.test(safe) || !Number.isFinite(Date.parse(safe))) {
242
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "expected ISO-8601 UTC timestamp");
243
+ }
244
+ return safe;
245
+ }
246
+ function assertEnum(field, value, allowed) {
247
+ const safe = assertString(field, value, SYNC_MANIFEST_MAX_ID_LENGTH);
248
+ if (!allowed.includes(safe)) {
249
+ throw new SyncManifestContractError("UNKNOWN_ENUM_VALUE", field, `"${safe.slice(0, 32)}" is not allowed`);
250
+ }
251
+ return safe;
252
+ }
253
+ function assertBoundedInt(field, value, max) {
254
+ if (value === undefined || value === null)
255
+ throw new SyncManifestContractError("MISSING_FIELD", field);
256
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) {
257
+ throw new SyncManifestContractError("INVALID_TYPE", field, "expected integer");
258
+ }
259
+ if (value < 0 || value > max)
260
+ throw new SyncManifestContractError("OUT_OF_BOUNDS", field);
261
+ return value;
262
+ }
263
+ function assertBoolean(field, value) {
264
+ if (typeof value !== "boolean")
265
+ throw new SyncManifestContractError("INVALID_TYPE", field, "expected boolean");
266
+ return value;
267
+ }
268
+ /**
269
+ * Scope-relative POSIX path validation. Fails closed on: control characters
270
+ * (same predicate as hq-cloud `hasControlCharacters`), absolute paths, Windows
271
+ * separators or drive letters, `~` home refs, empty segments, and `.`/`..`
272
+ * segments — a `..` segment is a scope-escape attempt, not a stylistic issue.
273
+ */
274
+ export function assertSyncManifestPath(field, value) {
275
+ const safe = assertString(field, value, SYNC_MANIFEST_MAX_PATH_LENGTH);
276
+ if (safe.startsWith("/")) {
277
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "path must be scope-relative");
278
+ }
279
+ if (safe.includes("\\")) {
280
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "path must use POSIX separators");
281
+ }
282
+ if (/^[A-Za-z]:/.test(safe)) {
283
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "drive-letter path rejected");
284
+ }
285
+ if (safe.startsWith("~")) {
286
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "home-relative path rejected");
287
+ }
288
+ if (safe.endsWith("/")) {
289
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "path must not be a directory");
290
+ }
291
+ // macOS hands back NFD, S3 stores the bytes it was given. Two spellings of
292
+ // one filename would otherwise reconcile as a false MISSING_IN_VAULT plus a
293
+ // false ORPHAN_IN_VAULT for the SAME file, so the wire form is pinned to NFC.
294
+ if (safe.normalize("NFC") !== safe) {
295
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "path must be Unicode NFC-normalized");
296
+ }
297
+ for (const segment of safe.split("/")) {
298
+ if (segment.length === 0) {
299
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "empty path segment");
300
+ }
301
+ if (segment === "." || segment === "..") {
302
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "relative path segment rejected");
303
+ }
304
+ }
305
+ return safe;
306
+ }
307
+ function assertHash(field, value) {
308
+ const safe = assertString(field, value, 64);
309
+ if (!SHA256_HEX.test(safe)) {
310
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "expected lowercase sha256 hex");
311
+ }
312
+ return safe;
313
+ }
314
+ /**
315
+ * An error CLASS name and nothing else. Deliberately stricter than a bare
316
+ * string: `"ENOENT /Users/me/hq/companies/acme/deal.md"` is 43 harmless-looking
317
+ * characters that would carry a vault path into audit findings and logs.
318
+ */
319
+ function assertErrorClass(field, value) {
320
+ const safe = assertString(field, value, SYNC_MANIFEST_MAX_ERROR_CLASS_LENGTH);
321
+ if (!ERROR_CLASS.test(safe)) {
322
+ throw new SyncManifestContractError("UNSAFE_VALUE", field, "expected a bare error class name");
323
+ }
324
+ return safe;
325
+ }
326
+ function assertArray(field, value, max) {
327
+ if (value === undefined || value === null)
328
+ throw new SyncManifestContractError("MISSING_FIELD", field);
329
+ if (!Array.isArray(value))
330
+ throw new SyncManifestContractError("INVALID_TYPE", field, "expected array");
331
+ if (value.length > max) {
332
+ throw new SyncManifestContractError("BOUNDED_SIZE_EXCEEDED", field, `at most ${max} items`);
333
+ }
334
+ // A SPARSE array (`Array(3)`, or one with a deleted index) has holes that
335
+ // `.map()` SKIPS — every per-element guard below would be bypassed and the
336
+ // caller would receive `undefined` typed as a validated element. Reject the
337
+ // shape outright rather than validating element-by-element around holes.
338
+ for (let index = 0; index < value.length; index++) {
339
+ if (!Object.prototype.hasOwnProperty.call(value, index)) {
340
+ throw new SyncManifestContractError("INVALID_TYPE", `${field}[${index}]`, "sparse arrays are not permitted");
341
+ }
342
+ }
343
+ return value;
344
+ }
345
+ // ─── Parsers ─────────────────────────────────────────────────────────────────
346
+ /** Parse + validate a manifest scope. Unknown extra fields are ignored. */
347
+ export function validateSyncManifestScope(field, input) {
348
+ const raw = asRecord(field, input);
349
+ const kind = assertEnum(`${field}.kind`, raw.kind, SYNC_MANIFEST_SCOPE_KINDS);
350
+ if (kind === "company") {
351
+ return { kind, companyUid: assertIdentifier(`${field}.companyUid`, raw.companyUid) };
352
+ }
353
+ if (raw.companyUid !== undefined) {
354
+ throw new SyncManifestContractError("UNSAFE_VALUE", `${field}.companyUid`, "personal scope must not carry a company uid");
355
+ }
356
+ return { kind };
357
+ }
358
+ /** Parse + validate one manifest entry. Unknown extra fields are ignored. */
359
+ export function validateSyncManifestEntry(field, input) {
360
+ const raw = asRecord(field, input);
361
+ const entry = {
362
+ path: assertSyncManifestPath(`${field}.path`, raw.path),
363
+ size: assertBoundedInt(`${field}.size`, raw.size, SYNC_MANIFEST_MAX_FILE_SIZE_BYTES),
364
+ mtimeMs: assertBoundedInt(`${field}.mtimeMs`, raw.mtimeMs, SYNC_MANIFEST_MAX_MTIME_MS),
365
+ source: assertEnum(`${field}.source`, raw.source, SYNC_MANIFEST_ENTRY_SOURCES),
366
+ };
367
+ // `null` is accepted alongside `undefined` and means the same thing — "hash
368
+ // unknown". JSON round-trips routinely turn an omitted optional into an
369
+ // explicit null, and rejecting the null spelling would fail a whole chunk
370
+ // over a serialiser detail. A PRESENT hash is still held to the full sha256
371
+ // rule: "unknown" and "malformed" are different claims.
372
+ if (raw.hash !== undefined && raw.hash !== null) {
373
+ entry.hash = assertHash(`${field}.hash`, raw.hash);
374
+ }
375
+ if (raw.ledgerRemoteEtag !== undefined) {
376
+ entry.ledgerRemoteEtag = assertString(`${field}.ledgerRemoteEtag`, raw.ledgerRemoteEtag, SYNC_MANIFEST_MAX_ETAG_LENGTH);
377
+ }
378
+ if (raw.ledgerSyncedAt !== undefined) {
379
+ entry.ledgerSyncedAt = assertIsoUtc(`${field}.ledgerSyncedAt`, raw.ledgerSyncedAt);
380
+ }
381
+ if (raw.ledgerDirection !== undefined) {
382
+ entry.ledgerDirection = assertEnum(`${field}.ledgerDirection`, raw.ledgerDirection, SYNC_MANIFEST_LEDGER_DIRECTIONS);
383
+ }
384
+ if (raw.pendingPush !== undefined) {
385
+ entry.pendingPush = assertBoolean(`${field}.pendingPush`, raw.pendingPush);
386
+ }
387
+ return entry;
388
+ }
389
+ function validateWalkStats(field, input) {
390
+ const raw = asRecord(field, input);
391
+ return {
392
+ filesWalked: assertBoundedInt(`${field}.filesWalked`, raw.filesWalked, SYNC_MANIFEST_MAX_WALK_STAT),
393
+ walkMs: assertBoundedInt(`${field}.walkMs`, raw.walkMs, SYNC_MANIFEST_MAX_WALK_STAT),
394
+ hashedFiles: assertBoundedInt(`${field}.hashedFiles`, raw.hashedFiles, SYNC_MANIFEST_MAX_WALK_STAT),
395
+ ignoredFiles: assertBoundedInt(`${field}.ignoredFiles`, raw.ignoredFiles, SYNC_MANIFEST_MAX_WALK_STAT),
396
+ // Additive and optional: an older client does not send it, and its absence
397
+ // must not fail the chunk. Present, it is how a reader tells "every entry
398
+ // is hash-verified" from "this pass was stat-only", which changes what a
399
+ // finding means.
400
+ ...(raw.unhashedFiles === undefined
401
+ ? {}
402
+ : {
403
+ unhashedFiles: assertBoundedInt(`${field}.unhashedFiles`, raw.unhashedFiles, SYNC_MANIFEST_MAX_WALK_STAT),
404
+ }),
405
+ };
406
+ }
407
+ /**
408
+ * Parse + validate one manifest chunk upload.
409
+ *
410
+ * Tolerant of unknown EXTRA fields (a newer client talking to an older server
411
+ * must not fail) and fail-closed on every value it does consume. Rejections
412
+ * carry a {@link SyncManifestContractErrorCode}; an over-sized chunk always
413
+ * reports {@link SYNC_MANIFEST_BOUNDED_SIZE_REASON_CODE}.
414
+ */
415
+ export function validateSyncManifestUpload(input) {
416
+ const raw = asRecord("upload", input);
417
+ // Classify version BEFORE bounding it: a client matching on
418
+ // UNSUPPORTED_CONTRACT_VERSION to prompt an upgrade must not receive
419
+ // OUT_OF_BOUNDS just because its version number is large.
420
+ const contractVersion = assertBoundedInt("contractVersion", raw.contractVersion, SYNC_MANIFEST_MAX_CONTRACT_VERSION);
421
+ if (contractVersion < 1 || contractVersion > SYNC_MANIFEST_CONTRACT_VERSION) {
422
+ throw new SyncManifestContractError("UNSUPPORTED_CONTRACT_VERSION", "contractVersion");
423
+ }
424
+ if (raw.personUid !== undefined) {
425
+ throw new SyncManifestContractError("UNSAFE_VALUE", "personUid", "person identity is derived from auth, never from the body");
426
+ }
427
+ const chunkCount = assertBoundedInt("chunkCount", raw.chunkCount, SYNC_MANIFEST_MAX_CHUNK_COUNT);
428
+ if (chunkCount < 1)
429
+ throw new SyncManifestContractError("OUT_OF_BOUNDS", "chunkCount", "must be >= 1");
430
+ const chunkIndex = assertBoundedInt("chunkIndex", raw.chunkIndex, SYNC_MANIFEST_MAX_CHUNK_COUNT);
431
+ if (chunkIndex >= chunkCount) {
432
+ throw new SyncManifestContractError("OUT_OF_BOUNDS", "chunkIndex", "must be < chunkCount");
433
+ }
434
+ const rawEntries = assertArray("entries", raw.entries, SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK);
435
+ const rawRemoved = assertArray("removedPaths", raw.removedPaths, SYNC_MANIFEST_MAX_REMOVED_PATHS_PER_CHUNK);
436
+ const rawIgnoreRules = assertArray("ignoreRules", raw.ignoreRules, SYNC_MANIFEST_MAX_IGNORE_RULES);
437
+ const upload = {
438
+ contractVersion,
439
+ installationId: assertIdentifier("installationId", raw.installationId),
440
+ scope: validateSyncManifestScope("scope", raw.scope),
441
+ machineId: assertIdentifier("machineId", raw.machineId),
442
+ source: assertEnum("source", raw.source, SYNC_MANIFEST_SOURCES),
443
+ mode: assertEnum("mode", raw.mode, SYNC_MANIFEST_MODES),
444
+ generatedAt: assertIsoUtc("generatedAt", raw.generatedAt),
445
+ sequence: assertBoundedInt("sequence", raw.sequence, Number.MAX_SAFE_INTEGER),
446
+ chunkIndex,
447
+ chunkCount,
448
+ entries: rawEntries.map((entry, index) => validateSyncManifestEntry(`entries[${index}]`, entry)),
449
+ removedPaths: rawRemoved.map((value, index) => assertSyncManifestPath(`removedPaths[${index}]`, value)),
450
+ walkStats: validateWalkStats("walkStats", raw.walkStats),
451
+ ignoreRules: rawIgnoreRules.map((value, index) => assertString(`ignoreRules[${index}]`, value, SYNC_MANIFEST_MAX_IGNORE_RULE_LENGTH)),
452
+ };
453
+ if (raw.baseSnapshotId !== undefined) {
454
+ upload.baseSnapshotId = assertIdentifier("baseSnapshotId", raw.baseSnapshotId);
455
+ }
456
+ if (raw.ledgerUnavailable !== undefined) {
457
+ const ledgerUnavailable = asRecord("ledgerUnavailable", raw.ledgerUnavailable);
458
+ upload.ledgerUnavailable = {
459
+ errorClass: assertErrorClass("ledgerUnavailable.errorClass", ledgerUnavailable.errorClass),
460
+ };
461
+ }
462
+ return upload;
463
+ }
464
+ // ─── Structural descriptor (cross-repo mirror check) ─────────────────────────
465
+ /**
466
+ * A machine-comparable description of this contract's SHAPE: version, closed
467
+ * enum value arrays, limit constants, and the field-name lists of every wire
468
+ * type. Both repos snapshot this to the byte-identical
469
+ * `sync-manifest-contract-descriptor.json` fixture, so ANY drift — a renamed
470
+ * field, a new enum value, a changed bound — fails a test in BOTH repos.
471
+ *
472
+ * Field lists are declared explicitly (not derived) because TypeScript
473
+ * interfaces are erased at runtime; the type-level half of the check is the
474
+ * compile-time assertion in each repo's mirror test, which requires every
475
+ * listed name to be a real key of the corresponding interface.
476
+ */
477
+ export const SYNC_MANIFEST_CONTRACT_DESCRIPTOR = {
478
+ contractVersion: SYNC_MANIFEST_CONTRACT_VERSION,
479
+ enums: {
480
+ scopeKinds: [...SYNC_MANIFEST_SCOPE_KINDS],
481
+ sources: [...SYNC_MANIFEST_SOURCES],
482
+ modes: [...SYNC_MANIFEST_MODES],
483
+ entrySources: [...SYNC_MANIFEST_ENTRY_SOURCES],
484
+ ledgerDirections: [...SYNC_MANIFEST_LEDGER_DIRECTIONS],
485
+ errorCodes: [...SYNC_MANIFEST_CONTRACT_ERROR_CODES],
486
+ },
487
+ limits: {
488
+ maxEntriesPerChunk: SYNC_MANIFEST_MAX_ENTRIES_PER_CHUNK,
489
+ maxRemovedPathsPerChunk: SYNC_MANIFEST_MAX_REMOVED_PATHS_PER_CHUNK,
490
+ maxPathLength: SYNC_MANIFEST_MAX_PATH_LENGTH,
491
+ maxIgnoreRules: SYNC_MANIFEST_MAX_IGNORE_RULES,
492
+ maxIgnoreRuleLength: SYNC_MANIFEST_MAX_IGNORE_RULE_LENGTH,
493
+ maxIdLength: SYNC_MANIFEST_MAX_ID_LENGTH,
494
+ maxChunkCount: SYNC_MANIFEST_MAX_CHUNK_COUNT,
495
+ maxChunkBytes: SYNC_MANIFEST_MAX_CHUNK_BYTES,
496
+ defaultChunkByteBudget: SYNC_MANIFEST_DEFAULT_CHUNK_BYTE_BUDGET,
497
+ maxFileSizeBytes: SYNC_MANIFEST_MAX_FILE_SIZE_BYTES,
498
+ maxMtimeMs: SYNC_MANIFEST_MAX_MTIME_MS,
499
+ maxEtagLength: SYNC_MANIFEST_MAX_ETAG_LENGTH,
500
+ maxErrorClassLength: SYNC_MANIFEST_MAX_ERROR_CLASS_LENGTH,
501
+ maxWalkStat: SYNC_MANIFEST_MAX_WALK_STAT,
502
+ maxContractVersion: SYNC_MANIFEST_MAX_CONTRACT_VERSION,
503
+ },
504
+ boundedSizeReasonCode: SYNC_MANIFEST_BOUNDED_SIZE_REASON_CODE,
505
+ chunkTooLargeReasonCode: SYNC_MANIFEST_CHUNK_TOO_LARGE_REASON_CODE,
506
+ manifestTooLargeReasonCode: SYNC_MANIFEST_TOO_LARGE_REASON_CODE,
507
+ fields: {
508
+ upload: [
509
+ "baseSnapshotId",
510
+ "chunkCount",
511
+ "chunkIndex",
512
+ "contractVersion",
513
+ "entries",
514
+ "generatedAt",
515
+ "ignoreRules",
516
+ "installationId",
517
+ "ledgerUnavailable",
518
+ "machineId",
519
+ "mode",
520
+ "removedPaths",
521
+ "scope",
522
+ "sequence",
523
+ "source",
524
+ "walkStats",
525
+ ],
526
+ entry: [
527
+ "hash",
528
+ "ledgerDirection",
529
+ "ledgerRemoteEtag",
530
+ "ledgerSyncedAt",
531
+ "mtimeMs",
532
+ "path",
533
+ "pendingPush",
534
+ "size",
535
+ "source",
536
+ ],
537
+ scope: ["companyUid", "kind"],
538
+ walkStats: ["filesWalked", "hashedFiles", "ignoredFiles", "unhashedFiles", "walkMs"],
539
+ ledgerUnavailable: ["errorClass"],
540
+ },
541
+ };
542
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/manifest/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,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E,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,CAAC;QACpF,iBAAiB,EAAE,CAAC,YAAY,CAAC;KAClC;CACO,CAAC"}
@@ -0,0 +1,17 @@
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
+ export {};
17
+ //# sourceMappingURL=contract.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.test.d.ts","sourceRoot":"","sources":["../../src/manifest/contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}