@indigoai-us/hq-cloud 6.16.72-alpha.0 → 6.16.72-alpha.1

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 (43) hide show
  1. package/dist/bin/sync-runner-watch-loop.d.ts +5 -35
  2. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  3. package/dist/bin/sync-runner-watch-loop.js +32 -156
  4. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  5. package/dist/bin/sync-runner.test.js +12 -96
  6. package/dist/bin/sync-runner.test.js.map +1 -1
  7. package/dist/cli/rescue-breaker.test.js +94 -1
  8. package/dist/cli/rescue-breaker.test.js.map +1 -1
  9. package/dist/cli/rescue-classify-ordering.test.js +1 -1
  10. package/dist/cli/rescue-clone-network-retry.test.d.ts +2 -0
  11. package/dist/cli/rescue-clone-network-retry.test.d.ts.map +1 -0
  12. package/dist/cli/rescue-clone-network-retry.test.js +415 -0
  13. package/dist/cli/rescue-clone-network-retry.test.js.map +1 -0
  14. package/dist/cli/rescue-core.d.ts +12 -5
  15. package/dist/cli/rescue-core.d.ts.map +1 -1
  16. package/dist/cli/rescue-core.js +685 -93
  17. package/dist/cli/rescue-core.js.map +1 -1
  18. package/dist/cli/rescue-drift-reconcile.test.js +1 -1
  19. package/dist/cli/rescue-drop-dir-symlink.test.js +1 -1
  20. package/dist/cli/rescue-exec-bit-preserve.test.js +1 -1
  21. package/dist/cli/rescue-hq-root-guard.test.js +1 -1
  22. package/dist/cli/rescue-journal-reconcile.test.js +1 -1
  23. package/dist/cli/rescue-keep-local-ignore.test.js +2 -2
  24. package/dist/cli/rescue-move.test.d.ts +2 -0
  25. package/dist/cli/rescue-move.test.d.ts.map +1 -0
  26. package/dist/cli/rescue-move.test.js +162 -0
  27. package/dist/cli/rescue-move.test.js.map +1 -0
  28. package/dist/cli/rescue-mtime-preserve.test.js +1 -1
  29. package/dist/cli/rescue-preserve-copy-symlink.test.d.ts +2 -0
  30. package/dist/cli/rescue-preserve-copy-symlink.test.d.ts.map +1 -0
  31. package/dist/cli/rescue-preserve-copy-symlink.test.js +338 -0
  32. package/dist/cli/rescue-preserve-copy-symlink.test.js.map +1 -0
  33. package/dist/cli/rescue-rsync-preflight.test.js +108 -12
  34. package/dist/cli/rescue-rsync-preflight.test.js.map +1 -1
  35. package/dist/cli/rescue-rsync-status.test.d.ts +2 -0
  36. package/dist/cli/rescue-rsync-status.test.d.ts.map +1 -0
  37. package/dist/cli/rescue-rsync-status.test.js +199 -0
  38. package/dist/cli/rescue-rsync-status.test.js.map +1 -0
  39. package/dist/cli/rescue-settings-reconcile.test.js +2 -2
  40. package/dist/cli/rescue-snapshot-copy.test.js +1 -1
  41. package/dist/cli/rescue-snapshot-recovery.test.js +1 -1
  42. package/dist/cli/rescue-source-switch-floor.test.js +1 -1
  43. package/package.json +1 -1
@@ -20,7 +20,7 @@ import { PresignObjectIO, S3SdkObjectIO } from "../object-io.js";
20
20
  import { setBandwidthGovernorForTesting } from "../bandwidth.js";
21
21
  import { POST_SYNC_FLAG_KEYS, } from "./sync-runner-post-sync-flags.js";
22
22
  import { FakeClock, TreeWatcher, } from "../watcher.js";
