From 218fab584b599dd6564f598496c3c7d81455b9a7 Mon Sep 17 00:00:00 2001 From: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com> Date: Mon, 19 Oct 2026 09:51:51 +0800 Subject: [PATCH] test(peers): decode real CLI fixtures as UTF-8 on Windows Signed-off-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com> --- .github/workflows/python-tests.yml | 1 + tests/test_peer_collaboration.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 81e84efdc3..325742bf6e 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -890,6 +890,7 @@ jobs: - name: Qualify native Windows peer reads and long-path inputs run: >- python -m pytest -q + tests/test_peer_collaboration.py::test_peer_cli_preserves_unicode_request_and_reply tests/test_peer_collaboration.py::test_peer_exchange_survives_long_private_store_paths tests/test_peer_collaboration.py::test_peer_binary_artifact_preserves_crlf_and_ctrl_z_digest tests/test_peer_collaboration.py::test_peer_read_qualifies_long_workspace_input diff --git a/tests/test_peer_collaboration.py b/tests/test_peer_collaboration.py index ecedf0e5be..8cfa76fc4a 100644 --- a/tests/test_peer_collaboration.py +++ b/tests/test_peer_collaboration.py @@ -122,6 +122,7 @@ def cli(root, registry, agent, action, *args, ok=True): ], capture_output=True, text=True, + encoding="utf-8", timeout=30, cwd=registry.parent, ) @@ -130,6 +131,27 @@ def cli(root, registry, agent, action, *args, ok=True): return result +def test_peer_cli_preserves_unicode_request_and_reply(scenario): + root, registry, brief, _, _, _, parent = scenario + purpose = "独立复核恢复计划 🚀" + reply = "已验证库存约束,恢复完成 🚀" + path = root / "unicode-peer-brief.json" + path.write_text(json.dumps({**brief, "purpose": purpose}, ensure_ascii=False), encoding="utf-8") + request_id = cli(root, registry, "builder", "request", "--peer-agent-id", "reviewer", + "--operation-id", "unicode-review", "--brief-file", str(path), + "--parent-request-id", parent)["request_id"] + received = next(item for item in cli(root, registry, "reviewer", "read")["items"] + if item["request_id"] == request_id) + assert received["brief"]["purpose"] == purpose + cli(root, registry, "reviewer", "acknowledge", "--request-id", request_id, + "--decision", "adopt", "--reason", "按原约束进行独立复核。") + cli(root, registry, "reviewer", "report", "--request-id", request_id, "--reply-text", reply) + returned = cli(root, registry, "builder", "read")["peer_returns"]["items"][0] + assert returned["text"] == reply and returned["parent_request_id"] == parent + rejected = cli(root, registry, "unknown-agent", "read", ok=False) + assert rejected["ok"] is False and "recipient is not registered" in rejected["error"] + + @pytest.fixture def external_scenario(scenario): root, registry, brief, store, _, _, _ = scenario