Skip to content

to_html()/the web profiler's downloadable HTML report silently drops imbalance ratio, missing %, and skewness shown everywhere else #283

Description

@yakew7

Both faircode/report.py's to_html() (the --html output for faircode profile) and assets/profiler-ui.js's buildHtmlReport() (the web profiler's 'Download HTML' button) render only the group table and flags for each dimension - neither renders the per-dimension imbalance_ratio, missing_pct, or skewness fields.

Confirmed directly: to_terminal() builds a meta line ('imbalance 3.2x missing 4.0% skew +0.31') from exactly these three fields, and assets/profiler-ui.js's on-screen results view renders the identical line - but grepping both to_html() and buildHtmlReport() for imbalance_ratio/missing_pct/skewness returns nothing in either. to_json() still includes them (it's the raw profile dict), so this is specifically an HTML-rendering gap, not a data gap.

This matters because the downloadable/static HTML report is the artifact most likely to be shared with stakeholders or archived for compliance, and it's silently missing exactly the imbalance/missing-data/skew context every other view shows. tests/test_report.py's mock_profile_result fixture already sets these fields, but test_to_html_renders_key_figures never asserts they appear - which is why this has gone unnoticed.

Proposed scope: add the same 'imbalance {ratio}x missing {pct}% skew {value}' meta line already used in to_terminal()/the on-screen web UI to to_html()'s and buildHtmlReport()'s per-dimension section, and extend test_to_html_renders_key_figures to assert it appears. Good first issue: the exact string format to mirror already exists in both codebases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions