ソースを参照

test: cover EventPrompt identity in both orders

Problem: the managed/impostor regression covered only one ordering, allowing a last-signature-wins collector to pass.\n\nRisk: both permutations must keep ordinary prompt ordering and select the managed item by prompt kind.
zhenyu.hu 2 週間 前
コミット
83c711d23a
1 ファイル変更38 行追加11 行削除
  1. 38 11
      tests/test_websocket_api.py

+ 38 - 11
tests/test_websocket_api.py

@@ -2424,32 +2424,59 @@ function promptItem(promptKind, content) {
     },
     },
   };
   };
 }
 }
+const promptArrays = [
+  [
+    promptItem("custom", "ordinary custom"),
+    promptItem("custom", impostorGenerated),
+    promptItem("event_agent_system", managedGenerated),
+  ],
+  [
+    promptItem("custom", "ordinary custom"),
+    promptItem("event_agent_system", managedGenerated),
+    promptItem("custom", impostorGenerated),
+  ],
+];
+let currentPromptItems = [];
 const systemPrompts = {
 const systemPrompts = {
   querySelectorAll() {
   querySelectorAll() {
-    return [
-      promptItem("custom", "ordinary custom"),
-      promptItem("custom", impostorGenerated),
-      promptItem("event_agent_system", managedGenerated),
-    ];
+    return currentPromptItems;
   },
   },
 };
 };
 const toolInvocationMode = { value: "chat_agent_tools" };
 const toolInvocationMode = { value: "chat_agent_tools" };
-const chatAgentTools = collectSystemPrompts();
-toolInvocationMode.value = "dual_agent";
-const dualAgent = collectSystemPrompts();
+const outputs = promptArrays.map((promptItems) => {
+  currentPromptItems = promptItems;
+  toolInvocationMode.value = "chat_agent_tools";
+  const chatAgentTools = collectSystemPrompts();
+  toolInvocationMode.value = "dual_agent";
+  const dualAgent = collectSystemPrompts();
+  return { chatAgentTools, dualAgent };
+});
 const generatedMatches = [
 const generatedMatches = [
   isGeneratedEventPromptContent(impostorGenerated),
   isGeneratedEventPromptContent(impostorGenerated),
   isGeneratedEventPromptContent(managedGenerated),
   isGeneratedEventPromptContent(managedGenerated),
 ];
 ];
-console.log(JSON.stringify({ chatAgentTools, dualAgent, generatedMatches }));
+console.log(JSON.stringify({
+  contentsAreDistinct: impostorGenerated !== managedGenerated,
+  generatedMatches,
+  outputs,
+}));
 """,
 """,
             ]
             ]
         )
         )
     )
     )
 
 
+    assert result["contentsAreDistinct"] is True
     assert result["generatedMatches"] == [True, True]
     assert result["generatedMatches"] == [True, True]
-    assert result["chatAgentTools"] == ["ordinary custom"]
-    assert result["dualAgent"] == ["ordinary custom", managed_generated]
+    assert result["outputs"] == [
+        {
+            "chatAgentTools": ["ordinary custom"],
+            "dualAgent": ["ordinary custom", managed_generated],
+        },
+        {
+            "chatAgentTools": ["ordinary custom"],
+            "dualAgent": ["ordinary custom", managed_generated],
+        },
+    ]
 
 
 
 
 def test_static_tool_mode_disables_only_event_agent_model_settings_group():
 def test_static_tool_mode_disables_only_event_agent_model_settings_group():