Skip to content

feat(audit): OpenCV graph-balance metrics + flat high-contrast audit theme - #97

Merged
mvalancy merged 1 commit into
devfrom
feat/opencv-balance-metrics
Jun 17, 2026
Merged

feat(audit): OpenCV graph-balance metrics + flat high-contrast audit theme#97
mvalancy merged 1 commit into
devfrom
feat/opencv-balance-metrics

Conversation

@mvalancy

Copy link
Copy Markdown
Member

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" thememain.tsx applies <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

  • The localhost seed graph is well-centred (offMag ~0.05) — so the off-centre case is the small live guest graph at initial load (camera-centering fix is the next PR).
  • The minimap was skewing earlier readings (centroid pulled to its corner); the scan now excludes it. Also noticed the minimap shows "No nodes yet" despite nodes — a separate bug to fix.

Verification

  • @balance 3/3 pass on local dev; web typecheck clean. Metrics-first (records numbers + annotated overlays; thresholds come once centering lands).

🤖 Generated with Claude Code

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>
@github-actions

Copy link
Copy Markdown

🧪 Comprehensive Test Suite

  • Unit suites (Node 18.x & 20.x) — core, web, server, mcp-server: ✅ passed
  • Installer & deploy config: ✅ passed

Full-stack smoke gate runs in the CI workflow.

@mvalancy
mvalancy merged commit 4e08cda into dev Jun 17, 2026
16 checks passed
@mvalancy
mvalancy deleted the feat/opencv-balance-metrics branch June 17, 2026 18:23
mvalancy added a commit that referenced this pull request Jun 18, 2026
Backlog batch: edge-LOD render (#22) + hierarchical layout (#30) + requirements coverage (#97) + MCP assignment tool (#28)
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.

1 participant