FN-5872: clear active-session registry on PR cleanup
Ensure PR-mode merge cleanup removes stale active-session registry state before deleting worktrees. - unregister the task worktree from the active-session registry during merged-task artifact cleanup - export the active-session registry from the engine entrypoint for lifecycle cleanup usage - add CLI and engine regression coverage for registry cleanup and missing-entry best-effort behavior - add a patch changeset for the published CLI package Files changed: .changeset/fn-5872-registry-cleanup.md | 5 ++++ .../src/commands/__tests__/task-lifecycle.test.ts | 29 +++++++++++++++++++++- packages/cli/src/commands/task-lifecycle.ts | 8 +++++- .../pr-mode-worktree-invariants.test.ts | 11 +++++--- packages/engine/src/index.ts | 1 + 5 files changed, 49 insertions(+), 5 deletions(-) Fusion-Task-Id: FN-5872 Fusion-Task-Lineage: d4db24a3-7ae0-4d07-b029-7f30b2f65d2e
This commit is contained in:
@@ -283,10 +283,15 @@ describe("FN-5420 reliability interactions: PR mode worktree invariants", () =>
|
||||
expect(releaseSpy).toHaveBeenCalledWith(path, "FN-5455-THROW");
|
||||
});
|
||||
|
||||
it.skip("FN-5456 follow-up required: cleanup should clear active-session registry entry", async () => {
|
||||
const path = "/tmp/fn-5456-session";
|
||||
activeSessionRegistry.registerPath(path, { taskId: "FN-5456", kind: "executor", ownerKey: "FN-5456" });
|
||||
it("FN-5872: cleanup clears active-session registry entry", async () => {
|
||||
const path = "/tmp/fn-5872-session";
|
||||
activeSessionRegistry.registerPath(path, { taskId: "FN-5872", kind: "executor", ownerKey: "FN-5872" });
|
||||
expect(activeSessionRegistry.lookupByPath(path)).not.toBeNull();
|
||||
|
||||
const { cleanupMergedTaskArtifacts } = await loadPrLifecycleModule();
|
||||
await cleanupMergedTaskArtifacts("/tmp", { id: "FN-5872", worktree: path } as any);
|
||||
|
||||
expect(activeSessionRegistry.lookupByPath(path)).toBeNull();
|
||||
});
|
||||
|
||||
it("FN-5420/FN-5279: mergeIntegrationWorktree setting does not gate PR-mode processing", async () => {
|
||||
|
||||
@@ -172,6 +172,7 @@ export {
|
||||
type MockScript,
|
||||
type MockScriptContext,
|
||||
} from "./providers/index.js";
|
||||
export { activeSessionRegistry } from "./active-session-registry.js";
|
||||
export { WorktreePool, scanIdleWorktrees, cleanupOrphanedWorktrees, reapOrphanWorktrees } from "./worktree-pool.js";
|
||||
export {
|
||||
pruneWorktreeAdminEntries,
|
||||
|
||||
Reference in New Issue
Block a user