Grid-alignment metric (lint-first baseline for grid snapping) - #62
Conversation
The "lint-first" half of the grid work (before any snapping): a measurement, not a transform. `DiagramLayoutLinter.gridAlignment(_:unit:)` reports the fraction of a box-family diagram's node coordinates that sit on a pixel grid (default 4px), or nil for families a grid doesn't apply to (pie/radar/timeline/ sequence). `report(_:)` appends a non-gating `grid:` line for box families. Deliberately NOT a LayoutViolation: today every box-family layout sits well below full alignment (flowchart 22%, block 9%, state 8% of coords on grid under the test measurer), so a warning would fire on all of them and drown the correctness stream. Instead GridAlignmentTests records a per-type FLOOR the layout can only ratchet UP — mirroring the draw-vs-scene conformance ratchet (ceilings that only fall; here, floors that only rise). A layout change that de-aligns boxes now fails CI; when a GridQuantizer lands, alignment jumps toward 1.0 and the floors get raised. Pure measurement — no geometry changes, so no gallery/perf impact. 411 tests pass (+4). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014CJYAapHgDn2PWGNABnFtv
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Comment |
The lint-first first step of the grid-alignment work (from the layout R&D artifact). Measures, doesn't move.
What
DiagramLayoutLinter.gridAlignment(_:unit:) -> GridAlignment?— fraction of a box-family diagram's node coordinates on a pixel grid (default 4px), ornilfor families a grid doesn't apply to (pie/radar/timeline/sequence/mindmap).report(_:)appends a non-gatinggrid:line for box families.GridAlignmentTestsrecords a per-type floor the layout can only ratchet up — the draw-vs-scene conformance ratchet's discipline, inverted. A layout change that de-aligns boxes fails CI; when aGridQuantizerlands, alignment jumps and floors rise.Why not a warning
Today's box layouts sit far below full alignment (flowchart 22%, block 9%, state 8% of coords on the 4px grid under the test measurer) — a
LayoutViolationwarning would fire on every box-family diagram and drown the correctness stream. So it's a separate measurement the ratchet tracks, surfaced inreport()for human eyes.Scope / safety
Pure measurement — no geometry changes, so no gallery/perf impact. Box families only (
flowchart/block/c4/architecture/er/class/state). 411 tests pass (+4). DocC updated.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.