fix(telemetry): both rule arms logged only their hits, so the clear-rate could only read 100% (#3497) #138
@@ -360,10 +360,18 @@ async def test_telemetry_uses_its_own_source():
|
||||
patch.object(pc, "record_retrieval", rec), \
|
||||
patch.object(pc, "owner_names_for", AsyncMock(return_value={})):
|
||||
await pc.build_write_path_hint(1, "src/x.py", code=REAL_CODE, project_id=4)
|
||||
rec.assert_called_once()
|
||||
assert rec.call_args.kwargs["source"] == "write_path"
|
||||
assert rec.call_args.kwargs["source"] != "auto_inject"
|
||||
assert rec.call_args.kwargs["project_id"] == 4
|
||||
sources = [c.kwargs["source"] for c in rec.call_args_list]
|
||||
assert sources.count("write_path") == 1, sources
|
||||
assert "auto_inject" not in sources
|
||||
|
||||
note_arm = next(c for c in rec.call_args_list if c.kwargs["source"] == "write_path")
|
||||
assert note_arm.kwargs["project_id"] == 4
|
||||
|
||||
# The rule arm rides along on the same hint and logs its own call even when
|
||||
# it finds nothing (#3497). This assertion used to be `assert_called_once`,
|
||||
# which passed only because that row was never written — the test encoded
|
||||
# the defect. The second row is the point of having two sources.
|
||||
assert "write_path_rule" in sources, sources
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user