fix(4909c): the tool-arm suppression tests read the arm's own row, not the slot's
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / integration (push) Successful in 1m3s
CI & Build / Python tests (push) Successful in 1m54s
CI & Build / Build & push image (push) Successful in 26s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / integration (push) Successful in 1m3s
CI & Build / Python tests (push) Successful in 1m54s
CI & Build / Build & push image (push) Successful in 26s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -985,14 +985,21 @@ async def test_a_genuine_ranker_decline_reports_zero_suppression():
|
|||||||
assert row.kwargs["suppressed"] is not None
|
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
|
@pytest.mark.asyncio
|
||||||
async def test_the_tool_arm_reports_suppression_too():
|
async def test_the_tool_arm_reports_suppression_too():
|
||||||
log, rec = MagicMock(), MagicMock()
|
log, rec = MagicMock(), MagicMock()
|
||||||
hits = [(0.75, fake_rule(id=161, title="Reach the forge through its MCP tools"))]
|
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])
|
await _run_tool_arm(hits, rec, retrieval_log=log, exclude_rule_ids=[161])
|
||||||
|
|
||||||
assert log.call_args.kwargs["results"] == []
|
assert _tool_row(log)["results"] == []
|
||||||
assert log.call_args.kwargs["suppressed"] == 1
|
assert _tool_row(log)["suppressed"] == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@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])
|
out = await _run_tool_arm(hits, rec, retrieval_log=log, exclude_rule_ids=[12])
|
||||||
|
|
||||||
assert out["rule_ids"] == [161]
|
assert out["rule_ids"] == [161]
|
||||||
assert log.call_args.kwargs["suppressed"] == 1
|
assert _tool_row(log)["suppressed"] == 1
|
||||||
assert len(log.call_args.kwargs["results"]) == 1
|
assert len(_tool_row(log)["results"]) == 1
|
||||||
|
|
||||||
|
|
||||||
# ── The identity between the two tables ─────────────────────────────────
|
# ── The identity between the two tables ─────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user