@indigoai-us/hq-cloud 6.15.8 → 6.15.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.
@@ -3561,13 +3561,13 @@ describe("adaptivePollMs (whole-box CPU backoff)", () => {
3561
3561
  });
3562
3562
  });
3563
3563
  describe("advanceMonotonicDeadline", () => {
3564
- it("runs one immediate catch-up after missed slots, then resumes at the first future slot", () => {
3565
- // A pass due at t=0 took through t=1,800 with a 600 ms cadence. It does
3566
- // not replay the three missed slots; exactly one catch-up is immediate and
3567
- // the following regular deadline is t=2,400.
3564
+ it("gives an overrun pass a full cooldown instead of running an immediate catch-up", () => {
3565
+ // A pass due at t=0 took through t=1,800 with a 600 ms cadence. The next
3566
+ // pass is scheduled one complete interval after it finishes, so expensive
3567
+ // reconciles cannot become a continuous CPU/I-O loop.
3568
3568
  expect(advanceMonotonicDeadline(0, 1_800, 600)).toEqual({
3569
3569
  nextDueAt: 2_400,
3570
- delayMs: 0,
3570
+ delayMs: 600,
3571
3571
  });
3572
3572
  expect(advanceMonotonicDeadline(2_400, 1_800, 600)).toEqual({
3573
3573
  nextDueAt: 3_000,
@@ -3665,6 +3665,41 @@ describe("runRunnerWithLoop — adaptive poll interval (no --poll-remote-ms)", (
3665
3665
  triggerShutdown();
3666
3666
  await loop;
3667
3667
  });
3668
+ it("emits a recognized maintenance heartbeat during a long idle wait", async () => {
3669
+ vi.useFakeTimers();
3670
+ try {
3671
+ const stdout = makeWriter();
3672
+ const runPass = vi.fn().mockResolvedValue(0);
3673
+ let triggerShutdown = () => { };
3674
+ const loop = runRunnerWithLoop(["--companies", "--watch", "--hq-root", "/tmp/hq"], {
3675
+ runPass,
3676
+ sampleLoadAvg: () => 1_000,
3677
+ stdout,
3678
+ onShutdownSignal: (handler) => {
3679
+ triggerShutdown = handler;
3680
+ return () => { };
3681
+ },
3682
+ });
3683
+ await flushLoopMicrotasks();
3684
+ await vi.advanceTimersByTimeAsync(30_000);
3685
+ expect(stdout.events().filter((event) => event.type === "maintenance-progress")).toEqual([
3686
+ {
3687
+ type: "maintenance-progress",
3688
+ company: "watch",
3689
+ bytesProcessed: 0,
3690
+ totalBytes: 0,
3691
+ },
3692
+ ]);
3693
+ expect(runPass).toHaveBeenCalledTimes(1);
3694
+ triggerShutdown();
3695
+ await loop;
3696
+ await vi.advanceTimersByTimeAsync(30_000);
3697
+ expect(stdout.events().filter((event) => event.type === "maintenance-progress")).toHaveLength(1);
3698
+ }
3699
+ finally {
3700
+ vi.useRealTimers();
3701
+ }
3702
+ });
3668
3703
  });
3669
3704
  describe("runRunnerWithLoop — event-push wiring", () => {
3670
3705
  it("does not start journal-reading watcher callbacks before the initial pass finishes", async () => {