Skip to content

feat: --format html — visual triage report with per-file spectrum plots (v1.3.0)#45

Merged
Guillain-RDCDE merged 1 commit into
mainfrom
feat/html-report
Jun 5, 2026
Merged

feat: --format html — visual triage report with per-file spectrum plots (v1.3.0)#45
Guillain-RDCDE merged 1 commit into
mainfrom
feat/html-report

Conversation

@Guillain-RDCDE
Copy link
Copy Markdown
Owner

What & why

The reports told you which files were suspect (text/csv) or handed raw numbers to a script (json). This adds a way to see why — a fourth format, --format html: a single self-contained page you double-click to open.

Two parts:

  • Sortable / filterable triage table — click a column to sort, click a verdict to filter.
  • A detail card per flagged file with an inline-SVG spectrum plot: the real FFT magnitude (dB, peak-normalised) of a 10 s middle segment, with the detected cutoff marked. The MP3 "cliff" becomes visible to the eye instead of inferred from a score.

This is also the microscope for eyeballing band-limited false-positives and validating field findings.

Design (lightweight, on-brand)

  • No new dependency. Curve computed with numpy (already core), drawn as a hand-rolled inline <svg> polyline — no matplotlib, no PNGs, no base64.
  • Core analysis path untouched. Spectra are recomputed at report time and only for flagged files (a handful), so the per-file result dict carries no extra payload and json/csv stay lean.
  • Graceful degradation. A file not natively readable (e.g. ALAC/APE without ffmpeg) simply shows no plot; its row and facts remain. The report never fails on one bad curve.

Changes

  • New reporting/html_reporter.py (HTMLReporter, exported from flac_detective.reporting).
  • Wire --format html (argparse choice + dispatch + .html extension).
  • Refactor the format dispatch out of generate_final_report into _write_report (keeps it within the C901 budget).
  • tests/test_html_reporter.py — structure, ranking, HTML escaping, SVG render for a readable flagged file, graceful placeholder, curve shape.
  • Docs (README + user-guide) and a repo-wide version bump 1.2.0 → 1.3.0.

Verification

  • black --check, isort --check-only, flake8, mypy all clean.
  • pytest (excl. integration/benchmarks): 163 passed, 8 pre-existing skips.
  • End-to-end: flac-detective <dir> --format html writes a valid .html; SVG rendering covered by a unit test on a synthetic band-limited file.

Backward compatible; no detection-logic change.

🤖 Generated with Claude Code

…ts (v1.3.0)

Adds a fourth report format: a single self-contained HTML page you open in a
browser. Two parts: a sortable/filterable triage table, and a detail card with
an inline-SVG spectrum plot for every flagged file, so the MP3 "cliff" (a sharp
magnitude drop well below Nyquist) is visible to the eye, with the detected
cutoff marked.

Design: no new dependency (numpy is already core; the curve is drawn as a
hand-rolled inline <svg> polyline — no matplotlib, no PNGs). The core analysis
path is untouched — spectra are recomputed at report time and only for flagged
files, so the per-file result dict carries no extra payload and json/csv stay
lean. A file not natively readable simply shows no plot; the report never fails
because one curve could not render.

- New reporting/html_reporter.py (HTMLReporter, exported from the package).
- Wire --format html (argparse choice + dispatch + .html extension).
- Refactor the format dispatch out of generate_final_report into _write_report
  to keep it within the C901 complexity budget.
- Tests in tests/test_html_reporter.py (structure, ranking, escaping, SVG
  render for a readable flagged file, graceful placeholder, curve shape).
- Docs: README + user-guide; version bump 1.2.0 -> 1.3.0 across the repo.

Backward compatible; no detection-logic change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
return str(p.relative_to(root))
except ValueError:
continue
except Exception:
@Guillain-RDCDE Guillain-RDCDE merged commit 8998191 into main Jun 5, 2026
18 checks passed
@Guillain-RDCDE Guillain-RDCDE deleted the feat/html-report branch June 5, 2026 18:07
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.

2 participants