@indigoai-us/hq-cloud 6.18.11 → 6.18.12-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.
Files changed (103) hide show
  1. package/dist/bin/sync-runner-args.test.d.ts +2 -0
  2. package/dist/bin/sync-runner-args.test.d.ts.map +1 -0
  3. package/dist/bin/sync-runner-args.test.js +82 -0
  4. package/dist/bin/sync-runner-args.test.js.map +1 -0
  5. package/dist/bin/sync-runner-company.d.ts +1 -0
  6. package/dist/bin/sync-runner-company.d.ts.map +1 -1
  7. package/dist/bin/sync-runner-company.js +3 -0
  8. package/dist/bin/sync-runner-company.js.map +1 -1
  9. package/dist/bin/sync-runner-company.test.js +31 -0
  10. package/dist/bin/sync-runner-company.test.js.map +1 -1
  11. package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts +2 -0
  12. package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.d.ts.map +1 -0
  13. package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js +500 -0
  14. package/dist/bin/sync-runner-delete-snapshot-mixed.bench.test.js.map +1 -0
  15. package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts +2 -0
  16. package/dist/bin/sync-runner-delete-snapshot.bench.test.d.ts.map +1 -0
  17. package/dist/bin/sync-runner-delete-snapshot.bench.test.js +317 -0
  18. package/dist/bin/sync-runner-delete-snapshot.bench.test.js.map +1 -0
  19. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  20. package/dist/bin/sync-runner-watch-loop.js +195 -20
  21. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  22. package/dist/bin/sync-runner-watch-loop.test.js +71 -0
  23. package/dist/bin/sync-runner-watch-loop.test.js.map +1 -1
  24. package/dist/bin/sync-runner-watch-routes.d.ts +2 -1
  25. package/dist/bin/sync-runner-watch-routes.d.ts.map +1 -1
  26. package/dist/bin/sync-runner-watch-routes.js +7 -2
  27. package/dist/bin/sync-runner-watch-routes.js.map +1 -1
  28. package/dist/bin/sync-runner-watch-routes.test.js +15 -0
  29. package/dist/bin/sync-runner-watch-routes.test.js.map +1 -1
  30. package/dist/bin/sync-runner.d.ts +71 -1
  31. package/dist/bin/sync-runner.d.ts.map +1 -1
  32. package/dist/bin/sync-runner.js +52 -1
  33. package/dist/bin/sync-runner.js.map +1 -1
  34. package/dist/bin/sync-runner.test.js +119 -3
  35. package/dist/bin/sync-runner.test.js.map +1 -1
  36. package/dist/cli/share.d.ts.map +1 -1
  37. package/dist/cli/share.js +2 -0
  38. package/dist/cli/share.js.map +1 -1
  39. package/dist/cli/share.test.js +76 -0
  40. package/dist/cli/share.test.js.map +1 -1
  41. package/dist/cli/sync.d.ts +13 -2
  42. package/dist/cli/sync.d.ts.map +1 -1
  43. package/dist/cli/sync.js +81 -4
  44. package/dist/cli/sync.js.map +1 -1
  45. package/dist/cli/sync.test.js +228 -0
  46. package/dist/cli/sync.test.js.map +1 -1
  47. package/dist/ignore.d.ts.map +1 -1
  48. package/dist/ignore.js +3 -0
  49. package/dist/ignore.js.map +1 -1
  50. package/dist/ignore.test.js +8 -0
  51. package/dist/ignore.test.js.map +1 -1
  52. package/dist/journal.d.ts +15 -0
  53. package/dist/journal.d.ts.map +1 -1
  54. package/dist/journal.js +66 -2
  55. package/dist/journal.js.map +1 -1
  56. package/dist/journal.test.js +16 -1
  57. package/dist/journal.test.js.map +1 -1
  58. package/dist/manifest/build-manifest-resident-parity.test.js +5 -3
  59. package/dist/manifest/build-manifest-resident-parity.test.js.map +1 -1
  60. package/dist/sync/area-ledger.d.ts +1 -0
  61. package/dist/sync/area-ledger.d.ts.map +1 -1
  62. package/dist/sync/area-ledger.js +54 -17
  63. package/dist/sync/area-ledger.js.map +1 -1
  64. package/dist/sync/area-ledger.test.js +109 -0
  65. package/dist/sync/area-ledger.test.js.map +1 -1
  66. package/dist/sync/content-hash.d.ts +4 -0
  67. package/dist/sync/content-hash.d.ts.map +1 -0
  68. package/dist/sync/content-hash.js +11 -0
  69. package/dist/sync/content-hash.js.map +1 -0
  70. package/dist/sync/content-hash.test.d.ts +2 -0
  71. package/dist/sync/content-hash.test.d.ts.map +1 -0
  72. package/dist/sync/content-hash.test.js +16 -0
  73. package/dist/sync/content-hash.test.js.map +1 -0
  74. package/dist/sync/event-sync.d.ts.map +1 -1
  75. package/dist/sync/event-sync.js +58 -1
  76. package/dist/sync/event-sync.js.map +1 -1
  77. package/dist/sync/event-sync.test.js +46 -0
  78. package/dist/sync/event-sync.test.js.map +1 -1
  79. package/dist/sync/logger.test.js +3 -0
  80. package/dist/sync/logger.test.js.map +1 -1
  81. package/dist/sync/metrics.test.js +3 -0
  82. package/dist/sync/metrics.test.js.map +1 -1
  83. package/dist/sync/push-receiver.d.ts +52 -0
  84. package/dist/sync/push-receiver.d.ts.map +1 -1
  85. package/dist/sync/push-receiver.js +416 -50
  86. package/dist/sync/push-receiver.js.map +1 -1
  87. package/dist/sync/push-receiver.test.js +673 -40
  88. package/dist/sync/push-receiver.test.js.map +1 -1
  89. package/dist/sync/unchanged-push-events.d.ts +16 -0
  90. package/dist/sync/unchanged-push-events.d.ts.map +1 -0
  91. package/dist/sync/unchanged-push-events.js +51 -0
  92. package/dist/sync/unchanged-push-events.js.map +1 -0
  93. package/dist/sync/unchanged-push-events.test.d.ts +2 -0
  94. package/dist/sync/unchanged-push-events.test.d.ts.map +1 -0
  95. package/dist/sync/unchanged-push-events.test.js +76 -0
  96. package/dist/sync/unchanged-push-events.test.js.map +1 -0
  97. package/dist/watcher.d.ts +18 -0
  98. package/dist/watcher.d.ts.map +1 -1
  99. package/dist/watcher.js +78 -13
  100. package/dist/watcher.js.map +1 -1
  101. package/dist/watcher.test.js +72 -0
  102. package/dist/watcher.test.js.map +1 -1
  103. package/package.json +2 -1
