From 1b207b214da6ad059cacd532dc39f70fecce8951 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Mon, 4 May 2026 08:55:42 -0700 Subject: [PATCH] fix(harness): stub platform_auth with *args lambdas (#2743 fallout) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #2743 (multi-workspace MCP PR-2) made auth_headers accept an optional ``workspace_id`` arg and self_source_headers stayed 1-arg-required. The peer-discovery-404 harness replay stubbed both with 0-arg lambdas, so the helper call inside the replay raised: TypeError: () takes 0 positional arguments but 1 was given …and the diagnostic captured by the replay was the TypeError text, not the platform-404 string the assertion grep'd for. Caught by PR-2737 (auto-promote staging→main) — the replay went red right after #2743 merged into staging. Switching both stubs to ``*args, **kwargs`` makes them tolerant of both the legacy 0-arg call shape AND the new 1-arg-with-workspace call shape, so neither the harness nor the in-tree unit tests need to know which version of the runtime helpers ran the call. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/harness/replays/peer-discovery-404.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/harness/replays/peer-discovery-404.sh b/tests/harness/replays/peer-discovery-404.sh index e93261f0..cfb84354 100755 --- a/tests/harness/replays/peer-discovery-404.sh +++ b/tests/harness/replays/peer-discovery-404.sh @@ -75,9 +75,14 @@ from unittest.mock import AsyncMock, MagicMock, patch # Stub platform_auth so a2a_client imports cleanly without requiring a # real workspace token file. The helper's auth_headers() only matters # when going through the network; we're feeding it a mock response. +# +# Both stubs accept *args, **kwargs because the multi-workspace work +# (#2739, #2743) added optional ``workspace_id`` parameters to +# ``auth_headers`` and made ``self_source_headers`` 1-arg-required. +# The stubs need to accept whatever the helpers pass without caring. _pa = types.ModuleType("platform_auth") -_pa.auth_headers = lambda: {} -_pa.self_source_headers = lambda: {} +_pa.auth_headers = lambda *a, **kw: {} +_pa.self_source_headers = lambda *a, **kw: {} sys.modules.setdefault("platform_auth", _pa) sys.path.insert(0, sys.argv[1])