Skip to content

fix(report): render missing and non-finite non-match values as empty cells - #677

Open
WilliamK112 wants to merge 3 commits into
awslabs:devfrom
WilliamK112:fix/578-non-match-empty-cells
Open

WilliamK112 wants to merge 3 commits into
awslabs:devfrom
WilliamK112:fix/578-non-match-empty-cells

Conversation

@WilliamK112

@WilliamK112 WilliamK112 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue #, if available: Closes #578

Description of changes:

The static non-matches table (built in Python) printed None, nan and inf, while the per-document view (main.js) shows the same values as empty cells, because its payload carries non-finite numbers as null since #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 (including np.float64; np.float32 is not handled anywhere in the reporting path, so it is out of scope here) render as an empty cell. Other values keep their text, so 0, False and "" are unchanged, and values are still cut at 100 characters before escaping. The change is one small helper in section_generator.py; main.js is unchanged. A ### Fixed changelog bullet is added.

This touches section_generator.py a 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 dev at 0a4820f:

  • 2 new tests in test_section_generator.py. The empty-cell test fails on dev's src and passes here; the other pins 0/False/"" and the 100-character cut so they don't regress.
  • All report tests that build the non-matches section (8 files under tests/reporting/html, 119 tests): 117 pass. The 2 failures are the same on dev on Windows (the deep-nesting NaN test and one gallery path test).
  • ruff check is clean on the changed files and docs/check_links.py passes.

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

…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 mangeshraut712 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 passed here. 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_empty onto the merge-base gives 1 failed, 31 passed; on the branch 32 passed.
  • ruff check is clean on both changed files.
  • The 23-line change is the whole diff and does what it says: None → "", non-finite → "", and 0 / 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_finite in bulk_structured_model_evaluator.py uses the same isinstance(item, float) guard, so np.float32('nan') passes through it untouched too.
  • The per-document view doesn't render np.float32 at all: _json_for_script raises TypeError: 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.

@WilliamK112

Copy link
Copy Markdown
Contributor Author

Thanks for running it on macOS and for the careful check. Good catch on np.float32: I've narrowed the description to np.float64 and noted that np.float32 is out of scope, since the rest of the reporting path doesn't support it either. And yes, the missing-key change is intended: an absent key now renders empty, the same as an explicit None, and the new test covers it.

