Repository navigation
fix(report): render missing and non-finite non-match values as empty cells - #677
WilliamK112 wants to merge 3 commits into
Conversation
…cells The static non-matches table printed None, nan and inf, while the per-document view rendered the same values as empty cells. Render a missing, None, NaN or infinite value as an empty cell in the static table too, keeping the 100-character cut for other values. Closes awslabs#578 Signed-off-by: Ching Wei Kang <164879897+WilliamK112@users.noreply.github.com>
mangeshraut712
left a comment
There was a problem hiding this comment.
Ran this on macOS against the merge-base (0a4820f; the branch is 52 commits behind dev but the hunk applies cleanly). Not an approval — that's for a maintainer.
Confirmed
tests/reporting/html:196 passedhere. Your two Windows-only failures (deep-nesting NaN, gallery path) don't reproduce on macOS, which matches your note that they're platform-specific.- The new test has teeth:
test_generate_non_matches_missing_and_non_finite_values_are_emptyonto the merge-base gives1 failed, 31 passed; on the branch32 passed. ruff checkis clean on both changed files.- The 23-line change is the whole diff and does what it says:
None→"", non-finite →"", and0/False/""/ the 100-char cut all unchanged.
One precision note on "including NumPy floats"
That's true for np.float64 but not np.float32, because np.float64 subclasses float and np.float32 doesn't:
_non_match_cell_value(np.float64('nan')) -> ''
_non_match_cell_value(np.float32('nan')) -> 'nan'
_non_match_cell_value(np.float32('inf')) -> 'inf'
I checked whether that makes this inconsistent with the per-document view, and it doesn't — the codebase is uniformly narrow here:
_replace_non_finiteinbulk_structured_model_evaluator.pyuses the sameisinstance(item, float)guard, sonp.float32('nan')passes through it untouched too.- The per-document view doesn't render
np.float32at all:_json_for_scriptraisesTypeError: Object of type float32 is not JSON serializable.
So your check matches the house convention exactly, and np.float32 is unsupported across the whole reporting path rather than a gap this PR opens. I'd only suggest tightening the description to "np.float64" so a reader doesn't expect float32 to work — the code is right as-is. A separate issue for NumPy scalar support across reporting would be the place for that, if it's wanted.
On the missing-key change
nm.get('ground_truth_value', 'None') → nm.get('ground_truth_value') quietly fixes a second thing: a missing key used to render the literal string None (truthy, so it hit the old str() path) and now renders empty like an explicit None. That's the right behaviour and the new test covers it — just worth knowing it's a behaviour change for absent keys as well as for None/NaN/inf.
|
Thanks for running it on macOS and for the careful check. Good catch on |
sromoam
left a comment
There was a problem hiding this comment.
Thanks @WilliamK112, this checks out. I ran a bulk evaluation with an individual-results JSONL at 01c2ef7, and again merged with current dev: a NaN ground truth and a None prediction now render as empty cells in the static table, matching the null in the per-document payload, where dev shows nan and None. The empty-cell test fails on dev and passes here, and tests/reporting passes merged with dev (223 passed). Nothing to change from my side.
One heads-up: we're not merging anything outside the 1.1.0 milestone until 1.1.0 lands, so this will wait until after that. The only conflict with dev is in CHANGELOG.md, so please bring dev in after 1.1.0 lands rather than now, and move the entry under the new [Unreleased] heading then.
vawsgit
left a comment
There was a problem hiding this comment.
needs changes: one item, the CHANGELOG entry. The code and tests are good.
Change needed: rebase on dev and move the CHANGELOG bullet.
The PR is CONFLICTING (mergeStateStatus: DIRTY). Its base is 0a4820f, which is 133 commits behind dev (3dc3aec). The bullet is at CHANGELOG.md L267-L271, under ## [Unreleased] (L10). On dev, ## [Unreleased] is now empty and that content moved to ## [1.1.0] - 2026-12-04. A merge-tree of this PR against dev conflicts only in CHANGELOG.md. If the conflict is resolved by keeping the PR's side, the entry lands in the released 1.1.0 section. After rebasing, put the ### Fixed bullet under the new ## [Unreleased].
Fork CI has not run on this head: the checks are action_required and need a maintainer to approve the workflow run.
Verified at 01c2ef7 (no code findings):
tests/reporting: 196 passed on the PR. Merged into currentdev(CHANGELOG conflict resolved by hand): 223 passed.- The new empty-cell test fails on the base source (1 failed, 31 passed in
test_section_generator.py, withNonerendered) and passes on the PR. _non_match_cell_value:None,nan,inf,-inf,np.float64('nan')andfloat('1e999')give''.0,0.0,False,''and the string'nan'keep their text. 100 characters are kept, 101 are cut to 100, and the cut happens before escaping, so&is never split.- End to end:
BulkStructuredModelEvaluatorplusEvaluationHTMLReporterwith NaN, ±inf andNonefields. Base source: static cells showNone,inf,nan,-inf. PR source: those cells are empty, and real values are unchanged. The JSONL behind the per-document view carriesnullfor the same cells, so the two views now agree. - 12 mutations of
section_generator.py(NaN or inf treated as text,Noneas text, missing-key default, falsy values blanked, truncation at 99 or 101, escape before truncate, escape removed,isinstanceguard dropped). Each was caught by at least one test. None was equivalent. - The claim that this applies on top of #625 holds: merging both conflicts only in
CHANGELOG.md, andtests/reportinggives 224 passed. - No other place under
src/stickler/reportingformats these values into HTML with a'None'default.
Non-blocking (optional): list, Decimal and complex values still render as Python text ([nan, 1], NaN, (nan+0j)). That is outside the scalar scope of #578.
Once the CHANGELOG is rebased, I expect to approve.
Signed-off-by: Ching-Wei Kang <ckang53@wisc.edu>
|
Thanks for the check. I merged current |
vawsgit
left a comment
There was a problem hiding this comment.
✅ LGTM!
My one blocking item from the previous round is fixed: the CHANGELOG bullet is now under the new ## [Unreleased], not in the released 1.1.0 section.
Verified at 0f3e947e4a2d5fa62efee17cf04bc5b25132f1cd (merge of current dev 9680269):
- CHANGELOG:
git diff origin/dev pr677 -- CHANGELOG.mdis one hunk, +9 lines and 0 deletions. The### Fixedbullet sits between## [Unreleased]and## [1.1.0] - 2026-12-04, and it links #578. The 1.1.0 section and every other line matchdevexactly. - Merge state:
git merge-tree --write-tree origin/dev pr677reports no conflicts. GitHub showsmergeable: MERGEABLE.BLOCKEDis review and CI, not a conflict. - Nothing stale from the merge: the diff against
devis 3 files, +91/-3 (CHANGELOG.md +9,section_generator.py+20/-3,test_section_generator.py+62). It matchesgit diff origin/dev...pr677. Nothing is reverted or changed under.github,pyproject.toml,uv.lockor the CI matrix. - Tests:
tests/reportinggives 223 passed (it was 196 on the old base, 223 merged withdevbefore).test_section_generator.pygives 33 passed. Againstdev's source, the empty-cell test fails (1 failed, 32 passed). - Helper behaviour:
_non_match_cell_valuereturns''forNone,nan,inf,-inf,np.float64('nan')andfloat('1e999').0,0.0,False,''and'nan'keep their text. 101 characters are cut to 100 before escaping. ruff checkon the changed files is clean. The source and test changes are the same as at01c2ef7, where I ran 12 mutations and each was caught.
Non-blocking: fork CI has not run on this head. A maintainer has to approve the workflow run. List, Decimal and complex values still render as Python text, which is outside the scalar scope of #578.
sromoam
left a comment
There was a problem hiding this comment.
Thanks @WilliamK112, this is ready. I checked 0f3e947 merged with current dev (9680269d). The bullet sits under ## [Unreleased], ### Fixed, and the 1.1.0 section matches dev. I ran a bulk evaluation with an individual-results JSONL. The static non-matches table now renders NaN, inf and None as empty cells, where dev shows nan, inf and None. 0.0, False, the 100-character cut and escaping are unchanged. The empty-cell test fails on dev and passes here, tests/reporting gives 223 passed, and the full suite passes merged (7481 passed, 3 skipped, 1 xfailed).
Security Scan ResultsASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Report generated by Automated Security Helper (ASH) at 2026-12-04T22:29:37+00:00 |
Signed-off-by: Ching Wei Kang <164879897+WilliamK112@users.noreply.github.com>
|
#696 landed on |
Issue #, if available: Closes #578
Description of changes:
The static non-matches table (built in Python) printed
None,nanandinf, while the per-document view (main.js) shows the same values as empty cells, because its payload carries non-finite numbers asnullsince #576. Picking a document changed the text, and going back to the aggregate view changed it back.The static table now uses the per-document view's rendering: a missing key,
None, NaN and ±infinity (includingnp.float64;np.float32is not handled anywhere in the reporting path, so it is out of scope here) render as an empty cell. Other values keep their text, so0,Falseand""are unchanged, and values are still cut at 100 characters before escaping. The change is one small helper insection_generator.py;main.jsis unchanged. A### Fixedchangelog bullet is added.This touches
section_generator.pya few lines below #625's hunk. The source and test changes apply cleanly on top of #625; only the CHANGELOG would need a merge, which I'll do if #625 lands first.Checks, on
devat 0a4820f:test_section_generator.py. The empty-cell test fails ondev'ssrcand passes here; the other pins0/False/""and the 100-character cut so they don't regress.tests/reporting/html, 119 tests): 117 pass. The 2 failures are the same ondevon Windows (the deep-nesting NaN test and one gallery path test).ruff checkis clean on the changed files anddocs/check_links.pypasses.Written with Claude Code.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code