Phase 14: defer reinject plan without registry at compaction — B-002 stage 1

planDeferredReinject locks pending by kept-window only; defer path in index uses it while immediate keeps registered filter at compact time.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-17 17:31:43 +07:00
parent fe25e606b8
commit a81337c08e
3 changed files with 64 additions and 15 deletions
+29 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { planReinject } from "../src/reinject.js";
import { planDeferredReinject, planReinject } from "../src/reinject.js";
import { createDefaultSettings } from "../src/settings.js";
import { createInitialState, trackSkill } from "../src/state.js";
@@ -67,4 +67,32 @@ describe("B-002 pre-fix filter hypothesis", () => {
expect(planned).toEqual([]);
});
it("defer plan includes skill absent from kept even when registered is empty", () => {
const state = createInitialState();
trackSkill(state, {
name: "fup-blame-commits",
filePath: "/home/user/.cursor/skills/fup-blame-commits/SKILL.md",
baseDir: "/home/user/.cursor/skills/fup-blame-commits",
source: "skill-block",
});
const branch = [
{
id: "keep-1",
type: "message",
message: { role: "user", content: "plain text after compact" },
},
] as never;
const planned = planDeferredReinject(
state,
{
sessionManager: { getBranch: () => branch },
} as never,
{ compactionEntry: { firstKeptEntryId: "keep-1" } } as never,
);
expect(planned).toEqual(["fup-blame-commits"]);
});
});