@sromoam sromoam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 vawsgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 current dev (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, with None rendered) and passes on the PR.
  • _non_match_cell_value: None, nan, inf, -inf, np.float64('nan') and float('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 &amp; is never split.
  • End to end: BulkStructuredModelEvaluator plus EvaluationHTMLReporter with NaN, ±inf and None fields. Base source: static cells show None, inf, nan, -inf. PR source: those cells are empty, and real values are unchanged. The JSONL behind the per-document view carries null for the same cells, so the two views now agree.
  • 12 mutations of section_generator.py (NaN or inf treated as text, None as text, missing-key default, falsy values blanked, truncation at 99 or 101, escape before truncate, escape removed, isinstance guard 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, and tests/reporting gives 224 passed.
  • No other place under src/stickler/reporting formats 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>
@WilliamK112

Copy link
Copy Markdown
Contributor Author

Thanks for the check. I merged current dev in 0f3e947 without rewriting the reviewed commit. The conflict is resolved and the note is under the new [Unreleased] → Fixed; the 1.1.0 notes are unchanged. All 223 reporting tests, Ruff, and the docs link check pass. The fork workflow approval remains with maintainers.

@vawsgit vawsgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.md is one hunk, +9 lines and 0 deletions. The ### Fixed bullet sits between ## [Unreleased] and ## [1.1.0] - 2026-12-04, and it links #578. The 1.1.0 section and every other line match dev exactly.
  • Merge state: git merge-tree --write-tree origin/dev pr677 reports no conflicts. GitHub shows mergeable: MERGEABLE. BLOCKED is review and CI, not a conflict.
  • Nothing stale from the merge: the diff against dev is 3 files, +91/-3 (CHANGELOG.md +9, section_generator.py +20/-3, test_section_generator.py +62). It matches git diff origin/dev...pr677. Nothing is reverted or changed under .github, pyproject.toml, uv.lock or the CI matrix.
  • Tests: tests/reporting gives 223 passed (it was 196 on the old base, 223 merged with dev before). test_section_generator.py gives 33 passed. Against dev's source, the empty-cell test fails (1 failed, 32 passed).
  • Helper behaviour: _non_match_cell_value returns '' for None, nan, inf, -inf, np.float64('nan') and float('1e999'). 0, 0.0, False, '' and 'nan' keep their text. 101 characters are cut to 100 before escaping.
  • ruff check on the changed files is clean. The source and test changes are the same as at 01c2ef7, 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 sromoam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@sromoam sromoam added this to the 1.1.1 milestone Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Security Scan Results

ASH Security Scan Report

  • Report generated: 2026-12-04T22:29:36+00:00
  • Time since scan: 2 minutes

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-12-04T22:27:06+00:00
  • ASH version: 3.1.2

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

  • Severity levels:
    • Suppressed (S): Findings that have been explicitly suppressed and don't affect scanner status
    • Critical (C): Highest severity findings that require immediate attention
    • High (H): Serious findings that should be addressed soon
    • Medium (M): Moderate risk findings
    • Low (L): Lower risk findings
    • Info (I): Informational findings with minimal risk
  • Duration (Time): Time taken by the scanner to complete its execution
  • Actionable: Number of findings at or above the threshold severity level that require attention
  • Result:
    • PASSED = No findings at or above threshold
    • FAILED = Findings at or above threshold
    • MISSING = Required dependencies not available
    • SKIPPED = Scanner explicitly disabled
    • ERROR = Scanner execution error
  • Threshold: The minimum severity level that will cause a scanner to fail
    • Thresholds: ALL, LOW, MEDIUM, HIGH, CRITICAL
    • Source: Values in parentheses indicate where the threshold is set:
      • global (global_settings section in the ASH_CONFIG used)
      • config (scanner config section in the ASH_CONFIG used)
      • scanner (default configuration in the plugin, if explicitly set)
  • Statistics calculation:
    • All statistics are calculated from the final aggregated SARIF report
    • Suppressed findings are counted separately and do not contribute to actionable findings
    • Scanner status is determined by comparing actionable findings to the threshold
Scanner Suppressed Critical High Medium Low Info Actionable Result Threshold
bandit 0 0 0 0 8212 0 0 PASSED MEDIUM (global)
cdk-nag 0 0 0 0 0 0 0 PASSED MEDIUM (global)
cfn-nag 0 0 0 0 0 0 0 MISSING MEDIUM (global)
checkov 0 0 0 0 0 0 0 PASSED MEDIUM (global)
detect-secrets 0 0 0 0 0 0 0 PASSED MEDIUM (global)
grype 0 0 0 0 0 0 0 MISSING MEDIUM (global)
npm-audit 0 0 0 0 0 0 0 PASSED MEDIUM (global)
opengrep 0 0 0 0 0 0 0 MISSING MEDIUM (global)
semgrep 7 0 0 0 0 0 0 PASSED MEDIUM (global)
syft 0 0 0 0 0 0 0 MISSING MEDIUM (global)

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>
@WilliamK112

Copy link
Copy Markdown
Contributor Author

#696 landed on dev after the approvals and added a bullet to the same ### Fixed list, so this conflicted again. I merged current dev (8d7cc65) in a5cbc16: CHANGELOG only, with the #462 bullet first and this one after it. Source and tests are unchanged from 0f3e947; tests/reporting gives the same result as dev on my Windows machine plus the two tests this PR adds.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTML report: the static non-matches table and the per-document view render None/NaN differently

4 participants