diff --git a/tests/test_rule_usage_wiring.py b/tests/test_rule_usage_wiring.py index 3637ca4d..c5597f04 100644 --- a/tests/test_rule_usage_wiring.py +++ b/tests/test_rule_usage_wiring.py @@ -985,14 +985,21 @@ async def test_a_genuine_ranker_decline_reports_zero_suppression(): assert row.kwargs["suppressed"] is not None +def _tool_row(log): + """The tool arm's own call row; the preference slot logs beside it.""" + rows = [c for c in log.call_args_list if c.kwargs.get("source") == "pre_tool_rule"] + assert len(rows) == 1, rows + return rows[0].kwargs + + @pytest.mark.asyncio async def test_the_tool_arm_reports_suppression_too(): log, rec = MagicMock(), MagicMock() hits = [(0.75, fake_rule(id=161, title="Reach the forge through its MCP tools"))] await _run_tool_arm(hits, rec, retrieval_log=log, exclude_rule_ids=[161]) - assert log.call_args.kwargs["results"] == [] - assert log.call_args.kwargs["suppressed"] == 1 + assert _tool_row(log)["results"] == [] + assert _tool_row(log)["suppressed"] == 1 @pytest.mark.asyncio @@ -1005,8 +1012,8 @@ async def test_a_shown_hit_is_not_counted_as_suppressed(): out = await _run_tool_arm(hits, rec, retrieval_log=log, exclude_rule_ids=[12]) assert out["rule_ids"] == [161] - assert log.call_args.kwargs["suppressed"] == 1 - assert len(log.call_args.kwargs["results"]) == 1 + assert _tool_row(log)["suppressed"] == 1 + assert len(_tool_row(log)["results"]) == 1 # ── The identity between the two tables ─────────────────────────────────