@@ -17,7 +17,8 @@ import { TreeWatcher, resolveEventDebounceConfig, systemClock, } from "../watche
17
17
  import { recoverHqRootLocalState } from "../hq-root-recovery.js";
18
18
  import { clearLocalDeleteIntent, getStateDir, markLocalDeleteIntent, PERSONAL_VAULT_JOURNAL_SLUG, openJournalStoreSession, openJournalStoreSessionAsync, listJournalSlugs, listJournals, maintainAreaJournalSlice, disposeScopedJournalStores, releaseScopedJournalStore, releaseCachedAreaJournalMigrations, journalCacheCensusSizes, emitJournalCacheMetric, journalRows, readJournalScoped, writeJournal, } from "../journal.js";
19
19
  import { isPersonalVaultDeletionExcluded } from "../personal-vault.js";
20
- import { NoopPushReceiver, } from "../sync/push-receiver.js";
20
+ import { NoopPushReceiver, ReceiverDispatchError, isReceiverTransportFailure, } from "../sync/push-receiver.js";
21
+ import { CONTENT_HASH_PATTERN } from "../sync/push-event.js";
21
22
  import { resolveEventSync, startEventSync as defaultStartEventSync, } from "../sync/event-sync.js";
22
23
  import { resolveAreaStorageEnabled, resolveEffectiveParallelSyncRollout, resolveParallelSyncRollout, } from "../sync/feature-flags.js";
23
24
  import { resolveAreaLayoutAuthority } from "../sync/area-ledger-migration.js";
