Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.
fix(loop): say station 0 sits at the top, as the placement formula does (#452)
Cathryn Lavery05a858c92880
diff --git a/scripts/test-verify-docs-sync.py b/scripts/test-verify-docs-sync.pyindex c35c2d8..81da257 100644--- a/scripts/test-verify-docs-sync.py+++ b/scripts/test-verify-docs-sync.py@@ -5,6 +5,7 @@ from __future__ import annotationsimport importlib.utilimport json+import reimport sysimport tempfilefrom contextlib import contextmanager@@ -958,6 +959,75 @@ def main() -> int:if errors != [expected]:raise AssertionError(f"light-skin regression was not reported: {errors}")+ # ── Loop station origin (#443) ───────────────────────────────────────────+ loop_reference = (+ ROOT / "skills/diagram-design/references/type-loop.md"+ ).read_text(encoding="utf-8")+ loop_examples = {+ path.name: path.read_text(encoding="utf-8")+ for path in sorted((ROOT / "skills/diagram-design/assets").glob("example-loop*.html"))+ }+ errors = []+ verify.check_loop_station_origin(errors, loop_reference, loop_examples)+ if errors:+ raise AssertionError(f"shipped Loop reference failed: {errors}")++ errors = []+ verify.check_loop_station_origin(+ errors,+ re.sub(r"\bstation \d+ sits at the top", "station 1 sits at the top", loop_reference),+ loop_examples,+ )+ expected = (+ "type-loop.md puts station 1 at the top; "+ "theta_k = -90deg + k * 360/N puts station 0 there"+ )+ if errors != [expected]:+ raise AssertionError(f"station 1 at the top was not reported: {errors}")++ errors = []+ verify.check_loop_station_origin(+ errors, verify.LOOP_ORIGIN_RE.sub("the ring starts here", loop_reference), loop_examples+ )+ expected = "type-loop.md no longer says which station sits at the top"+ if errors != [expected]:+ raise AssertionError(f"a Loop reference with no origin was not reported: {errors}")++ rotated = dict(loop_examples)+ rotated["example-loop.html"] = rotated["example-loop.html"].replace(+ '<rect class="station" x="440" y="68"', '<rect class="station" x="440" y="548"', 1+ )+ errors = []+ verify.check_loop_station_origin(errors, loop_reference, rotated)+ expected = "example-loop.html: the first station is not the topmost station"+ if errors != [expected]:+ raise AssertionError(f"a rotated Loop example was not reported: {errors}")++ unplaced = dict(loop_examples)+ unplaced["example-loop.html"] = unplaced["example-loop.html"].replace(+ '<rect class="station" x="440" y="68"', '<rect class="station" x="440"', 1+ )+ errors = []+ verify.check_loop_station_origin(errors, loop_reference, unplaced)+ expected = "example-loop.html: a station rect has no y attribute to check station order"+ if errors != [expected]:+ raise AssertionError(f"a station rect without y was not reported: {errors}")++ unparsed = dict(loop_examples)+ unparsed["example-loop.html"] = unparsed["example-loop.html"].replace(+ 'class="station', 'class="loop-station'+ )+ errors = []+ verify.check_loop_station_origin(errors, loop_reference, unparsed)+ expected = "example-loop.html: no station rects found to check station order"+ if errors != [expected]:+ raise AssertionError(f"a Loop example with no station rects was not reported: {errors}")++ errors = []+ verify.check_loop_station_origin(errors, loop_reference, {})+ if errors != ["no Loop examples found to check station order"]:+ raise AssertionError(f"missing Loop examples were not reported: {errors}")+# ── type-ramp contract tests ─────────────────────────────────────────────errors = []verify.check_type_ramp(errors, GRID_SKILL, TYPE_RAMP_SPEC)diff --git a/scripts/verify-docs-sync.py b/scripts/verify-docs-sync.pyindex a8f5f5c..8241864 100644--- a/scripts/verify-docs-sync.py+++ b/scripts/verify-docs-sync.py@@ -1,8 +1,9 @@#!/usr/bin/env python3"""Verify that routing and browsing surfaces stay in sync with the skill.-Sixteen drift classes. The first fourteen have each shipped before; the-fifteenth nearly did (#217); the sixteenth guards the ADR 0004 split:+Seventeen drift classes. The first fourteen and the seventeenth have each+shipped before; the fifteenth nearly did (#217); the sixteenth guards the+ADR 0004 split:1. The SKILL.md frontmatter description is the only text an agent sees beforedeciding to load the skill — every visual type in the selection table must@@ -45,6 +46,9 @@ fifteenth nearly did (#217); the sixteenth guards the ADR 0004 split:exactly the presets in the output-spec.md size table, in its order.16. Every SKILL.md section the ADR 0004 split thinned must keep the exact linkto each block it moved out, or that content ships unreachable.+17. Every type-loop.md sentence that names the top station must name station 0,+ as theta_k = -90deg + k * 360/N does, and each Loop example must draw its+ first station topmost (#443)."""from __future__ import annotations@@ -63,6 +67,8 @@ README = ROOT / "README.md"HIGH_LEVEL_REFERENCE = ROOT / "skills/diagram-design/references/type-high-level.md"ONBOARDING_REFERENCE = ROOT / "skills/diagram-design/references/onboarding.md"LINE_DARK_EXAMPLE = ROOT / "skills/diagram-design/assets/example-line-dark.html"+LOOP_REFERENCE = ROOT / "skills/diagram-design/references/type-loop.md"+LOOP_EXAMPLE_GLOB = "example-loop*.html"OUTPUT_SPEC_REFERENCE = ROOT / "skills/diagram-design/references/output-spec.md"VARIANTS = ("", "-dark", "-full")VISUAL_TYPE_COUNT = 45@@ -208,6 +214,44 @@ def check_line_dark_skin(errors: list[str], source: str) -> None:errors.append(f"example-line-dark.html lost canonical dark-skin token {token!r}")+# Each type-loop.md sentence that says which station starts the ring.+LOOP_ORIGIN_RE = re.compile(+ r"`stations\[(\d+)\]` is the top station"+ r"|\b[Ss]tation `?(\d+)`? sits at the top"+ r"|\b[Ss]tation `?(\d+)`? is at `-90deg`"+)+STATION_RECT_RE = re.compile(r"<rect\b[^>]*\bclass=\"station\b[^\"]*\"[^>]*>")+RECT_Y_RE = re.compile(r"\by=\"(-?\d+(?:\.\d+)?)\"")+++def check_loop_station_origin(+ errors: list[str], markdown: str, examples: dict[str, str]+) -> None:+ """theta_k = -90deg + k * 360/N puts station 0 at the top; the prose must agree."""+ origins = [+ next(group for group in match.groups() if group)+ for match in LOOP_ORIGIN_RE.finditer(markdown)+ ]+ if not origins:+ errors.append("type-loop.md no longer says which station sits at the top")+ for index in origins:+ if index != "0":+ errors.append(+ f"type-loop.md puts station {index} at the top; "+ "theta_k = -90deg + k * 360/N puts station 0 there"+ )+ if not examples:+ errors.append("no Loop examples found to check station order")+ for name, source in sorted(examples.items()):+ ys = [RECT_Y_RE.search(tag) for tag in STATION_RECT_RE.findall(source)]+ if not ys:+ errors.append(f"{name}: no station rects found to check station order")+ elif None in ys:+ errors.append(f"{name}: a station rect has no y attribute to check station order")+ elif float(ys[0].group(1)) != min(float(y.group(1)) for y in ys):+ errors.append(f"{name}: the first station is not the topmost station")++def frontmatter_description(markdown: str) -> str:parts = markdown.split("---")if len(parts) < 3:@@ -1736,6 +1780,14 @@ def main() -> int:errors, ONBOARDING_REFERENCE.read_text(encoding="utf-8"))check_line_dark_skin(errors, LINE_DARK_EXAMPLE.read_text(encoding="utf-8"))+ check_loop_station_origin(+ errors,+ LOOP_REFERENCE.read_text(encoding="utf-8"),+ {+ path.name: path.read_text(encoding="utf-8")+ for path in sorted(ASSET_DIR.glob(LOOP_EXAMPLE_GLOB))+ },+ )check_type_ramp_surfaces(errors, ROOT)check_split_routes(errors, SKILL.read_text(encoding="utf-8"))check_legacy_type_sizes(@@ -1756,6 +1808,7 @@ def main() -> int:"files, routing surfaces, size-preset surfaces, ""manifest descriptions, Factory install contract, type-count routing, ""High-Level invariants, onboarding trust boundary, Line dark-skin contract, "+ "Loop station origin, ""font-link parity, title fallback order, type-ramp contract, registered legacy ""type sizes, split routing")diff --git a/skills/diagram-design/references/type-loop.md b/skills/diagram-design/references/type-loop.mdindex aaf2bce..b4b30e3 100644--- a/skills/diagram-design/references/type-loop.md+++ b/skills/diagram-design/references/type-loop.md@@ -60,7 +60,7 @@ station_x(k) = station_center_x(k) - station_w/2station_y(k) = station_center_y(k) - station_h/2```-Thus station 1 sits at the top, and increasing `k` moves clockwise. Round station rectangles to the nearest 4px grid point after computing the ideal geometry; preserve symmetry when rounding paired stations. Keep ring-circle intersection points to three decimal places so every arc remains on the same circle.+Thus station 0 sits at the top, and increasing `k` moves clockwise. Round station rectangles to the nearest 4px grid point after computing the ideal geometry; preserve symmetry when rounding paired stations. Keep ring-circle intersection points to three decimal places so every arc remains on the same circle.### 2.2 Solid ring-flow endpoints