Repository navigation
fix(411): report missing non-match records instead of a clean document - #412
Conversation
The HTML report's Non-Matches Analysis section rendered "No non-matches found." for a compare_with() dict computed without document_non_matches=True, including one whose name field scored 0.0, and for a bulk ProcessEvaluation built with document_non_matches=False. DataExtractor.extract_non_matches returned [] both when records had been collected and were empty and when they were never collected, so the renderer had nothing to distinguish them by. It now returns None for the second case and the section says the records are missing and how to collect them. An empty list still renders the success message. tests/reporting/html/test_data_extractors.py pinned the conflation by asserting [] for a ProcessEvaluation whose non_matches is None; that assertion is now is None. Every other test in the directory patches the extractor, which is why the defect survived them, so the new coverage drives real comparison dicts and a real bulk evaluator through SectionGenerator without patching.
Security Scan ResultsASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Top 2 HotspotsFiles with the highest number of security findings:
Detailed FindingsShow 4 actionable findingsFinding 1: SECRET-HEX-HIGH-ENTROPY-STRING
Description: Code Snippet: Finding 2: B108
Description: Code Snippet: Finding 3: B307
Description: Code Snippet: Finding 4: B307
Description: Code Snippet: Report generated by Automated Security Helper (ASH) at 2026-10-19T21:58:07+00:00 |
sromoam
left a comment
There was a problem hiding this comment.
Nice work @digalaviz. The three-state rule (None means not collected, [] means none produced) is the right fix. For a default compare_with() dict and for a bulk run with document_non_matches=False, the report now says that no records were collected instead of calling the document clean. Approving, with three small things before merge:
-
It conflicts with
devand needs a rebase. -
tests/reporting/html/README.md:38uses em dashes. Colons work there. -
Please narrow the CHANGELOG entry (
CHANGELOG.md:136) to the paths this fixes. Two producers still empty the list before it reachesDataExtractor, so they still render "No non-matches found." over a failing field:aggregate_from_comparisons():update_from_comparison_result(bulk_structured_model_evaluator.py:288) treats a missingnon_matcheskey as[].- A bulk run where every document raised:
non_matches == []anderrorsis populated.
The
evaluator_format=Truedict is #413, which #420 fixes. I'll file the other two as a follow-up rather than grow this PR.
Optional: the None-state note (section_generator.py:103) could mention passing the EvalResult itself, as the terminal printer's message does since #404. Someone who called stickler.evaluate() never calls compare_with().
|
@digalaviz pls resolve this changelog merge conflict and then we can bring this in. |
Reconciles #413 with #412 (#411). #412 made DataExtractor.extract_non_matches return None when no records were collected, and the HTML non-match section renders the "records missing" note for None. That covers what has_non_match_records did here, so the helper and its section_generator branch are dropped and those files match dev. With non_matches now absent from an evaluator_format=True dict unless requested, the extractor returns None for it and the report shows the note, not "No non-matches found.". The evaluator-format HTML tests move to test_html_non_match_records.py, which drives the renderer without mocks; the bulk case was already there. CHANGELOG: the #298 and #411 entries no longer list evaluator_format=True as uncovered (the #425 gap stays), and the #413 entry says it closes it.
Pull Request
Issue Reference
Fixes #411
Description of Changes
The HTML report's Non-Matches Analysis section rendered
No non-matches found.over a document with a failing field, for the same reason the terminal printers did before #404: nothing distinguished "records were never collected" from "records were collected and there were none".Changes Made
DataExtractor.extract_non_matchesreturnsOptional[List[...]].Nonemeans no records were collected,[]means collected and empty. It no longer flattensProcessEvaluation.non_matches is Noneor a missing dict key into[].SectionGenerator.generate_non_matchesrenders a note forNonenamingdocument_non_matches=True, and keeps the success message for[].tests/reporting/html/test_data_extractors.pyhad an assertion pinning the conflation (== []for aProcessEvaluationwhosenon_matchesisNone); it now assertsis None, with two cases added for the dict paths.tests/reporting/html/test_html_non_match_records.pyis new: 5 cases driving realcompare_with()dicts and a realBulkStructuredModelEvaluatorthroughSectionGeneratorwith no patching.tests/reporting/html/README.mdis new, documenting the directory's mocking boundary and the three record states.Why These Changes Are Needed
compare_with()only writes the top-levelnon_matcheskey when called withdocument_non_matches=True, so the default comparison dict carries no records, and the absence of records is not evidence that nothing failed. Measured before this change, identical onf81a33eand on #404's head2ca4fe0, for a prediction whosenamescores0.0:After, on this branch:
#404 closes the same defect for the terminal printers but does not touch this module, so without this the two reporters disagree and the HTML report is the one that gets shared. The three-state rule here matches the one #404 establishes; unifying the two extractors is out of scope and tracked by #137.
Every other test in
tests/reporting/html/patchesDataExtractor.extract_non_matches, which is precisely the function at fault, so none of them could have caught this. That is why the new coverage builds results for real, and why the directory README now records the boundary.Testing
Full suite on this branch: 2914 passed, 12 skipped, 1 xfailed (2906 on
deve403b9b, plus the 8 added here).ruff check src tests: all checks passed.ruff format --checkreports the two source files and the two edited test files, which it also reports unchanged ondev; the new file is clean,lint.yamlrunsruff checkonly, and reformatting them would add unrelated churn.Checklist
CHANGELOG.mdentry added under[Unreleased]Additional Notes
DataExtractor.extract_document_idsalso readsresults.non_matches or [], left as is: it collects document IDs and an empty result there is not a claim about the document.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.