@@ -31,7 +32,7 @@ import { createHqFlagsCapSource, FullPassCapController, } from "../sync/full-pas
31
32
  import { DEFAULT_REALTIME_AUTHORIZATION_TIMEOUT_MS } from "../sync/realtime-rollout.js";
32
33
  import { RealtimeTelemetrySpan, writeRealtimeTelemetryToStderr, } from "../sync/realtime-telemetry.js";
33
34
  import { InlineSyncWorkerAdapter, } from "../sync/sync-work.js";
34
- import { buildRoutePullArgv, buildScopedPushArgv, buildScopedDrainPullArgv, buildTargetedPullArgv, isWatchRouteSelected, routeChangeToTarget, routeKey, } from "./sync-runner-watch-routes.js";
35
+ import { buildRoutePullArgv, buildScopedPushArgv, buildScopedDrainPullArgv, buildTargetedPullArgv, isWatchRouteSelected, routeChangeToTarget, routeKey, scopePathForRoute, } from "./sync-runner-watch-routes.js";
35
36
  import { resolveSkipCompanies } from "./sync-runner-planning.js";
36
37
  const FULL_RECONCILE_EVERY_TICKS = 10;
37
38
  /** Maximum time shutdown waits for event-sync startup before abandoning it. */
@@ -1215,6 +1216,33 @@ export function advanceMonotonicDeadline(previousDueAt, now, intervalMs) {
1215
1216
  nextDueAt = now + intervalMs;
1216
1217
  return { nextDueAt, delayMs: intervalMs };
1217
1218
  }
