ef9b7a8c30
RPC E2E with debug shows registered present at session_compact but planned=[] because kept still contains the skill block; registered=[] still drops skills absent from kept. Sync file readSettings avoids RPC hook deadlock on SettingsManager/isProjectTrusted. Co-authored-by: Cursor <cursoragent@cursor.com>
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { planReinject } from "../src/reinject.js";
|
|
import { createDefaultSettings } from "../src/settings.js";
|
|
import { createInitialState, trackSkill } from "../src/state.js";
|
|
|
|
describe("B-002 pre-fix filter hypothesis", () => {
|
|
it("planned empty when skill stays in kept window even if registered", () => {
|
|
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: "slash",
|
|
});
|
|
|
|
const branch = [
|
|
{
|
|
id: "keep-1",
|
|
type: "message",
|
|
message: {
|
|
role: "user",
|
|
content:
|
|
'<skill name="fup-blame-commits" location="/path/SKILL.md">\nbody\n</skill>',
|
|
},
|
|
},
|
|
] as never;
|
|
|
|
const planned = planReinject(
|
|
state,
|
|
createDefaultSettings(),
|
|
{
|
|
sessionManager: { getBranch: () => branch },
|
|
} as never,
|
|
{ compactionEntry: { firstKeptEntryId: "keep-1" } } as never,
|
|
[{ name: "fup-blame-commits" }],
|
|
);
|
|
|
|
expect(planned).toEqual([]);
|
|
});
|
|
|
|
it("pre-fix: registered empty drops skill even when absent from kept (post-fix should reinject)", () => {
|
|
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 = planReinject(
|
|
state,
|
|
createDefaultSettings(),
|
|
{
|
|
sessionManager: { getBranch: () => branch },
|
|
} as never,
|
|
{ compactionEntry: { firstKeptEntryId: "keep-1" } } as never,
|
|
[],
|
|
);
|
|
|
|
expect(planned).toEqual([]);
|
|
});
|
|
});
|