@indigoai-us/hq-cloud 6.16.49 → 6.16.51-alpha.0
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/rescue-runner.js +1 -1
- package/dist/bin/sync-runner-company.d.ts +6 -0
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +30 -1
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-company.test.js +55 -0
- package/dist/bin/sync-runner-company.test.js.map +1 -1
- package/dist/bin/sync-runner-planning.d.ts +12 -3
- package/dist/bin/sync-runner-planning.d.ts.map +1 -1
- package/dist/bin/sync-runner-planning.js +65 -3
- package/dist/bin/sync-runner-planning.js.map +1 -1
- package/dist/bin/sync-runner-planning.test.js +108 -1
- package/dist/bin/sync-runner-planning.test.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +48 -2
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +281 -113
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +33 -5
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +34 -4
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +555 -78
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts +2 -0
- package/dist/cli/onepass-pull-planner-regressions.test.d.ts.map +1 -0
- package/dist/cli/onepass-pull-planner-regressions.test.js +300 -0
- package/dist/cli/onepass-pull-planner-regressions.test.js.map +1 -0
- package/dist/cli/onepass-pull-planner.test.d.ts +2 -0
- package/dist/cli/onepass-pull-planner.test.d.ts.map +1 -0
- package/dist/cli/onepass-pull-planner.test.js +266 -0
- package/dist/cli/onepass-pull-planner.test.js.map +1 -0
- package/dist/cli/rescue-core.d.ts +0 -29
- package/dist/cli/rescue-core.d.ts.map +1 -1
- package/dist/cli/rescue-core.js +39 -236
- package/dist/cli/rescue-core.js.map +1 -1
- package/dist/cli/rescue-rsync-preflight.test.js +4 -256
- package/dist/cli/rescue-rsync-preflight.test.js.map +1 -1
- package/dist/cli/rescue.d.ts +0 -6
- package/dist/cli/rescue.d.ts.map +1 -1
- package/dist/cli/rescue.js +0 -12
- package/dist/cli/rescue.js.map +1 -1
- package/dist/cli/rescue.test.js +0 -6
- package/dist/cli/rescue.test.js.map +1 -1
- package/dist/cli/share-presign-transport.test.js +0 -2
- package/dist/cli/share-presign-transport.test.js.map +1 -1
- package/dist/cli/share.d.ts +19 -0
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +57 -37
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +87 -93
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/streaming-pull-planner.bench.test.d.ts +15 -0
- package/dist/cli/streaming-pull-planner.bench.test.d.ts.map +1 -0
- package/dist/cli/streaming-pull-planner.bench.test.js +273 -0
- package/dist/cli/streaming-pull-planner.bench.test.js.map +1 -0
- package/dist/cli/sync-scope.test.js +8 -0
- package/dist/cli/sync-scope.test.js.map +1 -1
- package/dist/cli/sync.d.ts +12 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +226 -118
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +215 -2
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/cli/watch-event-push-conflict.test.js +0 -2
- package/dist/cli/watch-event-push-conflict.test.js.map +1 -1
- package/dist/cognito-auth.d.ts +0 -30
- package/dist/cognito-auth.d.ts.map +1 -1
- package/dist/cognito-auth.js +0 -175
- package/dist/cognito-auth.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/journal-store.test.js +130 -7
- package/dist/journal-store.test.js.map +1 -1
- package/dist/journal.d.ts +9 -1
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +30 -21
- package/dist/journal.js.map +1 -1
- package/dist/lib/exit-codes.d.ts +15 -0
- package/dist/lib/exit-codes.d.ts.map +1 -1
- package/dist/lib/exit-codes.js +15 -0
- package/dist/lib/exit-codes.js.map +1 -1
- package/dist/machine-auth.test.js +0 -295
- package/dist/machine-auth.test.js.map +1 -1
- package/dist/object-io.d.ts +2 -2
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +3 -18
- package/dist/object-io.js.map +1 -1
- package/dist/personal-vault.d.ts.map +1 -1
- package/dist/personal-vault.js +10 -3
- package/dist/personal-vault.js.map +1 -1
- package/dist/personal-vault.test.js +35 -0
- package/dist/personal-vault.test.js.map +1 -1
- package/dist/remote-pull.d.ts.map +1 -1
- package/dist/remote-pull.js +9 -2
- package/dist/remote-pull.js.map +1 -1
- package/dist/remote-pull.test.js +59 -2
- package/dist/remote-pull.test.js.map +1 -1
- package/dist/s3.d.ts +1 -18
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +24 -47
- package/dist/s3.js.map +1 -1
- package/dist/s3.list-cost.test.d.ts +2 -0
- package/dist/s3.list-cost.test.d.ts.map +1 -0
- package/dist/s3.list-cost.test.js +51 -0
- package/dist/s3.list-cost.test.js.map +1 -0
- package/dist/s3.test.js +1 -27
- package/dist/s3.test.js.map +1 -1
- package/dist/sync/realtime-telemetry.d.ts +1 -1
- package/dist/sync/realtime-telemetry.d.ts.map +1 -1
- package/dist/sync/realtime-telemetry.js +14 -6
- package/dist/sync/realtime-telemetry.js.map +1 -1
- package/dist/sync/realtime-telemetry.test.js +136 -16
- package/dist/sync/realtime-telemetry.test.js.map +1 -1
- package/dist/sync/remote-file-spool.d.ts +16 -0
- package/dist/sync/remote-file-spool.d.ts.map +1 -0
- package/dist/sync/remote-file-spool.js +91 -0
- package/dist/sync/remote-file-spool.js.map +1 -0
- package/dist/sync/remote-file-spool.test.d.ts +2 -0
- package/dist/sync/remote-file-spool.test.d.ts.map +1 -0
- package/dist/sync/remote-file-spool.test.js +77 -0
- package/dist/sync/remote-file-spool.test.js.map +1 -0
- package/dist/sync-core.d.ts +4 -6
- package/dist/sync-core.d.ts.map +1 -1
- package/dist/sync-core.js +4 -10
- package/dist/sync-core.js.map +1 -1
- package/dist/sync-core.test.js +1 -25
- package/dist/sync-core.test.js.map +1 -1
- package/package.json +2 -1
- package/dist/cli/rescue-breaker.test.d.ts +0 -2
- package/dist/cli/rescue-breaker.test.d.ts.map +0 -1
- package/dist/cli/rescue-breaker.test.js +0 -314
- package/dist/cli/rescue-breaker.test.js.map +0 -1
- package/dist/cli/rescue-realpath.test.d.ts +0 -2
- package/dist/cli/rescue-realpath.test.d.ts.map +0 -1
- package/dist/cli/rescue-realpath.test.js +0 -109
- package/dist/cli/rescue-realpath.test.js.map +0 -1
- package/dist/cli/rescue-source-switch-floor.test.d.ts +0 -2
- package/dist/cli/rescue-source-switch-floor.test.d.ts.map +0 -1
- package/dist/cli/rescue-source-switch-floor.test.js +0 -210
- package/dist/cli/rescue-source-switch-floor.test.js.map +0 -1
package/dist/cli/share.test.js
CHANGED
|
@@ -30,8 +30,6 @@ vi.mock("../s3.js", async (importOriginal) => {
|
|
|
30
30
|
readVerifiedRemoteSymlinkTarget: vi.fn().mockResolvedValue(null),
|
|
31
31
|
primeObjectTransport: vi.fn().mockResolvedValue(undefined),
|
|
32
32
|
primeUploads: vi.fn().mockResolvedValue(undefined),
|
|
33
|
-
publishedContentHash: actual.publishedContentHash,
|
|
34
|
-
setUploadContentHash: actual.setUploadContentHash,
|
|
35
33
|
// Real exports share.ts now imports for the HQ-DESKTOP-54 privilege skip.
|
|
36
34
|
WINDOWS_SYMLINK_PRIVILEGE_REMEDY: "Enable Windows Developer Mode (Settings > Privacy & security > For developers) or run HQ sync once from an elevated terminal, then sync again.",
|
|
37
35
|
WindowsSymlinkPrivilegeError: class WindowsSymlinkPrivilegeError extends Error {
|
|
@@ -64,13 +62,14 @@ vi.mock("readline", () => ({
|
|
|
64
62
|
})),
|
|
65
63
|
}));
|
|
66
64
|
import * as readline from "readline";
|
|
67
|
-
import { share, ServerOwnedPushPathsError, UnreachablePushPathsError, UnregisteredCompanySkillError, currentUploadBytes, parseRegisteredCompanySkillUid, _testing as shareTesting, } from "./share.js";
|
|
65
|
+
import { share, ServerOwnedPushPathsError, UnreachablePushPathsError, UnregisteredCompanySkillError, currentUploadBytes, FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE, parseRegisteredCompanySkillUid, _testing as shareTesting, } from "./share.js";
|
|
68
66
|
import { deleteRemoteFile, downloadFile, headRemoteFile, primeObjectTransport, primeUploads, uploadFile, uploadSymlink, WindowsSymlinkPrivilegeError, } from "../s3.js";
|
|
69
67
|
import { VaultAuthError, VaultClientError, VaultPermissionDeniedError, } from "../vault-client.js";
|
|
70
68
|
import { CognitoRefreshError } from "../cognito-auth.js";
|
|
71
69
|
import { AreaLedgerMigration, closeCachedAreaJournalMigration, hashFile, openJournalStateStoreForMigration, readJournal, readJournalScoped, setAreaLedgerMigrationTestHooksForTest, writeJournal, } from "../journal.js";
|
|
72
70
|
import { ReconcileCursorStore } from "../sync/reconcile-cursor.js";
|
|
73
71
|
import { AreaResolver } from "../sync/area-resolver.js";
|
|
72
|
+
import { CooperativePassScheduler } from "../bin/sync-runner-watch-loop.js";
|
|
74
73
|
/**
|
|
75
74
|
* Read a journal the way production does.
|
|
76
75
|
*
|
|
@@ -1167,6 +1166,91 @@ describe("share", () => {
|
|
|
1167
1166
|
// Remote key must be company-relative, not hqRoot-relative
|
|
1168
1167
|
expect(uploadFile).toHaveBeenCalledWith(expect.anything(), testFile, "test.md", undefined, expect.anything());
|
|
1169
1168
|
});
|
|
1169
|
+
it("hands queued realtime work a settled full-push boundary without losing journal rows", async () => {
|
|
1170
|
+
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
1171
|
+
const fileCount = FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE + 1;
|
|
1172
|
+
for (let index = 0; index < fileCount; index++) {
|
|
1173
|
+
const file = path.join(companyRoot, "docs", "full-push", `${index}.md`);
|
|
1174
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
1175
|
+
fs.writeFileSync(file, "full-push body");
|
|
1176
|
+
}
|
|
1177
|
+
const scheduler = new CooperativePassScheduler(() => 0);
|
|
1178
|
+
let uploadsCompleted = 0;
|
|
1179
|
+
let uploadsInFlight = 0;
|
|
1180
|
+
let maxUploadsInFlight = 0;
|
|
1181
|
+
let realtimeQueued = false;
|
|
1182
|
+
let realtimeDispatchedAt = -1;
|
|
1183
|
+
let checkpointCalls = 0;
|
|
1184
|
+
let realtimePass;
|
|
1185
|
+
const upload = vi.mocked(uploadFile);
|
|
1186
|
+
const originalUpload = upload.getMockImplementation();
|
|
1187
|
+
upload.mockImplementation(async () => {
|
|
1188
|
+
uploadsInFlight++;
|
|
1189
|
+
maxUploadsInFlight = Math.max(maxUploadsInFlight, uploadsInFlight);
|
|
1190
|
+
await Promise.resolve();
|
|
1191
|
+
uploadsCompleted++;
|
|
1192
|
+
if (uploadsCompleted === 1) {
|
|
1193
|
+
realtimeQueued = true;
|
|
1194
|
+
realtimePass = scheduler.submit(async () => {
|
|
1195
|
+
// `executeUploads` drains the full unit before the scheduler grants
|
|
1196
|
+
// realtime the root lock: no two durable writers overlap.
|
|
1197
|
+
expect(uploadsInFlight).toBe(0);
|
|
1198
|
+
realtimeDispatchedAt = uploadsCompleted;
|
|
1199
|
+
const realtimePath = path.join(companyRoot, "docs", "realtime.md");
|
|
1200
|
+
fs.writeFileSync(realtimePath, "realtime body");
|
|
1201
|
+
const journal = readJournal("acme");
|
|
1202
|
+
journal.files["docs/realtime.md"] = {
|
|
1203
|
+
hash: hashFile(realtimePath),
|
|
1204
|
+
size: fs.statSync(realtimePath).size,
|
|
1205
|
+
syncedAt: "2026-09-17T12:00:00.000Z",
|
|
1206
|
+
direction: "up",
|
|
1207
|
+
remoteEtag: "realtime",
|
|
1208
|
+
mtimeMs: fs.statSync(realtimePath).mtimeMs,
|
|
1209
|
+
ctimeMs: fs.statSync(realtimePath).ctimeMs,
|
|
1210
|
+
};
|
|
1211
|
+
writeJournal("acme", journal);
|
|
1212
|
+
}, "realtime");
|
|
1213
|
+
}
|
|
1214
|
+
uploadsInFlight--;
|
|
1215
|
+
return { etag: '"full-push-etag"' };
|
|
1216
|
+
});
|
|
1217
|
+
try {
|
|
1218
|
+
await scheduler.submit(async ({ checkpoint }) => {
|
|
1219
|
+
await share({
|
|
1220
|
+
paths: [companyRoot],
|
|
1221
|
+
company: "acme",
|
|
1222
|
+
vaultConfig: mockConfig,
|
|
1223
|
+
hqRoot: tmpDir,
|
|
1224
|
+
skipUnchanged: true,
|
|
1225
|
+
propagateDeletes: true,
|
|
1226
|
+
cooperativeCheckpoint: async () => {
|
|
1227
|
+
checkpointCalls++;
|
|
1228
|
+
return checkpoint();
|
|
1229
|
+
},
|
|
1230
|
+
});
|
|
1231
|
+
}, "chore");
|
|
1232
|
+
await realtimePass;
|
|
1233
|
+
}
|
|
1234
|
+
finally {
|
|
1235
|
+
if (originalUpload)
|
|
1236
|
+
upload.mockImplementation(originalUpload);
|
|
1237
|
+
else
|
|
1238
|
+
upload.mockReset();
|
|
1239
|
+
}
|
|
1240
|
+
expect(maxUploadsInFlight).toBeGreaterThan(1);
|
|
1241
|
+
expect(realtimeQueued).toBe(true);
|
|
1242
|
+
expect(checkpointCalls).toBeGreaterThan(0);
|
|
1243
|
+
expect(realtimeDispatchedAt).toBeGreaterThan(0);
|
|
1244
|
+
expect(realtimeDispatchedAt).toBeLessThanOrEqual(FULL_PUSH_COOPERATIVE_CHECKPOINT_BATCH_SIZE);
|
|
1245
|
+
// Reopen the durable journal, rather than inspecting the stale first-pass
|
|
1246
|
+
// object: every pre-handoff key and the realtime key must survive.
|
|
1247
|
+
const durable = readJournal("acme");
|
|
1248
|
+
expect(Object.keys(durable.files)).toHaveLength(fileCount + 1);
|
|
1249
|
+
expect(durable.files["docs/realtime.md"]).toBeDefined();
|
|
1250
|
+
for (let index = 0; index < fileCount; index++) {
|
|
1251
|
+
expect(durable.files[`docs/full-push/${index}.md`]).toBeDefined();
|
|
1252
|
+
}
|
|
1253
|
+
}, 120_000);
|
|
1170
1254
|
it("replans an upload from the bytes present when its action starts", async () => {
|
|
1171
1255
|
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
1172
1256
|
fs.mkdirSync(companyRoot, { recursive: true });
|
|
@@ -2437,96 +2521,6 @@ describe("share", () => {
|
|
|
2437
2521
|
remoteEtag: "288bfa91684ae21f9ae27c061254d412",
|
|
2438
2522
|
});
|
|
2439
2523
|
});
|
|
2440
|
-
it("does not PUT when the remote publishes the same SHA-256 under a new SSE-KMS ETag", async () => {
|
|
2441
|
-
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
2442
|
-
fs.mkdirSync(companyRoot, { recursive: true });
|
|
2443
|
-
const testFile = path.join(companyRoot, "lineage-noop.md");
|
|
2444
|
-
fs.writeFileSync(testFile, "same bytes, new encrypted version");
|
|
2445
|
-
const stat = fs.lstatSync(testFile);
|
|
2446
|
-
const localHash = hashFile(testFile);
|
|
2447
|
-
seedJournalAt(path.join(stateDir, "sync-journal.acme.json"), {
|
|
2448
|
-
version: "1",
|
|
2449
|
-
lastSync: new Date().toISOString(),
|
|
2450
|
-
files: {
|
|
2451
|
-
"lineage-noop.md": {
|
|
2452
|
-
hash: "b".repeat(64),
|
|
2453
|
-
size: stat.size,
|
|
2454
|
-
mtimeMs: stat.mtimeMs - 1,
|
|
2455
|
-
ctimeMs: stat.ctimeMs - 1,
|
|
2456
|
-
remoteEtag: "journal-kms-etag",
|
|
2457
|
-
syncedAt: new Date().toISOString(),
|
|
2458
|
-
direction: "up",
|
|
2459
|
-
},
|
|
2460
|
-
},
|
|
2461
|
-
});
|
|
2462
|
-
vi.mocked(headRemoteFile).mockResolvedValueOnce({
|
|
2463
|
-
lastModified: new Date(),
|
|
2464
|
-
etag: '"new-kms-etag"',
|
|
2465
|
-
size: stat.size,
|
|
2466
|
-
metadata: { "hq-content-sha256": localHash },
|
|
2467
|
-
});
|
|
2468
|
-
const result = await share({
|
|
2469
|
-
paths: [testFile],
|
|
2470
|
-
company: "acme",
|
|
2471
|
-
vaultConfig: mockConfig,
|
|
2472
|
-
hqRoot: tmpDir,
|
|
2473
|
-
onConflict: "overwrite",
|
|
2474
|
-
});
|
|
2475
|
-
expect(result.filesUploaded).toBe(0);
|
|
2476
|
-
expect(result.conflictPaths).toEqual([]);
|
|
2477
|
-
expect(uploadFile).not.toHaveBeenCalled();
|
|
2478
|
-
expect(readJournal("acme").files["lineage-noop.md"]).toMatchObject({
|
|
2479
|
-
hash: localHash,
|
|
2480
|
-
remoteEtag: "new-kms-etag",
|
|
2481
|
-
});
|
|
2482
|
-
});
|
|
2483
|
-
it("refuses an unchanged journal baseline after a published remote hash advances", async () => {
|
|
2484
|
-
const companyRoot = path.join(tmpDir, "companies", "acme");
|
|
2485
|
-
fs.mkdirSync(companyRoot, { recursive: true });
|
|
2486
|
-
const testFile = path.join(companyRoot, "lineage-stale-replay.md");
|
|
2487
|
-
fs.writeFileSync(testFile, "the old local generation");
|
|
2488
|
-
const stat = fs.lstatSync(testFile);
|
|
2489
|
-
const localHash = hashFile(testFile);
|
|
2490
|
-
seedJournalAt(path.join(stateDir, "sync-journal.acme.json"), {
|
|
2491
|
-
version: "1",
|
|
2492
|
-
lastSync: new Date().toISOString(),
|
|
2493
|
-
files: {
|
|
2494
|
-
"lineage-stale-replay.md": {
|
|
2495
|
-
hash: localHash,
|
|
2496
|
-
size: stat.size,
|
|
2497
|
-
mtimeMs: stat.mtimeMs,
|
|
2498
|
-
ctimeMs: stat.ctimeMs,
|
|
2499
|
-
remoteEtag: "old-kms-etag",
|
|
2500
|
-
syncedAt: new Date().toISOString(),
|
|
2501
|
-
direction: "up",
|
|
2502
|
-
},
|
|
2503
|
-
},
|
|
2504
|
-
});
|
|
2505
|
-
vi.mocked(headRemoteFile).mockResolvedValueOnce({
|
|
2506
|
-
lastModified: new Date(),
|
|
2507
|
-
etag: '"new-kms-etag"',
|
|
2508
|
-
size: stat.size,
|
|
2509
|
-
metadata: { "hq-content-sha256": "b".repeat(64) },
|
|
2510
|
-
});
|
|
2511
|
-
const events = [];
|
|
2512
|
-
const result = await share({
|
|
2513
|
-
paths: [testFile],
|
|
2514
|
-
company: "acme",
|
|
2515
|
-
vaultConfig: mockConfig,
|
|
2516
|
-
hqRoot: tmpDir,
|
|
2517
|
-
onConflict: "overwrite",
|
|
2518
|
-
onEvent: (event) => events.push(event),
|
|
2519
|
-
});
|
|
2520
|
-
expect(result.filesUploaded).toBe(0);
|
|
2521
|
-
expect(result.conflictPaths).toEqual(["lineage-stale-replay.md"]);
|
|
2522
|
-
expect(uploadFile).not.toHaveBeenCalled();
|
|
2523
|
-
expect(events).toContainEqual({
|
|
2524
|
-
type: "conflict",
|
|
2525
|
-
path: "lineage-stale-replay.md",
|
|
2526
|
-
direction: "push",
|
|
2527
|
-
resolution: "skip",
|
|
2528
|
-
});
|
|
2529
|
-
});
|
|
2530
2524
|
it("fresh-install multipart collision: byte-identical remote is NOT a conflict (reconciled, no mirror)", async () => {
|
|
2531
2525
|
// Root cause of "HQ installs with conflicts": on a first push the
|
|
2532
2526
|
// journal is empty, so the fresh-collision branch decides conflict-vs-
|