Skip to content

fix(reports): unique insight ids, working HTML filters, honest stakeholder change and completeness wording - #371

Merged
kevincostner17 merged 1 commit into
mainfrom
fix/report-rendering
Sep 15, 2026
Merged

kevincostner17 merged 1 commit into
mainfrom
fix/report-rendering

Conversation

@kevincostner17

Copy link
Copy Markdown
Contributor

Summary

  • insight_report issue ids collide for columns whose names slug to the same value #329 insight_report issue ids collided for columns whose names slug the same ("a b", "a_b", "A-B"). Issue ids and the fallback recommended_action_id now use the same seen-counter as action ids (base, base.2, base.3, … in profile order). Non-colliding ids are unchanged.
  • HTML report filter boxes never work: generated script is a JS SyntaxError #336 HTML report filter boxes never worked: filterable_table generated function fdFilter_fd-ledger(){…}, a JavaScript syntax error. The inline oninput handlers and global function are replaced by a static IIFE emitted after each table that locates its table and inputs through document.currentScript and DOM siblings. Output stays deterministic and multiple reports can share a page. The committed docs/examples/*.html pages get the same markup swap (only the filter markup; the pages are otherwise left as committed).
  • Stakeholder summary and Peel view describe preserved missing values as changes #337 stakeholder_summary and the Peel per-column view described preserved missing values (count=0 notes) as changes. A shared changed_values() predicate (count > 0, status not skipped/suggested) now drives the "changed meaningfully" count, the technical "Steps applied" list and plain_step, which keeps the action's description when nothing changed.
  • stakeholder_summary claims 100% completeness when every column was dropped #339 stakeholder_summary claimed 100% completeness when every column was dropped. _pct returns None for zero cells, the completeness sentence is skipped, metrics["completeness"] is "n/a", and the headline reads "Cleaning removed every column, leaving no fields to measure across N record(s); …" (or "every record" when only rows are gone). Un-materialized engine results no longer claim a completeness figure either.

#338 (Markdown table escaping) is not included here; it is covered by #355.

Tests

New tests/test_report_rendering_fixes.py with each issue's reproduction:

  • unique and unchanged insight ids, with recommended action ids still pointing at real actions;
  • no oninput=/fdFilter_ in the filter markup, deterministic output, and every generated <script> passing node --check (skipped when node is absent);
  • stakeholder change counting, plain_step wording, and Peel column rows for preserved gaps;
  • all-columns-dropped, all-records-removed, un-materialized and normal completeness cases.

Verification

  • ruff check . clean; mypy src/freshdata clean (202 files)
  • py3.12: 4260 passed, 6 skipped
  • py3.9: 4256 passed, 10 skipped

Closes #329
Closes #336
Closes #337
Closes #339

…older change and completeness wording

insight_report (#329): issue ids were built as issue.<slug(column)>.<hint>,
so columns whose names slug the same ("a b", "a_b", "A-B") shared one id.
Issue ids and the fallback recommended_action_id now go through the same
seen-counter used for action ids (base, base.2, base.3, ...) in profile
order. Ids for non-colliding columns are unchanged, and issues still point
at the real action id when a clean report is supplied.

HTML filters (#336): filterable_table derived a global function name from
the table id (function fdFilter_fd-ledger), which is a JavaScript syntax
error, so no filter box in any HTML report worked. The inline oninput
handlers and the global function are gone; a static IIFE emitted right
after the table finds its own table and filter inputs through
document.currentScript and DOM siblings. Nothing in the script depends on
the table id, output stays deterministic, and several reports can share a
page. The committed docs/examples pages get the same markup swap.

Change counting (#337): stakeholder_summary counted every action with a
column as a change, and Peel's plain_step reworded informational
"preserved N missing value(s)" notes (count=0) as "filled missing values".
A shared changed_values() predicate (count > 0 and status not skipped or
suggested) now drives the "column(s) changed meaningfully" count, the
technical "Steps applied" list, and plain_step, which keeps the action's
own description when nothing changed.

Completeness (#339): _pct returned 100.0 for a zero-cell frame, so a run
that dropped every column claimed 100% completeness. _pct now returns None
for zero cells; the completeness sentence is skipped when either side is
unknown, metrics["completeness"] is "n/a", and the headline says
"Cleaning removed every column, ..." (or "every record" when only rows
are gone). Un-materialized engine results also stop claiming a
completeness figure.

Closes #329
Closes #336
Closes #337
Closes #339
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a8e575d0-5523-4905-9b0e-28be953d9945


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

FreshData benchmark report — performance

  • freshdata: ?
  • python: ?
  • platform: ?
fixture n_rows n_cols p50 s p95 s peak MB repair % false-repair % preserve % trust monotonic export %

Authored-code reduction (Metric 6)

@kevincostner17
kevincostner17 merged commit 6d88427 into main Sep 15, 2026
21 checks passed
kevincostner17 added a commit that referenced this pull request Sep 15, 2026
Add Unreleased Added, Changed and Fixed entries for merged PRs #351,
#352, #353, #354, #356, #357, #358, #360, #361, #362, #363, #364, #365,
#367, #368, #369, #370, #371, #372, #374, #375, #377, #378 and #379.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant