@indigoai-us/hq-cloud 6.16.18 → 6.16.19
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 +16 -4
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +58 -13
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.test.js +70 -12
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -113,10 +113,22 @@ export declare function takeEnumeratedBatchChunk(batch: TreeChangeBatch, limit:
|
|
|
113
113
|
remainder: TreeChangeBatch | null;
|
|
114
114
|
};
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
117
|
-
* the
|
|
118
|
-
* `HQ_SYNC_FULL_RECONCILE_MS` (for example,
|
|
119
|
-
*
|
|
116
|
+
* Elapsed-time cadence for scheduled full reconciles: one hour by default,
|
|
117
|
+
* measured from the last full pass (its dispatch or its completion, whichever
|
|
118
|
+
* is later). `HQ_SYNC_FULL_RECONCILE_MS` overrides it (for example,
|
|
119
|
+
* 10_800_000 for three hours); an unset or invalid value falls back to the
|
|
120
|
+
* hour.
|
|
121
|
+
*
|
|
122
|
+
* The previous default was "every `FULL_RECONCILE_EVERY_TICKS` ticks" with no
|
|
123
|
+
* elapsed-time floor. Ticks fire on every watcher batch, not only on the
|
|
124
|
+
* remote poll, so on an active vault a new full pass started 4-8 minutes —
|
|
125
|
+
* once observed 21 seconds — after the previous one finished, and each pass
|
|
126
|
+
* on a real install takes ~10 minutes of listing and HEAD traffic. The runner
|
|
127
|
+
* was effectively reconciling continuously. Full reconcile is the correctness
|
|
128
|
+
* backstop behind event-push (a missed watcher event, a new directory the
|
|
129
|
+
* native watch has not adopted yet); the surfaces-inactive, overflow, warm-up
|
|
130
|
+
* and bare-wake triggers still force it immediately when live events cannot
|
|
131
|
+
* be trusted, so an hour is the cadence of the backstop, not of realtime.
|
|
120
132
|
*/
|
|
121
133
|
export declare const FULL_RECONCILE_MS_ENV = "HQ_SYNC_FULL_RECONCILE_MS";
|
|
122
134
|
export declare const DEFAULT_FULL_RECONCILE_MS: number | undefined;
|
|
@@ -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;AAavB,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;AAkDD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAChD,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AACrE,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AACrE,eAAO,MAAM,4BAA4B,qCAAqC,CAAC;AAC/E,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,2BAA2B,QAAkB,CAAC;AAC3D;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,QAAa,CAAC;AAE3D;;;;;GAKG;AACH,wB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,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,CAq8FjB"}
|
|
@@ -320,13 +320,25 @@ export function takeEnumeratedBatchChunk(batch, limit) {
|
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
|
-
*
|
|
324
|
-
* the
|
|
325
|
-
* `HQ_SYNC_FULL_RECONCILE_MS` (for example,
|
|
326
|
-
*
|
|
323
|
+
* Elapsed-time cadence for scheduled full reconciles: one hour by default,
|
|
324
|
+
* measured from the last full pass (its dispatch or its completion, whichever
|
|
325
|
+
* is later). `HQ_SYNC_FULL_RECONCILE_MS` overrides it (for example,
|
|
326
|
+
* 10_800_000 for three hours); an unset or invalid value falls back to the
|
|
327
|
+
* hour.
|
|
328
|
+
*
|
|
329
|
+
* The previous default was "every `FULL_RECONCILE_EVERY_TICKS` ticks" with no
|
|
330
|
+
* elapsed-time floor. Ticks fire on every watcher batch, not only on the
|
|
331
|
+
* remote poll, so on an active vault a new full pass started 4-8 minutes —
|
|
332
|
+
* once observed 21 seconds — after the previous one finished, and each pass
|
|
333
|
+
* on a real install takes ~10 minutes of listing and HEAD traffic. The runner
|
|
334
|
+
* was effectively reconciling continuously. Full reconcile is the correctness
|
|
335
|
+
* backstop behind event-push (a missed watcher event, a new directory the
|
|
336
|
+
* native watch has not adopted yet); the surfaces-inactive, overflow, warm-up
|
|
337
|
+
* and bare-wake triggers still force it immediately when live events cannot
|
|
338
|
+
* be trusted, so an hour is the cadence of the backstop, not of realtime.
|
|
327
339
|
*/
|
|
328
340
|
export const FULL_RECONCILE_MS_ENV = "HQ_SYNC_FULL_RECONCILE_MS";
|
|
329
|
-
export const DEFAULT_FULL_RECONCILE_MS =
|
|
341
|
+
export const DEFAULT_FULL_RECONCILE_MS = 60 * 60_000;
|
|
330
342
|
export function resolveFullReconcileMs(env = process.env) {
|
|
331
343
|
const raw = env[FULL_RECONCILE_MS_ENV];
|
|
332
344
|
if (raw === undefined || raw.trim() === "")
|
|
@@ -1696,12 +1708,30 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
1696
1708
|
};
|
|
1697
1709
|
const warmupJournalPaths = () => {
|
|
1698
1710
|
const paths = [];
|
|
1699
|
-
|
|
1711
|
+
const journals = listJournals();
|
|
1712
|
+
const vaultJournalPresent = journals.some(({ slug }) => slug === PERSONAL_VAULT_JOURNAL_SLUG);
|
|
1713
|
+
for (const { slug, journal } of journals) {
|
|
1714
|
+
// `migratePersonalVaultJournal` copies the pre-vault `personal` file into
|
|
1715
|
+
// the vault journal and leaves the original behind. Once the vault
|
|
1716
|
+
// journal exists that file is a frozen snapshot whose rows for long-gone
|
|
1717
|
+
// files can only manufacture unlinks the delete plan then refuses.
|
|
1718
|
+
if (slug === "personal" && vaultJournalPresent)
|
|
1719
|
+
continue;
|
|
1700
1720
|
const route = slug === PERSONAL_VAULT_JOURNAL_SLUG || slug === "personal"
|
|
1701
1721
|
? { kind: "personal" }
|
|
1702
1722
|
: { kind: "company", slug };
|
|
1703
1723
|
if (!isWatchRouteSelected(route, watchRouteSelection))
|
|
1704
1724
|
continue;
|
|
1725
|
+
// A company journal whose local folder is gone (a retired test company,
|
|
1726
|
+
// a tenant this machine no longer materializes) has nothing the catch-up
|
|
1727
|
+
// can observe: every row would become an unlink for a path the fanout
|
|
1728
|
+
// never walks. Together with the legacy file these were ~1,000 phantom
|
|
1729
|
+
// paths per runner start on a real install, each ending in a
|
|
1730
|
+
// "does not exist, skipping" warning from the scoped push.
|
|
1731
|
+
if (route.kind === "company" &&
|
|
1732
|
+
!fs.existsSync(path.join(hqRoot, "companies", route.slug))) {
|
|
1733
|
+
continue;
|
|
1734
|
+
}
|
|
1705
1735
|
for (const key of Object.keys(journal.files)) {
|
|
1706
1736
|
// A row the delete plan refuses unconditionally (session-log local
|
|
1707
1737
|
// retention keeps the row after pruning the file; release scaffold;
|
|
@@ -2711,6 +2741,12 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2711
2741
|
let nextDueAt = monotonicNow();
|
|
2712
2742
|
let pollTick = 0;
|
|
2713
2743
|
let lastCompletedFullReconcileAt = null;
|
|
2744
|
+
// Anchor for the elapsed-time cadence: the most recent full reconcile that
|
|
2745
|
+
// was dispatched or completed. Stamping at dispatch too means a full pass
|
|
2746
|
+
// that fails (or a chore that never reports back) is retried one interval
|
|
2747
|
+
// later, not on every following tick. `null` until the first-tick full pass
|
|
2748
|
+
// runs, and that tick already forces a full reconcile on its own.
|
|
2749
|
+
let lastFullReconcileAt = null;
|
|
2714
2750
|
let fullChorePending = false;
|
|
2715
2751
|
let fullChoreFollowupPending = false;
|
|
2716
2752
|
let coordinatorAuthRequired = false;
|
|
@@ -2749,9 +2785,12 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2749
2785
|
// (backend resync / hint-cap blowout) still needs the full fanout.
|
|
2750
2786
|
const overflowWithKnownRoutes = pending.batch?.overflowed === true &&
|
|
2751
2787
|
pending.batch.droppedRouteHints !== undefined;
|
|
2752
|
-
|
|
2788
|
+
// One clock read per tick serves both the telemetry field and the
|
|
2789
|
+
// cadence check; skipped entirely until a full pass has been anchored.
|
|
2790
|
+
const cadenceNow = lastFullReconcileAt === null ? null : monotonicNow();
|
|
2791
|
+
const elapsedSinceLastCompletedFullReconcileMs = lastCompletedFullReconcileAt === null || cadenceNow === null
|
|
2753
2792
|
? null
|
|
2754
|
-
:
|
|
2793
|
+
: cadenceNow - lastCompletedFullReconcileAt;
|
|
2755
2794
|
const eventPushSurfacesInactive = eventPush && !eventPushSurfacesActivated;
|
|
2756
2795
|
const firstTick = pollTick === 1;
|
|
2757
2796
|
const bareWake = pending.bare;
|
|
@@ -2760,8 +2799,9 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2760
2799
|
const overflowRoutesUnknown = pending.batch?.overflowed === true && !overflowWithKnownRoutes;
|
|
2761
2800
|
const scheduledInterval = fullReconcileIntervalMs === undefined
|
|
2762
2801
|
? pollTick % FULL_RECONCILE_EVERY_TICKS === 0
|
|
2763
|
-
:
|
|
2764
|
-
|
|
2802
|
+
: lastFullReconcileAt !== null &&
|
|
2803
|
+
cadenceNow !== null &&
|
|
2804
|
+
cadenceNow - lastFullReconcileAt >= fullReconcileIntervalMs;
|
|
2765
2805
|
const triggers = {
|
|
2766
2806
|
"event-push-surfaces-inactive": eventPushSurfacesInactive,
|
|
2767
2807
|
"first-tick": firstTick,
|
|
@@ -2829,6 +2869,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2829
2869
|
// clock and turns on event surfaces.
|
|
2830
2870
|
if (!fullChorePending) {
|
|
2831
2871
|
fullChorePending = true;
|
|
2872
|
+
lastFullReconcileAt = monotonicNow();
|
|
2832
2873
|
enqueueChore("full-reconcile", () => runGuarded(passArgv), (execution) => {
|
|
2833
2874
|
fullChorePending = false;
|
|
2834
2875
|
const exit = passExitCode(execution.result);
|
|
@@ -2844,6 +2885,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2844
2885
|
if ((execution.accepted && exit === 0) ||
|
|
2845
2886
|
hasCompletedRunnerPass(execution.result)) {
|
|
2846
2887
|
lastCompletedFullReconcileAt = monotonicNow();
|
|
2888
|
+
lastFullReconcileAt = lastCompletedFullReconcileAt;
|
|
2847
2889
|
activateEventPushSurfaces();
|
|
2848
2890
|
if (fullChoreFollowupPending) {
|
|
2849
2891
|
fullChoreFollowupPending = false;
|
|
@@ -2910,9 +2952,6 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2910
2952
|
result = await runGuarded(passArgv);
|
|
2911
2953
|
}
|
|
2912
2954
|
}
|
|
2913
|
-
if (ranFullReconcile && fullReconcileIntervalMs !== undefined) {
|
|
2914
|
-
lastCompletedFullReconcileAt = monotonicNow();
|
|
2915
|
-
}
|
|
2916
2955
|
// This batch's episode has now been prepared and pushed, so a later
|
|
2917
2956
|
// removal under the same path is judged fresh — a root that never
|
|
2918
2957
|
// expired would silently refuse ordinary deletes from here on.
|
|
@@ -3040,6 +3079,12 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
3040
3079
|
realtimeState.nextHighWaterAt = nextRealtimeHighWaterAt;
|
|
3041
3080
|
}
|
|
3042
3081
|
const now = monotonicNow();
|
|
3082
|
+
if (ranFullReconcile) {
|
|
3083
|
+
// The awaited full pass finished on this tick; reuse the tick's clock
|
|
3084
|
+
// sample so the cadence anchor never costs a second read.
|
|
3085
|
+
lastCompletedFullReconcileAt = now;
|
|
3086
|
+
lastFullReconcileAt = now;
|
|
3087
|
+
}
|
|
3043
3088
|
// Queued receiver work shortens an already scheduled adaptive poll from
|
|
3044
3089
|
// as long as ten minutes to one minute. Its deadline must start at this
|
|
3045
3090
|
// receive-driven cycle rather than extending the old, still-future slot.
|