1219
+ async function withScopeContentHashesFile(route, events, scopedPaths, run) {
1220
+ const targetPaths = new Set(scopedPaths
1221
+ .map((relativePath) => scopePathForRoute(route, relativePath))
1222
+ .filter((relativePath) => relativePath !== null));
1223
+ const contentHashes = Object.create(null);
1224
+ for (const event of events) {
1225
+ if (event.kind !== "upsert" ||
1226
+ !event.contentHash ||
1227
+ !CONTENT_HASH_PATTERN.test(event.contentHash))
1228
+ continue;
1229
+ const scopePath = scopePathForRoute(route, event.relativePath);
1230
+ if (scopePath !== null && targetPaths.has(scopePath)) {
1231
+ contentHashes[scopePath] = event.contentHash;
1232
+ }
1233
+ }
1234
+ if (Object.keys(contentHashes).length === 0)
1235
+ return run();
1236
+ const temporaryDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "hq-sync-pull-content-hashes-"));
1237
+ const contentHashesFile = path.join(temporaryDirectory, "hashes.json");
1238
+ try {
1239
+ fs.writeFileSync(contentHashesFile, JSON.stringify(contentHashes), { mode: 0o600 });
1240
+ return await run(contentHashesFile);
1241
+ }
1242
+ finally {
1243
+ fs.rmSync(temporaryDirectory, { recursive: true, force: true });
1244
+ }
1245
+ }
1218
1246
  /**
1219
1247
  * Select journal entries covered by one watcher delete. Exact file unlinks
1220
1248
  * deliberately avoid enumeration; only directory unlinks expand descendants.
@@ -1284,6 +1312,22 @@ function isBulkIntentOverride() {
1284
1312
  function passExitCode(outcome) {
1285
1313
  return typeof outcome === "number" ? outcome : outcome.exitCode;
1286
1314
  }
1315
+ function targetedReceiverDispatchError(outcome, accepted, authRequiredExitCode) {
1316
+ const exitCode = passExitCode(outcome);
1317
+ const result = typeof outcome === "number" ? undefined : outcome.result;
1318
+ const diagnostics = [
1319
+ ...(result?.errors ?? []).map(({ company, message }) => `${company}: ${message}`),
1320
+ ...(result?.transient ?? []).map(({ company, message }) => `${company}: ${message}`),
1321
+ ...(result?.companyFailures ?? []).map(({ company, message }) => `${company}: ${message}`),
1322
+ ];
1323
+ const failureReason = `targeted pull failed with exit code ${exitCode}, accepted=${accepted}` +
1324
+ (diagnostics.length === 0 ? "" : `: ${[...new Set(diagnostics)].join("; ")}`);
1325
+ const isTransportFailure = exitCode === authRequiredExitCode ||
1326
+ exitCode === TRANSIENT_NETWORK_EXIT ||
1327
+ (result?.transient?.length ?? 0) > 0 ||
1328
+ isReceiverTransportFailure(failureReason);
1329
+ return new ReceiverDispatchError(isTransportFailure ? "transport" : "path-specific", failureReason);
1330
+ }
1287
1331
  /**
1288
1332
  * Exit code for one scoped/catch-up route. A 404 company route returns
1289
1333
  * UNRESOLVED_COMPANY_EXIT from the runner; that must not poison the rest of
@@ -2646,6 +2690,137 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
2646
2690
  }
2647
2691
  return snapshots;
2648
2692
  };
2693
+ /**
2694
+ * Fold file unlinks in each watcher-turn run into one durable delta per
2695
+ * journal. Directory deletes are ordered barriers: flush the preceding file
2696
+ * run, apply the directory event through its existing path, then continue.
2697
+ * That preserves quarantine and descendant-revocation semantics without
2698
+ * sending every file in a mixed burst through a per-item append.
2699
+ */
2700
+ const captureQueuedLocalDeleteSnapshotsBatch = async (captures) => {
2701
+ const results = captures.map(() => []);
2702
+ if (captures.length === 0)
2703
+ return results;
2704
+ const captureFileUnlinkGroup = async (scoped) => {
2705
+ if (scoped.length === 0)
2706
+ return;
2707
+ const slug = scoped[0].coordinates.slug;
2708
+ const session = await watcherJournalStoreAsync(slug);
2709
+ await session.refreshAsync();
2710
+ const changed = new Map();
2711
+ const owners = new Map();
2712
+ const snapshots = new Map();
2713
+ const own = (key, index) => {
2714
+ const indexes = owners.get(key) ?? new Set();
2715
+ indexes.add(index);
2716
+ owners.set(key, indexes);
2717
+ };
2718
+ for (const item of scoped) {
2719
+ if (!item.capture.isCurrent())
2720
+ continue;
2721
+ const key = item.coordinates.key;
2722
+ const entry = changed.get(key) ?? session.get(key);
2723
+ if (!entry)
2724
+ continue;
2725
+ if (quarantineRootFor(item.coordinates.slug, key)) {
2726
+ const next = structuredClone(entry);
2727
+ const journal = {
2728
+ version: "2", lastSync: "", files: { [key]: next }, pulls: [],
2729
+ };
2730
+ if (clearLocalDeleteIntent(journal, key)) {
2731
+ changed.set(key, journalRows(journal).get(key));
2732
+ own(key, item.index);
2733
+ }
2734
+ continue;
2735
+ }
2736
+ if (!entry.remoteEtag || !entry.kind || entry.removedAt !== undefined)
2737
+ continue;
2738
+ const snapshot = {
2739
+ journalSlug: item.coordinates.slug,
2740
+ journalPath: key,
2741
+ deleteScopeRoot: item.coordinates.key,
2742
+ absolutePath: item.route.kind === "company"
2743
+ ? path.join(hqRoot, "companies", item.route.slug, key)
2744
+ : path.join(hqRoot, key),
2745
+ remoteEtag: entry.remoteEtag,
2746
+ localHash: entry.hash,
2747
+ localKind: entry.kind,
2748
+ };
2749
+ const next = structuredClone(entry);
2750
+ const journal = {
2751
+ version: "2", lastSync: "", files: { [key]: next }, pulls: [],
2752
+ };
2753
+ if (!markLocalDeleteIntent(journal, key, snapshot.localHash, snapshot.localKind, snapshot.remoteEtag))
2754
+ continue;
2755
+ changed.set(key, journalRows(journal).get(key));
2756
+ own(key, item.index);
2757
+ const perCapture = snapshots.get(item.index) ?? [];
2758
+ perCapture.push(snapshot);
2759
+ snapshots.set(item.index, perCapture);
2760
+ }
2761
+ const persistedKeys = new Set();
2762
+ const changedEntries = [...changed];
2763
+ const maxDeltaRows = 1_000;
2764
+ for (let offset = 0; offset < changedEntries.length; offset += maxDeltaRows) {
2765
+ const chunk = changedEntries.slice(offset, offset + maxDeltaRows);
2766
+ let chunkPersistedKeys = new Set();
2767
+ const persisted = await session.applyDeltaGeneratedAsync(() => {
2768
+ const accepted = chunk.filter(([key]) => [...(owners.get(key) ?? [])].some((index) => captures[index]?.isCurrent()));
2769
+ chunkPersistedKeys = new Set(accepted.map(([key]) => key));
2770
+ if (accepted.length === 0)
2771
+ return undefined;
2772
+ return { upserts: Object.fromEntries(accepted) };
2773
+ });
2774
+ if (persisted) {
2775
+ for (const key of chunkPersistedKeys)
2776
+ persistedKeys.add(key);
2777
+ }
2778
+ if (offset + maxDeltaRows < changedEntries.length) {
2779
+ await new Promise((resolve) => setImmediate(resolve));
2780
+ }
2781
+ }
2782
+ for (const [index, values] of snapshots) {
2783
+ if (!captures[index]?.isCurrent())
2784
+ continue;
2785
+ results[index] = values.filter((snapshot) => persistedKeys.has(snapshot.journalPath));
2786
+ }
2787
+ };
2788
+ const fileRun = [];
2789
+ const flushFileRun = async () => {
2790
+ if (fileRun.length === 0)
2791
+ return;
2792
+ const groupsByJournal = new Map();
2793
+ for (const item of fileRun) {
2794
+ const group = groupsByJournal.get(item.coordinates.slug) ?? [];
2795
+ group.push(item);
2796
+ groupsByJournal.set(item.coordinates.slug, group);
2797
+ }
2798
+ fileRun.length = 0;
2799
+ // Map iteration preserves the first-seen journal order within this run;
2800
+ // rows inside each journal retain their original watcher order.
2801
+ for (const group of groupsByJournal.values()) {
2802
+ await captureFileUnlinkGroup(group);
2803
+ }
2804
+ };
2805
+ for (let index = 0; index < captures.length; index += 1) {
2806
+ const capture = captures[index];
2807
+ if (capture.kind === "unlinkDir") {
2808
+ await flushFileRun();
2809
+ results[index] = await captureQueuedLocalDeleteSnapshots(capture.relativePath, capture.kind, capture.isCurrent);
2810
+ continue;
2811
+ }
2812
+ const coordinates = journalCoordinates(capture.relativePath, capture.kind);
2813
+ const route = routeChangeToTarget(capture.relativePath, capture.kind);
2814
+ if (!coordinates || !route)
2815
+ continue;
2816
+ if (route.kind === "company" &&
2817
+ resolveSkipCompanies().has(route.slug.toLowerCase()))
2818
+ continue;
2819
+ fileRun.push({ index, capture, coordinates, route });
2820
+ }
2821
+ await flushFileRun();
2822
+ return results;
2823
+ };
2649
2824
  const warmupJournalPaths = function* () {
2650
2825
  const journals = listJournals();
2651
2826
  const vaultJournalPresent = journals.some(({ slug }) => slug === PERSONAL_VAULT_JOURNAL_SLUG);
@@ -3170,6 +3345,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
3170
3345
  onDegraded: opts.onDegraded,
3171
3346
  captureLocalDeleteSnapshots: opts.captureLocalDeleteSnapshots,
3172
3347
  queueLocalDeleteSnapshots: opts.queueLocalDeleteSnapshots,
3348
+ queueLocalDeleteSnapshotsBatch: opts.queueLocalDeleteSnapshotsBatch,
3173
3349
  isUntrackedDelete: opts.isUntrackedDelete,
3174
3350
  telemetryClient: watcherTelemetryClient,
3175
3351
  telemetryClaims: claims,
@@ -3198,6 +3374,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
3198
3374
  },
