feat(FN-3841): add worktree database hydration to executor

Implements worktree database hydration for the executor (`worktree-db-hydrate.ts`), enabling the task executor to restore its database state from a worktree on resume, with integration in `executor.ts` and comprehensive test coverage across the new module and worktree scenarios. Documentation and a

Fusion-Task-Id: FN-3841
This commit is contained in:
Fusion
2026-05-11 05:12:51 -07:00
committed by gsxdsm
parent fe8c186527
commit e59a740d0f
11 changed files with 562 additions and 0 deletions

View File

@@ -187,6 +187,13 @@ vi.mock("../step-session-executor.js", () => ({
vi.mock("../rate-limit-retry.js", () => ({
withRateLimitRetry: vi.fn((fn: () => Promise<unknown>) => fn()),
}));
vi.mock("../worktree-db-hydrate.js", () => ({
hydrateWorktreeDb: vi.fn().mockResolvedValue({
tasksCopied: 0,
documentsCopied: 0,
degraded: false,
}),
}));
vi.mock("../verification-utils.js", async () => {
const actual = await vi.importActual<typeof import("../verification-utils.js")>("../verification-utils.js");
return {
@@ -221,6 +228,7 @@ import { StepSessionExecutor } from "../step-session-executor.js";
import { withRateLimitRetry } from "../rate-limit-retry.js";
import { execSync } from "node:child_process";
import { existsSync } from "node:fs";
import { hydrateWorktreeDb } from "../worktree-db-hydrate.js";
export const mockedCreateFnAgent = vi.mocked(createFnAgent);
export const mockedSessionManager = vi.mocked(SessionManager);
@@ -230,6 +238,7 @@ export const mockedStepSessionExecutor = vi.mocked(StepSessionExecutor);
export const mockedWithRateLimitRetry = vi.mocked(withRateLimitRetry);
export const mockedExecSync = vi.mocked(execSync);
export const mockedExistsSync = vi.mocked(existsSync);
export const mockedHydrateWorktreeDb = vi.mocked(hydrateWorktreeDb);
export type EventListener = (...args: unknown[]) => void;