23
- import { adaptivePollMs, advanceMonotonicDeadline, DEFAULT_EVENT_BATCH_LIMIT, DEFAULT_FAST_LANE_MAX_BYTES, DEFAULT_FAST_LANE_MAX_FILE_BYTES, DEFAULT_FAST_LANE_MAX_FILES, DEFAULT_FULL_RECONCILE_MS, EVENT_BATCH_LIMIT_ENV, FAST_LANE_MAX_BYTES_ENV, FAST_LANE_MAX_FILES_ENV, FULL_RECONCILE_MS_ENV, isFastLocalBatch, isFastReceiverBatch, partitionLocalBatch, journalEntriesForWatcherDelete, resolveEventBatchLimit, resolveFullReconcileMs, resolveWatchPollMs, CHORE_STARVATION_CAP_MS, CooperativePassScheduler, REALTIME_ADMISSION_DEADLINE_MS, REALTIME_DRAIN_BURST_MS, REALTIME_WORKER_OCCUPANCY_CAP, RealtimeAdmissionTimeoutError, setRealtimeAdmissionDeadlineMsForTesting, setRealtimeDrainBurstMsForTesting, normalizeCoordinatorPaths, shouldQuarantineWatcherDeleteIntents, shouldUseAreaStorage, WATCHER_REDISCOVERY_RETRY_MS, WATCHER_REDISCOVERY_RETRY_MAX_MS, } from "./sync-runner-watch-loop.js";
23
+ import { adaptivePollMs, advanceMonotonicDeadline, DEFAULT_EVENT_BATCH_LIMIT, DEFAULT_FAST_LANE_MAX_BYTES, DEFAULT_FAST_LANE_MAX_FILE_BYTES, DEFAULT_FAST_LANE_MAX_FILES, DEFAULT_FULL_RECONCILE_MS, EVENT_BATCH_LIMIT_ENV, FAST_LANE_MAX_BYTES_ENV, FAST_LANE_MAX_FILES_ENV, FULL_RECONCILE_MS_ENV, isFastLocalBatch, isFastReceiverBatch, partitionLocalBatch, journalEntriesForWatcherDelete, resolveEventBatchLimit, resolveFullReconcileMs, resolveWatchPollMs, CHORE_STARVATION_CAP_MS, CooperativePassScheduler, REALTIME_ADMISSION_DEADLINE_MS, REALTIME_DRAIN_BURST_MS, RealtimeAdmissionTimeoutError, setRealtimeAdmissionDeadlineMsForTesting, setRealtimeDrainBurstMsForTesting, normalizeCoordinatorPaths, shouldQuarantineWatcherDeleteIntents, shouldUseAreaStorage, WATCHER_REDISCOVERY_RETRY_MS, WATCHER_REDISCOVERY_RETRY_MAX_MS, } from "./sync-runner-watch-loop.js";
24
24
  import { FullPassCapController, resetFullPassCapLogForTest, } from "../sync/full-pass-caps.js";
25
25
  import { AreaLedgerMigration, JournalStore, openJournalStateStoreForMigration, PERSONAL_VAULT_JOURNAL_SLUG, readJournal, readJournalScoped, writeJournal, } from "../journal.js";
26
26
  import { AreaLedger } from "../sync/area-ledger.js";
@@ -9262,7 +9262,7 @@ describe("CooperativePassScheduler", () => {
9262
9262
  "realtime-after-cap",
9263
9263
  ]);
9264
9264
  });
