Make artifact backfill fixture a structurally valid docx
ci / vet-and-test (pull_request) Successful in 1m16s

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
This commit is contained in:
2026-10-14 07:42:28 +00:00
parent aea948fd4d
commit c8f8076579
+3 -1
View File
@@ -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','<?xml version=\"1.0\"?><Types/>')\n z.writestr('word/document.xml','<?xml version=\"1.0\"?><doc/>')\n"}`),
})
if py.Status != "ok" || !strings.Contains(py.Output, "exit=0") {
t.Fatalf("run_python: %s %s", py.Status, py.Output)