09619d9dd8
Every session_compact replans pendingReinject in defer mode; skipped reinject clears the queue unless manual compaction is waiting for the next user prompt. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createCompactionRuntime } from "../src/compaction";
|
|
import { applyPendingReinjectAfterCompact } from "../src/reinject";
|
|
import { createInitialState } from "../src/state";
|
|
|
|
describe("applyPendingReinjectAfterCompact", () => {
|
|
it("replaces pending with a new plan on each compact", () => {
|
|
const runtime = createCompactionRuntime();
|
|
const state = createInitialState();
|
|
state.pendingReinject = ["alpha"];
|
|
|
|
applyPendingReinjectAfterCompact(state, runtime, true, ["beta", "gamma"]);
|
|
|
|
expect(state.pendingReinject).toEqual(["beta", "gamma"]);
|
|
});
|
|
|
|
it("clears pending when reinject is skipped", () => {
|
|
const runtime = createCompactionRuntime();
|
|
const state = createInitialState();
|
|
state.pendingReinject = ["alpha"];
|
|
|
|
applyPendingReinjectAfterCompact(state, runtime, false, ["beta"]);
|
|
|
|
expect(state.pendingReinject).toEqual([]);
|
|
});
|
|
|
|
it("keeps stale pending when manual compaction scheduled a user-prompt clear", () => {
|
|
const runtime = createCompactionRuntime();
|
|
runtime.clearPendingReinjectOnNextUserInput = true;
|
|
const state = createInitialState();
|
|
state.pendingReinject = ["alpha"];
|
|
|
|
applyPendingReinjectAfterCompact(state, runtime, false, ["beta"]);
|
|
|
|
expect(state.pendingReinject).toEqual(["alpha"]);
|
|
});
|
|
});
|