3199
3375
  captureLocalDeleteSnapshots,
3200
3376
  queueLocalDeleteSnapshots: captureQueuedLocalDeleteSnapshots,
3377
+ queueLocalDeleteSnapshotsBatch: captureQueuedLocalDeleteSnapshotsBatch,
3201
3378
  isUntrackedDelete,
3202
3379
  });
3203
3380
  activeWatcherGeneration = ++watcherGeneration;
@@ -3373,14 +3550,16 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
3373
3550
  // Submit every route in this lane before awaiting any result. In
3374
3551
  // particular, a later route's fast receipt must never wait for an
3375
3552
  // earlier route's slow pull to finish.
3376
- const completed = await Promise.all([...eventsByRoute.values()].map(({ route, events }) => runRealtimePass("receiver", "pull", events.map((event) => event.relativePath), lane, (slice, telemetry, coordinatorFenced) => {
3377
- const slicePaths = slice.paths.map((path) => path.canonicalPath);
3378
- const exactFileUpserts = exactUpsertPathsForCoordinatorSlice(events, slicePaths);
3379
- return runGuarded(buildTargetedPullArgv(route, passArgv, slicePaths, exactFileUpserts), undefined, lane, "realtime", lane === "fast", slice.signal, false, telemetry, coordinatorFenced);
3380
- })));
3553
+ const completed = await Promise.all([...eventsByRoute.values()].map(({ route, events }) => {
3554
+ return runRealtimePass("receiver", "pull", events.map((event) => event.relativePath), lane, (slice, telemetry, coordinatorFenced) => {
3555
+ const slicePaths = slice.paths.map((path) => path.canonicalPath);
3556
+ const exactFileUpserts = exactUpsertPathsForCoordinatorSlice(events, slicePaths);
3557
+ return withScopeContentHashesFile(route, events, slicePaths, (contentHashesFile) => runGuarded(buildTargetedPullArgv(route, passArgv, slicePaths, exactFileUpserts, contentHashesFile), undefined, lane, "realtime", lane === "fast", slice.signal, false, telemetry, coordinatorFenced));
3558
+ });
3559
+ }));
3381
3560
  for (const execution of completed) {
3382
3561
  if (!execution.accepted || passExitCode(execution.result) !== 0) {
3383
- throw new Error(`targeted pull failed with exit code ${passExitCode(execution.result)}`);
3562
+ throw targetedReceiverDispatchError(execution.result, execution.accepted, runtime.authRequiredPassExit);
3384
3563
  }
3385
3564
  }
