test: cover tr_apr in the no-foreign-code self-consistency check - #103
Conversation
tr_apr was the only checker module excluded from test_no_finding_names_a_code_other_than_its_own, which exists specifically to catch findings that quote another module's error code in their message (as TR-SIG-005 once did with TR-SIG-003). No live violation in tr_apr today, but it shares a duplicated _not_absolute_uri with tr_pol (held equal by a parity test per its own docstring), so a future refactor merging that logic is exactly the kind of change this test exists to catch -- and it would currently go unnoticed for this module.
imran-siddique
left a comment
There was a problem hiding this comment.
Approving. Checked all three claims against the tree rather than the description.
tr_aprwas the only checker excluded.src/trace_tests/modules/holds eight checkers plusunverified.py, andMODULESlisted seven.- The duplication is real.
_not_absolute_uriis defined in exactly two files,tr_apr.pyandtr_pol.py, which is the refactor this test exists to catch and the one place it was not watching. - No live violation. The file passes with
tr_apradded, 9 passed.
The reason this is more than a line in a dict is the assertion below the one you are feeding: assert examined fails if every record raised, on the grounds that the check "would have reported a pass either way". So adding tr_apr to MODULES asserts that it produces findings across the junk-record matrix, and the test enforces that rather than taking it. A module added to a parametrised check that silently examines nothing is the failure mode this file already guards against, and your addition inherits that guard.
One thing I did not manage to show, said plainly rather than left implied: I tried planting a foreign TR-SIG-003 into a tr_apr message to watch the guard fire, and my pattern matched no message literal in that module, so I have not demonstrated the catch for tr_apr specifically. The coverage argument stands on its own without it.
tr_apr was the only checker module excluded from
test_no_finding_names_a_code_other_than_its_own, which exists specifically to catch findings that quote another module's error code in their message (as TR-SIG-005 once did with TR-SIG-003).
No live violation in tr_apr today, but it shares a duplicated _not_absolute_uri with tr_pol (held equal by a parity test per its own docstring), so a future refactor merging that logic is exactly the kind of change this test exists to catch -- and it would currently go unnoticed for this module.