refactor: fast-lane directives helpers

This commit is contained in:
Peter Steinberger
2026-01-12 22:33:59 +00:00
parent 9f90d0721a
commit fd768334a9
5 changed files with 311 additions and 89 deletions

View File

@@ -117,7 +117,7 @@ describe("followup queue deduplication", () => {
);
expect(first).toBe(true);
// Second enqueue with same prompt should be allowed (we only dedupe with message id)
// Second enqueue with same prompt should be allowed (default dedupe: message id only)
const second = enqueueFollowupRun(
key,
createRun({
@@ -173,6 +173,40 @@ describe("followup queue deduplication", () => {
);
expect(second).toBe(true);
});
it("can opt-in to prompt-based dedupe when message id is absent", async () => {
const key = `test-dedup-prompt-mode-${Date.now()}`;
const settings: QueueSettings = {
mode: "collect",
debounceMs: 0,
cap: 50,
dropPolicy: "summarize",
};
const first = enqueueFollowupRun(
key,
createRun({
prompt: "Hello world",
originatingChannel: "whatsapp",
originatingTo: "+1234567890",
}),
settings,
"prompt",
);
expect(first).toBe(true);
const second = enqueueFollowupRun(
key,
createRun({
prompt: "Hello world",
originatingChannel: "whatsapp",
originatingTo: "+1234567890",
}),
settings,
"prompt",
);
expect(second).toBe(false);
});
});
describe("followup queue collect routing", () => {