fix(harness): stub platform_auth with *args lambdas (#2743 fallout)
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: <lambda>() 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) <noreply@anthropic.com>
This commit is contained in:
parent
7cffff844b
commit
1b207b214d
@ -75,9 +75,14 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
|||||||
# Stub platform_auth so a2a_client imports cleanly without requiring a
|
# Stub platform_auth so a2a_client imports cleanly without requiring a
|
||||||
# real workspace token file. The helper's auth_headers() only matters
|
# real workspace token file. The helper's auth_headers() only matters
|
||||||
# when going through the network; we're feeding it a mock response.
|
# 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 = types.ModuleType("platform_auth")
|
||||||
_pa.auth_headers = lambda: {}
|
_pa.auth_headers = lambda *a, **kw: {}
|
||||||
_pa.self_source_headers = lambda: {}
|
_pa.self_source_headers = lambda *a, **kw: {}
|
||||||
sys.modules.setdefault("platform_auth", _pa)
|
sys.modules.setdefault("platform_auth", _pa)
|
||||||
|
|
||||||
sys.path.insert(0, sys.argv[1])
|
sys.path.insert(0, sys.argv[1])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user