Skip to content

feat(viewer): push-time panes-density readability lint#185

Open
ivanmkc wants to merge 2 commits into
masterfrom
feat/panes-density-lint
Open

feat(viewer): push-time panes-density readability lint#185
ivanmkc wants to merge 2 commits into
masterfrom
feat/panes-density-lint

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jun 16, 2026

Copy link
Copy Markdown
Owner

What

A structurally-valid view can still render unreadably small when too much heavy content is stacked into one layout — the screwbits trigger case (rows, 5 panes, 4 heavy: markdown→flow→component→vegalite→component), where each pane gets a sliver of the viewport. Nothing caught this.

This adds a static, push-time, warn-only density lint that covers every push path (CLI, ADK listener, raw POST /push).

How it landed (adapted from the approved spec)

The approved design predates the severity-tagged geometry-findings system that now exists (geometryReportFinding{severity,code,message}; server returns 200 + {warnings, findings} / 204 / 422 under x-termchart-strict; CLI prints findings). That system already provides all the plumbing the spec proposed as new — so rather than build a parallel readability.ts module + new response shape + CLI change, the density checks are folded into geometryReport and emitted as Findings. This also honors the spec's own principle: "single source of truth … no duplicated lint logic across packages."

  • No server.ts change (already calls geometryReport and returns findings)
  • No push.ts change (CLI already surfaces findings via printGeometry)
  • New warn-only finding codes: rows-overstuffed, columns-too-many, grid-too-many, panes-nested, flow-too-many-nodes

Thresholds (recalibrated against the real corpus)

The spec called its numbers "starting points, not load-bearing constants." The rows rule of ">4 weight OR ≥3 heavy" flagged four curated gallery examples (c4-architecture: wt9/3-heavy; the three explainers: wt7/3-heavy), so it was tightened:

layout warns when screwbits densest gallery
rows ≥4 heavy OR weight >10 wt10 / 4 heavy → warns wt9 / 3 heavy → clean
columns >3 panes max 3 → clean
grid >8 tiles max 4 → clean
nested panes any nested panes none → clean
standalone flow >30 nodes max 14 → clean

A "panes density" calibration guard test asserts no shipped example trips a finding, keeping the thresholds honest.

Tests / verification

  • Viewer typecheck (tsc) — 0 errors
  • Full viewer suite — 478 pass (incl. 73 server/push tests + new calibration guards)
  • CLI suite — 161 pass
  • Real screwbits demo file → rows-overstuffed through the exact geometryReport the server calls

Rollout

Lint runs in the viewer server, so the deployed Cloud Run viewer must be redeployed for cloud pushes to surface these warnings; a local dev viewer picks it up immediately. Warn-only — never blocks a push.

A structurally-valid view can still render unreadably small when too much
heavy content is stacked into one layout — the screwbits trigger case
(`rows`, 5 panes, 4 heavy: markdown→flow→component→vegalite→component),
where each pane gets a sliver of the viewport. Nothing caught this.

Fold density findings into the existing geometryReport so the server and
CLI surface them through the same severity-tagged `findings` channel as the
flow-geometry checks — no parallel module, no new response shape, no CLI
change. (The approved spec predates the geometry-findings system and
proposed all of that plumbing separately; this reuses it, honoring the
spec's own "single source of truth / no duplicated lint logic" principle.)

Warn-only checks, calibrated against the shipped gallery:
- rows: ≥4 heavy panes OR weight >10 (screwbits warns; c4-architecture and
  the explainers — rows, ~3 heavy — stay clean)
- columns: >3 panes; grid: >8 tiles
- nested panes: any pane whose content is itself a panes payload
- standalone flow: >30 nodes

A "panes density" calibration guard asserts no shipped example trips a
finding, keeping the thresholds honest.
Carry the original approved design onto the implementation branch and record
how it actually landed (folded into the existing geometry-findings system,
thresholds recalibrated against the gallery corpus).
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