feat(audit): OpenCV graph-balance metrics + flat high-contrast audit theme - #97
Merged
Conversation
Objective, OpenCV-driven layout measurements (metrics first; pass/fail later): - tests/helpers/balance_metrics.py — given a graph-canvas screenshot, isolates content (flat-bg colour-distance under the audit theme, edge-density fallback) and reports centroid offset from centre, bbox coverage, content usage, L/R+T/B margin balance, quadrant mass distribution, and an informational balanceScore, plus an annotated overlay (content bbox, centroid, frame centre). - tests/diagnostics/graph-balance.spec.ts (@balance) — measures the graph canvas at desktop/laptop/tablet, attaches the annotated overlay + metrics JSON. Phase 1 records numbers (no centering gate yet) so we get baselines before thresholds. Flat high-contrast "audit" theme (groundwork for real a11y theme selection): - main.tsx applies <html data-theme> from ?theme= / graphdone:theme before paint. - index.css [data-theme="contrast"] flattens the lagoon bg, grid, blur and glows to a solid #050608 render — a REAL browser render with layout unchanged, so OpenCV scans are clean and deterministic at every resolution. Baseline (localhost seed): well-centred (offMag ~0.05) — confirms the off-centre case is the small live guest graph at initial load (camera-centring fix next). The metric correctly surfaced that the minimap was skewing earlier readings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (phase 1 of the layout-balance work — metrics first, not pass/fail)
Objective, OpenCV-driven measurements of how the graph is placed on screen, so balance/layout issues become numbers we can track (and later gate on).
tests/helpers/balance_metrics.py— from a graph-canvas screenshot, isolates the rendered content and reports: centroid offset from centre, bbox coverage, content usage %, L/R + T/B margin balance, quadrant mass distribution, and an informational balanceScore — plus an annotated overlay (content bbox, centroid, frame centre). Detection auto-selects flat-bg colour-distance (under the audit theme) or edge-density (fallback).tests/diagnostics/graph-balance.spec.ts(@balance) — measures the canvas at desktop/laptop/tablet, attaches the annotated overlay + metrics JSON to the report. Phase 1 records numbers (no centering gate yet).Flat high-contrast "audit" theme —
main.tsxapplies<html data-theme>from?theme=/graphdone:theme;index.css [data-theme="contrast"]flattens the lagoon background, grid, blur and glows to a solid render. A real browser render with layout unchanged, so OpenCV scans are clean and deterministic — and genuine groundwork for a real high-contrast accessibility theme.Findings the metric already surfaced
Verification
@balance3/3 pass on local dev; web typecheck clean. Metrics-first (records numbers + annotated overlays; thresholds come once centering lands).🤖 Generated with Claude Code