3386
3565
  };
@@ -3415,7 +3594,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
3415
3594
  }
3416
3595
  const lanes = partitionByKnownSizes(events, receiverEventSize);
3417
3596
  const drainLane = async (lane, laneEvents) => {
3418
- const pathsByRoute = new Map();
3597
+ const eventsByRoute = new Map();
3419
3598
  for (const event of laneEvents) {
3420
3599
  const route = routeChangeToTarget(event.relativePath);
3421
3600
  // The receiver is an independent ingress from the local watcher.
@@ -3425,21 +3604,17 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
3425
3604
  if (!route || !isWatchRouteSelected(route, watchRouteSelection))
3426
3605
  continue;
3427
3606
  const key = routeKey(route);
3428
- const group = pathsByRoute.get(key) ?? {
3429
- route,
3430
- paths: [],
3431
- upsertPaths: [],
3432
- };
3433
- group.paths.push(event.relativePath);
3607
+ const group = eventsByRoute.get(key) ?? { route, events: [], upsertPaths: [] };
3608
+ group.events.push(event);
3434
3609
  if (event.kind === "upsert")
3435
3610
  group.upsertPaths.push(event.relativePath);
3436
- pathsByRoute.set(key, group);
3611
+ eventsByRoute.set(key, group);
3437
3612
  }
3438
- for (const { route, paths, upsertPaths } of pathsByRoute.values()) {
3439
- const targetedArgv = buildTargetedPullArgv(route, passArgv, paths, upsertPaths);
3440
- const result = await runGuarded(targetedArgv, undefined, lane, "realtime");
3613
+ for (const { route, events: routeEvents, upsertPaths } of eventsByRoute.values()) {
3614
+ const paths = routeEvents.map((event) => event.relativePath);
3615
+ const result = await withScopeContentHashesFile(route, routeEvents, paths, (contentHashesFile) => runGuarded(buildTargetedPullArgv(route, passArgv, paths, upsertPaths, contentHashesFile), undefined, lane, "realtime"));
3441
3616
  if (passExitCode(result) !== 0) {
3442
- throw new Error(`targeted pull failed with exit code ${passExitCode(result)}`);
3617
+ throw targetedReceiverDispatchError(result, true, runtime.authRequiredPassExit);
3443
3618
  }
3444
3619
  }
3445
3620
  };