@indigoai-us/hq-cloud 6.16.8 → 6.16.10
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/sync-runner-watch-loop.d.ts +21 -7
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +79 -21
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.test.js +40 -1
- package/dist/bin/sync-runner-watch-loop.test.js.map +1 -1
- package/dist/bin/sync-runner.test.js +147 -38
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/journal.d.ts +1 -0
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +1 -1
- package/dist/journal.js.map +1 -1
- package/dist/sync/area-ledger.d.ts.map +1 -1
- package/dist/sync/area-ledger.js +13 -3
- package/dist/sync/area-ledger.js.map +1 -1
- package/dist/sync/area-ledger.test.js +43 -0
- package/dist/sync/area-ledger.test.js.map +1 -1
- package/dist/sync/state-store.d.ts +7 -0
- package/dist/sync/state-store.d.ts.map +1 -1
- package/dist/sync/state-store.js +113 -17
- package/dist/sync/state-store.js.map +1 -1
- package/dist/sync/state-store.test.js +79 -1
- package/dist/sync/state-store.test.js.map +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -12,13 +12,15 @@ import type { Direction, RunnerLoopDeps, RunnerPassOutcome } from "./sync-runner
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function shouldUseAreaStorage(areaStorage: boolean | FeatureSwitch, stateDir: string, journalSlug: string): boolean;
|
|
14
14
|
/**
|
|
15
|
-
* Targeted-pass batch limit:
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `HQ_SYNC_EVENT_BATCH_LIMIT` overrides; 0/invalid
|
|
15
|
+
* Targeted-pass batch limit: a fully-enumerated event batch larger than this
|
|
16
|
+
* is drained in bounded chunks across successive ticks instead of one giant
|
|
17
|
+
* scoped pass. Size is not a full-reconcile signal — unknown scope is
|
|
18
|
+
* (`overflowed` with no route hints, warm-up catch-up failure, first tick,
|
|
19
|
+
* scheduled interval, bare wake). The crossover for a *chunk* is the number
|
|
20
|
+
* of `--scope-path` arguments a targeted pass can carry without becoming a
|
|
21
|
+
* de-facto whole-tree walk. `HQ_SYNC_EVENT_BATCH_LIMIT` overrides; 0/invalid
|
|
22
|
+
* = default. Do not raise this to "fix" a large warm-up catch-up: that only
|
|
23
|
+
* moves the cliff.
|
|
22
24
|
*/
|
|
23
25
|
export declare const DEFAULT_EVENT_BATCH_LIMIT = 10000;
|
|
24
26
|
export declare const EVENT_BATCH_LIMIT_ENV = "HQ_SYNC_EVENT_BATCH_LIMIT";
|
|
@@ -98,6 +100,18 @@ export declare function isFastLocalBatch(paths: Iterable<string>, changes?: Read
|
|
|
98
100
|
/** A receiver event needs a known small upsert size before it can go realtime. */
|
|
99
101
|
export declare function isFastReceiverBatch(eventCount: number): boolean;
|
|
100
102
|
export declare function resolveEventBatchLimit(env?: Record<string, string | undefined>): number;
|
|
103
|
+
/**
|
|
104
|
+
* Take the next bounded slice of a fully-enumerated watcher batch and leave
|
|
105
|
+
* the rest for a later tick. Insertion order is preserved so a killed or
|
|
106
|
+
* stalled runner that already drained earlier chunks does not restart the
|
|
107
|
+
* whole batch: remaining paths stay queued. Overflow metadata is not copied
|
|
108
|
+
* onto either side — callers must not use this helper for unknown-scope
|
|
109
|
+
* overflow (those batches still full-reconcile).
|
|
110
|
+
*/
|
|
111
|
+
export declare function takeEnumeratedBatchChunk(batch: TreeChangeBatch, limit: number): {
|
|
112
|
+
chunk: TreeChangeBatch;
|
|
113
|
+
remainder: TreeChangeBatch | null;
|
|
114
|
+
};
|
|
101
115
|
/**
|
|
102
116
|
* Optional elapsed-time cadence for full reconciles. Leaving this unset keeps
|
|
103
117
|
* the legacy every-`FULL_RECONCILE_EVERY_TICKS` cadence exactly intact; set
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAqBA,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAUL,WAAW,EAKZ,MAAM,eAAe,CAAC;AAYvB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AASlC,OAAO,EACL,UAAU,EAoCX,MAAM,iCAAiC,CAAC;AAUzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAYhD,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,iBAAiB,EAElB,MAAM,kBAAkB,CAAC;AAK1B;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,OAAO,GAAG,aAAa,EACpC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAMT;
|
|
1
|
+
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAqBA,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAUL,WAAW,EAKZ,MAAM,eAAe,CAAC;AAYvB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AASlC,OAAO,EACL,UAAU,EAoCX,MAAM,iCAAiC,CAAC;AAUzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAYhD,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,iBAAiB,EAElB,MAAM,kBA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AAE,QAAQ,GAAG,WAAW,GAC3B,KAAK,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CASvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,iDAAiD,CAC/D,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS,EACzC,gBAAgB,EAAE,MAAM,GACvB,MAAM,GAAG,SAAS,CAOpB;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAIT;AA6BD,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CA25FjB"}
|
|
@@ -57,13 +57,15 @@ function emitFullReconcileDecision({ mode, reasons, triggers, pollTick, configur
|
|
|
57
57
|
}) + "\n");
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Targeted-pass batch limit:
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* `HQ_SYNC_EVENT_BATCH_LIMIT` overrides; 0/invalid
|
|
60
|
+
* Targeted-pass batch limit: a fully-enumerated event batch larger than this
|
|
61
|
+
* is drained in bounded chunks across successive ticks instead of one giant
|
|
62
|
+
* scoped pass. Size is not a full-reconcile signal — unknown scope is
|
|
63
|
+
* (`overflowed` with no route hints, warm-up catch-up failure, first tick,
|
|
64
|
+
* scheduled interval, bare wake). The crossover for a *chunk* is the number
|
|
65
|
+
* of `--scope-path` arguments a targeted pass can carry without becoming a
|
|
66
|
+
* de-facto whole-tree walk. `HQ_SYNC_EVENT_BATCH_LIMIT` overrides; 0/invalid
|
|
67
|
+
* = default. Do not raise this to "fix" a large warm-up catch-up: that only
|
|
68
|
+
* moves the cliff.
|
|
67
69
|
*/
|
|
68
70
|
export const DEFAULT_EVENT_BATCH_LIMIT = 10_000;
|
|
69
71
|
export const EVENT_BATCH_LIMIT_ENV = "HQ_SYNC_EVENT_BATCH_LIMIT";
|
|
@@ -276,6 +278,46 @@ export function resolveEventBatchLimit(env = process.env) {
|
|
|
276
278
|
return DEFAULT_EVENT_BATCH_LIMIT;
|
|
277
279
|
return Math.trunc(parsed);
|
|
278
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Take the next bounded slice of a fully-enumerated watcher batch and leave
|
|
283
|
+
* the rest for a later tick. Insertion order is preserved so a killed or
|
|
284
|
+
* stalled runner that already drained earlier chunks does not restart the
|
|
285
|
+
* whole batch: remaining paths stay queued. Overflow metadata is not copied
|
|
286
|
+
* onto either side — callers must not use this helper for unknown-scope
|
|
287
|
+
* overflow (those batches still full-reconcile).
|
|
288
|
+
*/
|
|
289
|
+
export function takeEnumeratedBatchChunk(batch, limit) {
|
|
290
|
+
if (limit <= 0 || batch.paths.size <= limit) {
|
|
291
|
+
return { chunk: batch, remainder: null };
|
|
292
|
+
}
|
|
293
|
+
const chunkPaths = new Map();
|
|
294
|
+
const remainderPaths = new Map();
|
|
295
|
+
let index = 0;
|
|
296
|
+
for (const [absolutePath, relativePath] of batch.paths) {
|
|
297
|
+
if (index < limit)
|
|
298
|
+
chunkPaths.set(absolutePath, relativePath);
|
|
299
|
+
else
|
|
300
|
+
remainderPaths.set(absolutePath, relativePath);
|
|
301
|
+
index += 1;
|
|
302
|
+
}
|
|
303
|
+
const splitChanges = (targetPaths) => {
|
|
304
|
+
if (batch.changes === undefined || batch.changes.size === 0) {
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
const split = new Map();
|
|
308
|
+
for (const absolutePath of targetPaths.keys()) {
|
|
309
|
+
const change = batch.changes.get(absolutePath);
|
|
310
|
+
if (change !== undefined)
|
|
311
|
+
split.set(absolutePath, change);
|
|
312
|
+
}
|
|
313
|
+
return split.size > 0 ? split : undefined;
|
|
314
|
+
};
|
|
315
|
+
const asBatch = (paths, changes) => (changes === undefined ? { paths } : { paths, changes });
|
|
316
|
+
return {
|
|
317
|
+
chunk: asBatch(chunkPaths, splitChanges(chunkPaths)),
|
|
318
|
+
remainder: asBatch(remainderPaths, splitChanges(remainderPaths)),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
279
321
|
/**
|
|
280
322
|
* Optional elapsed-time cadence for full reconciles. Leaving this unset keeps
|
|
281
323
|
* the legacy every-`FULL_RECONCILE_EVERY_TICKS` cadence exactly intact; set
|
|
@@ -2699,14 +2741,6 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2699
2741
|
// (backend resync / hint-cap blowout) still needs the full fanout.
|
|
2700
2742
|
const overflowWithKnownRoutes = pending.batch?.overflowed === true &&
|
|
2701
2743
|
pending.batch.droppedRouteHints !== undefined;
|
|
2702
|
-
// Safety rail: a batch touching more distinct paths than the limit is
|
|
2703
|
-
// treated as a mass change and reconciled with one full pass instead of
|
|
2704
|
-
// hundreds of scoped ones.
|
|
2705
|
-
const batchOverLimit = (pending.batch?.paths.size ?? 0) > resolveEventBatchLimit();
|
|
2706
|
-
if (batchOverLimit) {
|
|
2707
|
-
process.stderr.write(`hq-sync-runner: event batch of ${pending.batch.paths.size} path(s) ` +
|
|
2708
|
-
`exceeds the targeted-pass limit; running a full reconcile\n`);
|
|
2709
|
-
}
|
|
2710
2744
|
const elapsedSinceLastCompletedFullReconcileMs = lastCompletedFullReconcileAt === null
|
|
2711
2745
|
? null
|
|
2712
2746
|
: monotonicNow() - lastCompletedFullReconcileAt;
|
|
@@ -2724,7 +2758,6 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2724
2758
|
"event-push-surfaces-inactive": eventPushSurfacesInactive,
|
|
2725
2759
|
"first-tick": firstTick,
|
|
2726
2760
|
"bare-wake": bareWake,
|
|
2727
|
-
"batch-over-limit": batchOverLimit,
|
|
2728
2761
|
"overflow-routes-unknown": overflowRoutesUnknown,
|
|
2729
2762
|
"watcher-warmup-catch-up": watcherWarmupCatchup,
|
|
2730
2763
|
"watcher-warmup-catch-up-failed": watcherWarmupCatchupFailed,
|
|
@@ -2736,10 +2769,35 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2736
2769
|
const shouldRunFull = eventPushSurfacesInactive ||
|
|
2737
2770
|
firstTick ||
|
|
2738
2771
|
bareWake ||
|
|
2739
|
-
batchOverLimit ||
|
|
2740
2772
|
overflowRoutesUnknown ||
|
|
2741
2773
|
watcherWarmupCatchupFailed ||
|
|
2742
2774
|
scheduledInterval;
|
|
2775
|
+
// Size is not unknown-scope. A fully-enumerated over-limit batch still
|
|
2776
|
+
// has every path listed, so drain it in bounded chunks and keep the
|
|
2777
|
+
// remainder queued. Skip this when a genuine full-reconcile trigger
|
|
2778
|
+
// already owns the tick — that pass covers the whole taken batch.
|
|
2779
|
+
let workingBatch = pending.batch;
|
|
2780
|
+
if (!shouldRunFull &&
|
|
2781
|
+
workingBatch !== null &&
|
|
2782
|
+
workingBatch.overflowed !== true) {
|
|
2783
|
+
const eventBatchLimit = resolveEventBatchLimit();
|
|
2784
|
+
if (workingBatch.paths.size > eventBatchLimit) {
|
|
2785
|
+
const originalSize = workingBatch.paths.size;
|
|
2786
|
+
const split = takeEnumeratedBatchChunk(workingBatch, eventBatchLimit);
|
|
2787
|
+
process.stderr.write(JSON.stringify({
|
|
2788
|
+
type: "watcher-batch-chunked",
|
|
2789
|
+
batchPathCount: originalSize,
|
|
2790
|
+
chunkPathCount: split.chunk.paths.size,
|
|
2791
|
+
remainingPathCount: split.remainder?.paths.size ?? 0,
|
|
2792
|
+
}) + "\n");
|
|
2793
|
+
if (split.remainder !== null) {
|
|
2794
|
+
const queued = addPendingWatcherChange(undefined, split.remainder);
|
|
2795
|
+
if (queued)
|
|
2796
|
+
interruptWait();
|
|
2797
|
+
}
|
|
2798
|
+
workingBatch = split.chunk;
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2743
2801
|
const emitDecision = (mode, decisionReasons) => {
|
|
2744
2802
|
emitFullReconcileDecision({
|
|
2745
2803
|
mode,
|
|
@@ -2748,7 +2806,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2748
2806
|
pollTick,
|
|
2749
2807
|
configuredIntervalMs: fullReconcileIntervalMs ?? null,
|
|
2750
2808
|
elapsedSinceLastCompletedFullReconcileMs,
|
|
2751
|
-
batchPathCount:
|
|
2809
|
+
batchPathCount: workingBatch?.paths.size ?? 0,
|
|
2752
2810
|
});
|
|
2753
2811
|
};
|
|
2754
2812
|
let result;
|
|
@@ -2811,7 +2869,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2811
2869
|
result = await runGuarded(passArgv);
|
|
2812
2870
|
}
|
|
2813
2871
|
}
|
|
2814
|
-
else if (
|
|
2872
|
+
else if (workingBatch === null) {
|
|
2815
2873
|
// There is no watcher batch and no full-reconcile trigger. Do not
|
|
2816
2874
|
// substitute the legacy all-companies pull: it enumerates the vault
|
|
2817
2875
|
// despite the decision record previously calling this pass "scoped".
|
|
@@ -2821,8 +2879,8 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2821
2879
|
else {
|
|
2822
2880
|
try {
|
|
2823
2881
|
result = overflowWithKnownRoutes
|
|
2824
|
-
? await runOverflowRouteDrain(
|
|
2825
|
-
: await runScopedDrain(
|
|
2882
|
+
? await runOverflowRouteDrain(workingBatch)
|
|
2883
|
+
: await runScopedDrain(workingBatch, pending.generation);
|
|
2826
2884
|
// Known-route overflow intentionally runs whole *routes* (the paths
|
|
2827
2885
|
// were dropped); ordinary batches remain path-scoped. Label those
|
|
2828
2886
|
// distinct scopes so operators can distinguish them from a full
|