Fix extraction defer and dry-run recall guards

This commit is contained in:
Youzini-afk
2026-04-02 19:46:18 +08:00
parent 839cad7aff
commit c5edbf6046
4 changed files with 71 additions and 2 deletions

View File

@@ -2697,6 +2697,16 @@ async function testGenerationRecallBeforeCombineRunsStandalone() {
);
}
async function testGenerationRecallDryRunPreviewDoesNotTriggerBeforeCombineRecall() {
const harness = await createGenerationRecallHarness();
harness.chat = [{ is_user: true, mes: "Prompt Viewer 预览" }];
harness.result.onGenerationStarted("normal", {}, true);
await harness.result.onBeforeCombinePrompts();
assert.equal(harness.runRecallCalls.length, 0);
}
async function testGenerationRecallDifferentKeyCanRunAgain() {
const harness = await createGenerationRecallHarness();
harness.chat = [{ is_user: true, mes: "第一条" }];
@@ -2874,6 +2884,19 @@ async function testAutoExtractionDefersWhenGraphNotReady() {
assert.equal(statuses[0]?.[0], "等待图谱加载");
}
async function testAutoExtractionDefersWhenAlreadyExtracting() {
const deferredReasons = [];
await runExtractionController({
getIsExtracting: () => true,
deferAutoExtraction(reason) {
deferredReasons.push(reason);
},
});
assert.deepEqual(deferredReasons, ["extracting"]);
}
async function testAutoExtractionDefersWhenHistoryRecoveryBusy() {
const deferredReasons = [];
@@ -3986,12 +4009,14 @@ await testGenerationRecallSameKeyCanRunAgainImmediatelyAsNewGeneration();
await testGenerationRecallSameKeyCanRunAgainAfterBridgeWindow();
await testBeforeCombineRecallNotSkippedWhenGraphLoadingButRuntimeGraphReadable();
await testGenerationRecallBeforeCombineRunsStandalone();
await testGenerationRecallDryRunPreviewDoesNotTriggerBeforeCombineRecall();
await testGenerationRecallDifferentKeyCanRunAgain();
await testGenerationRecallSkippedStateDoesNotLoopToBeforeCombine();
await testGenerationRecallSentMessageClearsStaleTransactionForSameKey();
await testRegisterCoreEventHooksIsIdempotent();
await testChatChangedDoesNotClearCoreEventBindings();
await testAutoExtractionDefersWhenGraphNotReady();
await testAutoExtractionDefersWhenAlreadyExtracting();
await testAutoExtractionDefersWhenHistoryRecoveryBusy();
await testRemoveNodeHandlesCyclicChildGraph();
await testGenerationRecallAppliesFinalInjectionOncePerTransaction();