feat(FN-5223): anchor staleness and stall detectors to engine activation ti
The merge introduces an engine-activation timestamp as the staleness floor for task age calculations, replacing arbitrary wall-clock thresholds with a runtime-relative anchor. Step 1 adds settings defaults, Steps 2–4 wire the floor helper through project engine, in-process runtime, and task store hy Fusion-Task-Id: FN-5223
This commit is contained in:
committed by
gsxdsm
parent
62f11e69d3
commit
c60045df22
@@ -1696,6 +1696,35 @@ describe("ProjectEngine paused in-review auto-merge behavior", () => {
|
||||
await engine.stop();
|
||||
});
|
||||
|
||||
it("stamps engineActiveSinceMs on global and engine unpause transitions", async () => {
|
||||
const mockStore = createMockStore({ ...baseSettings, autoMerge: true });
|
||||
mocks.currentStore = mockStore.store;
|
||||
const engine = createEngine();
|
||||
|
||||
await engine.start();
|
||||
mockStore.store.updateSettings.mockClear();
|
||||
|
||||
await mockStore.emitSettingsUpdated(
|
||||
{ ...baseSettings, autoMerge: true, globalPause: false },
|
||||
{ ...baseSettings, autoMerge: true, globalPause: true },
|
||||
);
|
||||
|
||||
await mockStore.emitSettingsUpdated(
|
||||
{ ...baseSettings, autoMerge: true, enginePaused: false },
|
||||
{ ...baseSettings, autoMerge: true, enginePaused: true },
|
||||
);
|
||||
|
||||
const activationStampCalls = mockStore.store.updateSettings.mock.calls.filter(
|
||||
([patch]) => patch && typeof patch === "object" && "engineActiveSinceMs" in patch,
|
||||
);
|
||||
expect(activationStampCalls).toHaveLength(2);
|
||||
for (const [patch] of activationStampCalls) {
|
||||
expect((patch as { engineActiveSinceMs: unknown }).engineActiveSinceMs).toEqual(expect.any(Number));
|
||||
}
|
||||
|
||||
await engine.stop();
|
||||
});
|
||||
|
||||
it("resumes deferred startup recovery on engine unpause", async () => {
|
||||
const mockStore = createMockStore(baseSettings);
|
||||
mocks.currentStore = mockStore.store;
|
||||
|
||||
Reference in New Issue
Block a user