Skip to content

Commit d3de552

Browse files
committed
test(acp): prove the bridge is live before asserting an absence
test_bridge_omits_usage_when_context_window_is_unknown asserted that no UsageUpdate was emitted, with nothing establishing that the bridge was forwarding anything at all. Verified vacuous: with every event handler unsubscribed, so the bridge emits nothing whatsoever, the test still passed. A positive control now proves the mechanism is alive first; the same mutation fails it. Signed-off-by: Paul Furgale <pfurgale@nvidia.com>
1 parent b69bd81 commit d3de552

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

packages/nooa-acp/tests/test_event_bridge.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,16 @@ async def test_bridge_omits_usage_when_context_window_is_unknown(tmp_path):
202202
client = _RecordingClient()
203203
bridge = ACPEventBridge(agent, client, "session-1") # type: ignore[arg-type]
204204

205+
agent.event_manager.add(AgentMessage(content="alive"))
205206
agent.event_manager.add(LLMComplete(prompt_tokens=40, completion_tokens=10, cost_usd=0.25))
206207
await bridge.flush()
207208

209+
# Positive control: prove the bridge is actually forwarding before asserting
210+
# an absence. Without it this passes even with every handler unsubscribed.
211+
assert any(
212+
isinstance(update, AgentMessageChunk) and update.content.text == "alive"
213+
for _, update in client.updates
214+
)
208215
assert not any(isinstance(update, UsageUpdate) for _, update in client.updates)
209216
await bridge.close()
210217
await agent.close()

0 commit comments

Comments
 (0)