9265
- it("lets an in-flight realtime drain finish past the burst bound without making a new arrival wait for it", async () => {
9265
+ it("lets an in-flight realtime drain finish past the burst bound and admits no further items until the next checkpoint", async () => {
9266
9266
  expect(REALTIME_DRAIN_BURST_MS).toBe(REALTIME_ADMISSION_DEADLINE_MS);
9267
9267
  setRealtimeDrainBurstMsForTesting(40);
9268
9268
  let now = 0;
@@ -9272,10 +9272,6 @@ describe("CooperativePassScheduler", () => {
9272
9272
  const checkpointReady = new Promise((resolve) => {
9273
9273
  releaseCheckpoint = resolve;
9274
9274
  });
9275
- let releaseFirst = () => { };
9276
- const firstGate = new Promise((resolve) => {
9277
- releaseFirst = resolve;
9278
- });
9279
9275
  const chore = scheduler.submit(async ({ checkpoint }) => {
9280
9276
  order.push("chore-before");
9281
9277
  await checkpointReady;
@@ -9289,31 +9285,28 @@ describe("CooperativePassScheduler", () => {
9289
9285
  const first = scheduler.submit(async ({ signal }) => {
9290
9286
  order.push("realtime-start");
9291
9287
  now = 45;
9292
- await firstGate;
9288
+ await new Promise((resolve) => {
9289
+ setTimeout(resolve, 60);
9290
+ });
9293
9291
  expect(signal.aborted).toBe(false);
9294
9292
  order.push("realtime-done");
9295
9293
  return 0;
9296
9294
  }, "realtime");
9297
- releaseCheckpoint();
9298
- await new Promise((resolve) => setTimeout(resolve, 2));
9299
- expect(order).toContain("realtime-start");
9300
9295
  const second = scheduler.submit(async () => {
9301
9296
  order.push("realtime-second");
9302
9297
  return 0;
9303
9298
  }, "realtime");
9304
- await new Promise((resolve) => setTimeout(resolve, 5));
9305
- expect(order).toContain("realtime-second");
9306
- expect(order.indexOf("realtime-second")).toBeLessThan(order.includes("realtime-done") ? order.indexOf("realtime-done") : order.length);
9307
- releaseFirst();
9299
+ await new Promise((resolve) => setTimeout(resolve, 2));
9300
+ releaseCheckpoint();
9308
9301
  await expect(first).resolves.toBe(0);
9309
- await expect(second).resolves.toBe(0);
9310
9302
  await chore;
9303
+ await second;
9311
9304
  expect(order).toEqual([
9312
9305
  "chore-before",
9313
9306
  "realtime-start",
9314
- "realtime-second",
9315
9307
  "realtime-done",
9316
9308
  "chore-mid",
9309
+ "realtime-second",
9317
9310
  "chore-after",
9318
9311
  ]);
9319
9312
  });
@@ -9350,26 +9343,13 @@ describe("CooperativePassScheduler", () => {
9350
9343
  return 0;
9351
9344
  }, "realtime");
9352
9345
  releaseCheckpoint();
9353
- await vi.advanceTimersByTimeAsync(0);
9354
- expect(order).toContain("put-start");
9355
- const arrivedAt = now;
9356
- let nextStartedAt = null;
9357
- const next = scheduler.submit(async () => {
9358
- nextStartedAt = now;
9359
- order.push("next-start");
9360
- return 0;
9361
- }, "realtime");
9362
- await vi.advanceTimersByTimeAsync(30_000);
9363
- expect(nextStartedAt).not.toBeNull();
9364
- expect((nextStartedAt ?? Number.POSITIVE_INFINITY) - arrivedAt).toBeLessThanOrEqual(30_000);
9365
- expect(order).not.toContain("put-done");
9366
- await vi.advanceTimersByTimeAsync(15_000);
9367
- await expect(Promise.all([chore, put, next])).resolves.toEqual([0, 0, 0]);
9346
+ const finished = Promise.all([chore, put]);
9347
+ await vi.advanceTimersByTimeAsync(45_000);
9348
+ await expect(finished).resolves.toEqual([0, 0]);
9368
9349
  expect(abortCount).toBe(0);
9369
9350
  expect(order).toEqual([
9370
9351
  "chore-before",
9371
9352
  "put-start",
9372
- "next-start",
9373
9353
  "put-done",
9374
9354
  "chore-after",
9375
9355
  ]);
@@ -9378,70 +9358,6 @@ describe("CooperativePassScheduler", () => {
9378
9358
  vi.useRealTimers();
9379
9359
  }
9380
9360
  });
9381
- it("starts a 1-item realtime push within 30s while a 24-item execute is still in flight", async () => {
9382
- expect(REALTIME_WORKER_OCCUPANCY_CAP).toBe(2);
9383
- expect(REALTIME_DRAIN_BURST_MS).toBe(30_000);
9384
- vi.useFakeTimers();
9385
- try {
9386
- let now = 0;
9387
- const scheduler = new CooperativePassScheduler(() => now);
9388
- const order = [];
9389
- let abortCount = 0;
9390
- let releaseCheckpoint = () => { };
9391
- const checkpointReady = new Promise((resolve) => {
9392
- releaseCheckpoint = resolve;
9393
- });
9394
- const chore = scheduler.submit(async ({ checkpoint }) => {
9395
- order.push("chore-before");
9396
- await checkpointReady;
9397
- await checkpoint();
9398
- order.push("chore-after");
9399
- return 0;
9400
- }, "chore");
9401
- await Promise.resolve();
9402
- const batchMs = 15 * 60_000;
9403
- const batch = scheduler.submit(async ({ signal }) => {
9404
- order.push("batch-start");
9405
- signal.addEventListener("abort", () => {
9406
- abortCount += 1;
9407
- }, { once: true });
9408
- await new Promise((resolve) => {
9409
- setTimeout(resolve, batchMs);
9410
- });
9411
- expect(signal.aborted).toBe(false);
9412
- order.push("batch-done");
9413
- return 0;
9414
- }, "realtime");
9415
- releaseCheckpoint();
9416
- await vi.advanceTimersByTimeAsync(0);
9417
- expect(order).toEqual(["chore-before", "batch-start"]);
9418
- now = 2 * 60_000;
9419
- const arrivedAt = now;
9420
- let plantStartedAt = null;
9421
- const plant = scheduler.submit(async () => {
9422
- plantStartedAt = now;
9423
- order.push("plant-start");
9424
- return 0;
9425
- }, "realtime");
9426
- await vi.advanceTimersByTimeAsync(30_000);
9427
- expect(plantStartedAt).not.toBeNull();
9428
- expect((plantStartedAt ?? Number.POSITIVE_INFINITY) - arrivedAt).toBeLessThanOrEqual(30_000);
9429
- expect(order).not.toContain("batch-done");
9430
- await vi.advanceTimersByTimeAsync(batchMs);
9431
- await expect(Promise.all([chore, batch, plant])).resolves.toEqual([0, 0, 0]);
9432
- expect(abortCount).toBe(0);
9433
- expect(order).toEqual([
9434
- "chore-before",
9435
- "batch-start",
9436
- "plant-start",
9437
- "batch-done",
9438
- "chore-after",
9439
- ]);
9440
- }
9441
- finally {
9442
- vi.useRealTimers();
9443
- }
9444
- });
9445
9361
  afterEach(() => {
9446
9362
  setRealtimeAdmissionDeadlineMsForTesting(undefined);
9447
9363
  setRealtimeDrainBurstMsForTesting(undefined);