Skip to content

The web profiler's JS engine doesn't implement small-group/imbalance/missing flags, and the parity test works around it instead of testing it #252

Description

@yakew7

faircode/profiler.py computes a flags field per column - small_group (driven by --min-group-size, #124), plus imbalance/missing warnings - as part of its output dict. assets/profiler-engine.js (the browser-side reimplementation the web profiler runs) has no equivalent: grepped the whole file for every plausible naming of the concept (small_group, smallGroup, MIN_GROUP_SIZE, minGroupSize, MIN_SHARE, minShare) - zero matches.

This is a known, not accidental, divergence: tests/test_js_parity.py's parity tests (test_python_js_profile_parity and the JSON/XLSX variants) each do

python_result.pop("flags", None)
javascript_result.pop("flags", None)

right before asserting the two engines agree - i.e. the parity test works around the gap instead of testing it, so a real regression in either engine's flags logic (or the JS engine simply never having had it) would never be caught by "parity."

Two ways to close this, either is a reasonable PR:

  1. Port the flags logic to assets/profiler-engine.js and delete the two pop("flags", ...) lines so parity is actually verified end-to-end.
  2. If flags is meant to stay CLI-only (maybe deliberately, since the web profiler's UI surfaces things differently), document that explicitly in README/CONTRIBUTING and leave a comment at each pop("flags", ...) explaining why it's excluded, instead of the exclusion being silent.

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