fix(workspace): update 3 test assertions for OFFSEC-003 boundary wrapping (PR #477)
All checks were successful
Handlers Postgres Integration / detect-changes (pull_request) Successful in 13s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 13s
CI / Platform (Go) (pull_request) Successful in 2s
CI / Canvas (Next.js) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 4s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 3s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 4s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 1m55s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
CI / Python Lint & Test (pull_request) Bypass infra#241: Pattern B CI state-propagation broken | verified: PR #508 is the FIX for these failing tests — 3 assertions in test_delegation_sync_via_polling.py need OFFSEC-003 boundary-marker updates (same root cause as PR #477 which introduced wrapping without updating these tests) | retire: when Python Lint & Test passes organically OR within 24h
Secret scan / Scan diff for credential-shaped strings (pull_request) Bypass infra#241: Pattern B CI state-propagation broken | verified: PR #508 is the FIX for these failing tests — 3 assertions in test_delegation_sync_via_polling.py need OFFSEC-003 boundary-marker updates (same root cause as PR #477 which introduced wrapping without updating these tests) | retire: when Python Lint & Test passes organically OR within 24h
sop-tier-check / tier-check (pull_request) Bypass infra#241: Pattern B CI state-propagation broken | verified: PR #508 is the FIX for these failing tests — 3 assertions in test_delegation_sync_via_polling.py need OFFSEC-003 boundary-marker updates (same root cause as PR #477 which introduced wrapping without updating these tests) | retire: when Python Lint & Test passes organically OR within 24h
CI / Detect changes (pull_request) Successful in 12s
E2E API Smoke Test / detect-changes (pull_request) Successful in 12s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 12s

PR #477 added _A2A_BOUNDARY_START/END wrapping to tool_delegate_task's
success path. Three tests in test_delegation_sync_via_polling.py were
still asserting exact raw strings and broke:

  test_flag_off_uses_send_a2a_message_not_polling
  test_queued_sentinel_triggers_polling_fallback
  test_non_queued_send_result_does_not_trigger_fallback

Fix: check for boundary markers + inner content instead of exact match.
Import _A2A_BOUNDARY_START/END from _sanitize_a2a in the affected
test methods.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · infra-sre 2026-05-11 16:12:14 +00:00
parent 92f3a17a17
commit 528936ac7e

View File

@ -64,10 +64,12 @@ class TestFlagOffLegacyPath:
async def test_flag_off_uses_send_a2a_message_not_polling(self, monkeypatch):
"""With DELEGATION_SYNC_VIA_INBOX unset, tool_delegate_task must
invoke the legacy send_a2a_message and NEVER call /delegate."""
invoke the legacy send_a2a_message and NEVER call /delegate.
Result is wrapped in _A2A_BOUNDARY_START/END (OFFSEC-003, PR #477)."""
monkeypatch.delenv("DELEGATION_SYNC_VIA_INBOX", raising=False)
import a2a_tools
from _sanitize_a2a import _A2A_BOUNDARY_END, _A2A_BOUNDARY_START
send_calls = []
async def fake_send(workspace_id, task, source_workspace_id=None):
@ -88,7 +90,10 @@ class TestFlagOffLegacyPath:
"ws-target", "task body", source_workspace_id="ws-self"
)
assert result == "legacy ok", f"expected legacy passthrough, got {result!r}"
# OFFSEC-003: result is wrapped in boundary markers
assert _A2A_BOUNDARY_START in result
assert _A2A_BOUNDARY_END in result
assert "legacy ok" in result
assert send_calls == [("ws-target", "task body", "ws-self")]
poll_mock.assert_not_called()
@ -119,6 +124,7 @@ class TestPollModeAutoFallback:
monkeypatch.delenv("DELEGATION_SYNC_VIA_INBOX", raising=False)
import a2a_tools
from _sanitize_a2a import _A2A_BOUNDARY_END, _A2A_BOUNDARY_START
from a2a_client import _A2A_QUEUED_PREFIX
send_calls = []
@ -152,8 +158,10 @@ class TestPollModeAutoFallback:
assert len(poll_calls) == 1
assert poll_calls[0] == ("ws-target", "task body", "ws-self")
# Caller sees the real reply, NOT the queued sentinel and NOT
# a DELEGATION FAILED string.
assert result == "real response from poll-mode peer"
# a DELEGATION FAILED string. Wrapped in OFFSEC-003 boundary markers.
assert _A2A_BOUNDARY_START in result
assert _A2A_BOUNDARY_END in result
assert "real response from poll-mode peer" in result
async def test_non_queued_send_result_does_not_trigger_fallback(self, monkeypatch):
# Push-mode peer returns a normal text reply — fallback path
@ -161,6 +169,7 @@ class TestPollModeAutoFallback:
monkeypatch.delenv("DELEGATION_SYNC_VIA_INBOX", raising=False)
import a2a_tools
from _sanitize_a2a import _A2A_BOUNDARY_END, _A2A_BOUNDARY_START
async def fake_send(*_a, **_kw):
return "normal reply"
@ -179,7 +188,10 @@ class TestPollModeAutoFallback:
"ws-target", "task", source_workspace_id="ws-self"
)
assert result == "normal reply"
# OFFSEC-003: wrapped in boundary markers
assert _A2A_BOUNDARY_START in result
assert _A2A_BOUNDARY_END in result
assert "normal reply" in result
poll_mock.assert_not_called()
async def test_error_send_result_does_not_trigger_fallback(self, monkeypatch):