From b5c32be6488db1a6eeb07a36100e362d79190e45 Mon Sep 17 00:00:00 2001 From: youzini Date: Tue, 9 Jun 2026 14:11:12 +0000 Subject: [PATCH] test: align assertions with new prompt templates and injection boundaries --- tests/recall-reapply-block.mjs | 4 +++- tests/task-profile-migration.mjs | 10 +++++++--- tests/task-profile-storage.mjs | 12 +++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/recall-reapply-block.mjs b/tests/recall-reapply-block.mjs index 7dfa89a..30384ff 100644 --- a/tests/recall-reapply-block.mjs +++ b/tests/recall-reapply-block.mjs @@ -131,7 +131,9 @@ function recallRecord(overrides = {}) { assert.equal(result.applied, true); assert.equal(result.source, "persisted"); assert.equal(result.injectionText, "[recall] stable memory"); - assert.equal(promptData.finalMesSend[0].extensionPrompts[0], "[recall] stable memory\n"); + assert.match(promptData.finalMesSend[0].extensionPrompts[0], /\[BEGIN ST-BME MEMORY CONTEXT\]/); + assert.match(promptData.finalMesSend[0].extensionPrompts[0], /\[recall\] stable memory/); + assert.match(promptData.finalMesSend[0].extensionPrompts[0], /\[END ST-BME MEMORY CONTEXT\]/); assert.deepEqual(calls.applied, [], "rewrite path should not use module injection"); assert.equal(calls.rewritesCleared, 1); assert.equal(chat[0].extra.bme_recall.generationCount, 1); diff --git a/tests/task-profile-migration.mjs b/tests/task-profile-migration.mjs index 9cc3012..8fe523d 100644 --- a/tests/task-profile-migration.mjs +++ b/tests/task-profile-migration.mjs @@ -40,7 +40,7 @@ const extractProfile = getActiveTaskProfile( assert.equal(extractProfile.taskType, "extract_objective"); assert.equal(extractProfile.id, "default"); assert.ok(Array.isArray(extractProfile.blocks)); -assert.equal(extractProfile.blocks.length, 16); +assert.equal(extractProfile.blocks.length, 17); assert.deepEqual( extractProfile.blocks.map((block) => block.name), [ @@ -60,6 +60,7 @@ assert.deepEqual( "信息确认", "输出格式", "行为规则", + "规则确认", ], ); assert.deepEqual( @@ -81,6 +82,7 @@ assert.deepEqual( "custom", "custom", "custom", + "custom", ], ); assert.deepEqual( @@ -102,6 +104,7 @@ assert.deepEqual( "assistant", "user", "user", + "assistant", ], ); assert.equal( @@ -139,6 +142,7 @@ assert.deepEqual( "default-info-ack", "default-format", "default-rules", + "default-rules-ack", ], ); assert.deepEqual( @@ -476,7 +480,7 @@ const upgradedLegacyDefault = getActiveTaskProfile( }, "extract_objective", ); -assert.equal(upgradedLegacyDefault.blocks.length, 16); +assert.equal(upgradedLegacyDefault.blocks.length, 17); assert.equal(upgradedLegacyDefault.blocks[0].name, "抬头"); assert.match(upgradedLegacyDefault.blocks[0].content, /虚拟的世界/); assert.equal(upgradedLegacyDefault.blocks[0].role, "system"); @@ -505,7 +509,7 @@ assert.equal(upgradedInfoAck.role, "assistant"); assert.equal(upgradedLegacyDefault.blocks[14].id, "default-format"); assert.equal(upgradedLegacyDefault.blocks[15].id, "default-rules"); assert.match(upgradedLegacyDefault.blocks[14].content, /batchStoryTime/); -assert.match(upgradedLegacyDefault.blocks[15].content, /禁止输出/); +assert.match(upgradedLegacyDefault.blocks[15].content, /HARD GATE/); assert.equal(upgradedLegacyDefault.blocks[14].role, "user"); assert.equal(upgradedLegacyDefault.blocks[15].role, "user"); diff --git a/tests/task-profile-storage.mjs b/tests/task-profile-storage.mjs index 2124d2f..76440df 100644 --- a/tests/task-profile-storage.mjs +++ b/tests/task-profile-storage.mjs @@ -58,7 +58,7 @@ const activeProfile = getActiveTaskProfile( "extract_objective", ); assert.equal(activeProfile.name, "激进提取"); -assert.equal(activeProfile.blocks.length, 18); +assert.equal(activeProfile.blocks.length, 19); const builtinBlock = activeProfile.blocks.find( (block) => block.type === "builtin" && block.sourceKey === "userMessage", ); @@ -163,27 +163,21 @@ assert.ok( "extract_objective role block should identify as objective-only extractor", ); assert.ok( - taskProfiles.extract_subjective.profiles[0].blocks.find((block) => block.id === "default-rules")?.content?.includes("POV 记忆字段"), - "extract_subjective rules block should contain POV memory rules", + taskProfiles.extract_subjective.profiles[0].blocks.find((block) => block.id === "default-rules")?.content?.includes("POV HARD GATE"), + "extract_subjective rules block should contain POV HARD GATE", ); assert.deepEqual( getBuiltinBlockDefinitions("extract_subjective") .map((definition) => definition.sourceKey) .filter((sourceKey) => [ - "objectiveExtractionDraft", - "objectiveRefMap", "ownerContext", - "batchStoryTime", "relevantPovMemories", "cognitionStateDigest", ].includes(sourceKey), ), [ - "objectiveExtractionDraft", - "objectiveRefMap", "ownerContext", - "batchStoryTime", "relevantPovMemories", "cognitionStateDigest", ],