From c8f8076579a1424400a0d3b6f087a272381db6e5 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 14 Oct 2026 07:42:28 +0000 Subject: [PATCH] Make artifact backfill fixture a structurally valid docx Why: The backfill contract test used a fake PK-magic docx as its fixture; the new registration structural gate correctly refuses that shape, so the contract was no longer exercised. Evidence: The three affected runmgr tests pass locally with -count=1; the full combined suite receipt follows on the task card. Impact: Test fixture only; the gate behavior under test is unchanged. Refs: Dev task feature/pptx-register-structural-gate --- internal/runmgr/exec_tool_artifact_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/runmgr/exec_tool_artifact_test.go b/internal/runmgr/exec_tool_artifact_test.go index e6256f9..10c011e 100644 --- a/internal/runmgr/exec_tool_artifact_test.go +++ b/internal/runmgr/exec_tool_artifact_test.go @@ -77,9 +77,11 @@ func TestRunPythonRegisterArtifactBackfill(t *testing.T) { if err := tools.RegisterInterpreterTools(c.mgr.registry); err != nil { t.Fatal(err) } + // 夹具必须是结构合法的最小 docx:登记口会做 OPC 结构自检, + // 伪 zip(PK 魔数+垃圾字节)现在会被拒绝而非登记。 py := c.ExecuteTool(core.ToolCallRequest{ CallID: "py1", Name: "run_python", - Arguments: json.RawMessage(`{"script":"open('note.docx','wb').write(b'PK\\x03\\x04hello')\n"}`), + Arguments: json.RawMessage(`{"script":"import zipfile\nwith zipfile.ZipFile('note.docx','w') as z:\n z.writestr('[Content_Types].xml','')\n z.writestr('word/document.xml','')\n"}`), }) if py.Status != "ok" || !strings.Contains(py.Output, "exit=0") { t.Fatalf("run_python: %s %s", py.Status, py.Output)