test: align assertions with new prompt templates and injection boundaries

This commit is contained in:
youzini
2026-06-09 14:11:12 +00:00
parent 171f4a1dfd
commit b5c32be648
3 changed files with 13 additions and 13 deletions

View File

@@ -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);

View File

@@ -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");

View File

@@ -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",
],