Skip to content

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.

test: demonstrate waterfall mismatch and enforce verifier CI coverage

Cathryn Laverycba0d3552aea
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 99a0cfc..9c8e06c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -103,6 +103,14 @@ Every validation gate below must pass before a PR is ready. They also run automa
The semantic-pattern gate also caps `skills/diagram-design/SKILL.md` at 40,000 bytes so the installed skill remains practical to load. If that gate fails, reduce duplication or move detail into a routed reference; do not remove routing vocabulary from frontmatter. SKILL.md is a router: SVG markup and the long form of the connector rules live in `references/primitives-core.md`, and the 4px grid table, per-type complexity budget rows, page layout, and summary cards live in `references/layout-budget.md` (ADR 0004, 2026-09-27 amendment). A new type's budget row goes in `layout-budget.md`, not SKILL.md.
+### Keep diagram claims checked
+
+Every diagram gets the common skin, accessibility, render, and geometry gates above. A chart with a numerical or structural claim also needs a type-specific verifier: identify the claim (for example, waterfall running totals, Sankey flow conservation, or treemap area shares), bind each displayed value to machine-readable data, and compare the rendered marks and labels with recomputed values. Add a complete valid example and at least one **plausible rendered error** as an adversarial fixture. The [waterfall case](docs/pr-previews/waterfall/plausible-wrong.md) shows a chart whose end label says 236 when its signed contributions sum to 238.
+
+Name the pair `scripts/verify-<type>.py` and `scripts/test-verify-<type>.py`, then run both on the shipped variants in CI. `scripts/test-maintainer-policy.py` now fails if any verifier or its adversarial test is missing from the CI-backed local gate list. This guards the wiring as new checkers arrive.
+
+The current type checkers verify **internal consistency** of the chart and its declarations. They cannot prove that a correctly drawn number matches an external budget, spreadsheet, or API. To cover that boundary for generated diagrams, keep an independent source-data file, make the type verifier compare it with the chart's declarations, package the verifier with the installed skill, and call it from the generated-output self-check. Until a type has that path, run its repository verifier explicitly and do not describe the source data as verified.
+
Keep native plugin and marketplace `description` fields within 500 characters
for Cowork installation compatibility ([#208](https://github.com/cathrynlavery/diagram-design/issues/208)).
They must still name every visual type; keep fuller feature details in the skill
diff --git a/docs/pr-previews/waterfall/plausible-wrong.md b/docs/pr-previews/waterfall/plausible-wrong.md
new file mode 100644
index 0000000..d1f198e
--- /dev/null
+++ b/docs/pr-previews/waterfall/plausible-wrong.md
@@ -0,0 +1,23 @@
+# A waterfall that looked right and failed verification
+
+This is a constructed regression example, based on the shipped cloud-budget chart. Its reserved-instance savings label says **−36** and the end bar says **236**. The layout renders normally, but the declared walk is:
+
+`240 + 64 − 36 + 22 − 52 = 238`
+
+The end should therefore be **238**, not **236**.
+
+![Rendered waterfall with the plausible wrong numbers](plausible-wrong.png)
+
+Run the check from the repository root:
+
+```sh
+python3 scripts/verify-waterfall.py scripts/fixtures/waterfall-plausible-wrong.html
+```
+
+It exits 1 with this finding:
+
+```text
+'FY26 plan' (bar 6): declares 236 but the walk arrives at 238; the running total must conserve
+```
+
+The [HTML fixture](../../../scripts/fixtures/waterfall-plausible-wrong.html) and [regression test](../../../scripts/test-verify-waterfall.py) keep the example reproducible. This verifies consistency among the chart's declared numbers; confirming those numbers against a budget source still requires that source.
diff --git a/docs/pr-previews/waterfall/plausible-wrong.png b/docs/pr-previews/waterfall/plausible-wrong.png
new file mode 100644
index 0000000..6d081f6
Binary files /dev/null and b/docs/pr-previews/waterfall/plausible-wrong.png differ
diff --git a/scripts/fixtures/waterfall-plausible-wrong.html b/scripts/fixtures/waterfall-plausible-wrong.html
new file mode 100644
index 0000000..9a69ccb
--- /dev/null
+++ b/scripts/fixtures/waterfall-plausible-wrong.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<!-- Intentional regression fixture: the printed -36 makes the walk arrive at 238, while the end bar still says 236. -->
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Cloud budget bridge · Waterfall chart</title>
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">
+ <style>
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ :root {
+ --color-paper: #f5f5f5;
+ --color-ink: #2d3142;
+ --color-muted: #4f5d75;
+ --color-accent: #bf4520;
+ --font-sans: 'Geist', system-ui, sans-serif;
+ --font-serif: 'Instrument Serif', serif;
+ --font-mono: 'Geist Mono', ui-monospace, monospace;
+ }
+ body { font-family: var(--font-sans); background: var(--color-paper); color: var(--color-ink); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; }
+ .frame { max-width: 1200px; width: 100%; }
+ .eyebrow { font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.5rem; }
+ h1 { font-family: var(--font-serif); font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem); font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 1.5rem; }
+ .diagram-container { width: 100%; overflow-x: auto; }
+ svg { width: 100%; min-width: 760px; display: block; }
+ </style>
+</head>
+<body>
+ <div class="frame">
+ <p class="eyebrow">Waterfall · Diagram Design</p>
+ <h1>Cloud budget bridge · FY25 → FY26</h1>
+
+ <div class="diagram-container">
+ <svg viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="waterfall-title waterfall-desc">
+ <title id="waterfall-title">Cloud budget bridge · FY25 → FY26</title>
+ <desc id="waterfall-desc">Waterfall chart bridging the FY25 cloud budget of 240 thousand dollars a month to the FY26 plan of 236, through headcount growth, reserved-instance savings, new ML workloads, and storage tiering — the largest saving.</desc>
+ <defs>
+ <pattern id="dots" width="22" height="22" patternUnits="userSpaceOnUse">
+ <circle cx="1" cy="1" r="0.9" fill="rgba(45,49,66,0.10)"/>
+ </pattern>
+ </defs>
+
+ <rect width="100%" height="100%" fill="#f5f5f5"/>
+ <rect width="100%" height="100%" fill="url(#dots)" opacity="0.55"/>
+
+ <!-- Y-axis rotated label -->
+ <text transform="rotate(-90 24 230)" x="24" y="230" fill="#4f5d75" font-size="7" font-family="'Geist Mono', monospace" letter-spacing="0.14em" text-anchor="middle">CLOUD SPEND · $K / MO</text>
+
+ <!-- Horizontal gridlines (drawn before bars). Domain 0–400, y = 420 − 0.95·v -->
+ <line x1="80" y1="325" x2="960" y2="325" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="230" x2="960" y2="230" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="135" x2="960" y2="135" stroke="rgba(45,49,66,0.08)" stroke-width="0.8"/>
+ <line x1="80" y1="40" x2="960" y2="40" stroke="rgba(45,49,66,0.06)" stroke-width="0.8"/>
+
+ <!-- Y-axis line and X-axis baseline (the domain floor: totals anchor here) -->
+ <line x1="80" y1="40" x2="80" y2="420" stroke="rgba(45,49,66,0.25)" stroke-width="1"/>
+ <line x1="80" y1="420" x2="960" y2="420" stroke="rgba(45,49,66,0.25)" stroke-width="1"/>
+
+ <!-- Y-axis tick labels -->
+ <text x="72" y="329" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">100</text>
+ <text x="72" y="234" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">200</text>
+ <text x="72" y="139" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">300</text>
+ <text x="72" y="44" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="end">400</text>
+
+ <!-- ─── CARRIES (drawn before bars; each transports the running total across a gap at its own level) ─── -->
+ <line x1="208" y1="192" x2="256" y2="192" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="240"/>
+ <line x1="352" y1="131" x2="400" y2="131" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="304"/>
+ <line x1="496" y1="167" x2="544" y2="167" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="266"/>
+ <line x1="640" y1="146" x2="688" y2="146" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="288"/>
+ <line x1="784" y1="196" x2="832" y2="196" stroke="rgba(45,49,66,0.55)" stroke-width="1" data-carry="236"/>
+
+ <!-- ─── BARS (width=96, pitch=144). Running total: 240 → 304 → 266 → 288 → 236 → 236 ─── -->
+ <!-- FY25 base: total 240, anchored at the floor. y(240)=192, h=228 -->
+ <rect x="112" y="192" width="96" height="228" fill="#f5f5f5"/>
+ <rect x="112" y="192" width="96" height="228" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1" data-role="total" data-value="240" data-name="FY25 base"/>
+ <text x="160" y="184" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">240</text>
+
+ <!-- Headcount: +64 rises 240 → 304. y(304)=131, h=61 -->
+ <rect x="256" y="131" width="96" height="61" fill="#f5f5f5"/>
+ <rect x="256" y="131" width="96" height="61" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+64" data-name="Headcount"/>
+ <text x="304" y="123" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+64</text>
+
+ <!-- Reserved instances: −38 falls 304 → 266. Hollow = decrease. y=131, h=36 -->
+ <rect x="400" y="131" width="96" height="36" fill="#f5f5f5"/>
+ <rect x="400" y="131" width="96" height="36" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="-36" data-name="Reserved inst."/>
+ <text x="448" y="179" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">−36</text>
+
+ <!-- ML workloads: +22 rises 266 → 288. y(288)=146, h=21 -->
+ <rect x="544" y="146" width="96" height="21" fill="#f5f5f5"/>
+ <rect x="544" y="146" width="96" height="21" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1" data-role="delta" data-value="+22" data-name="ML workloads"/>
+ <text x="592" y="138" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">+22</text>
+
+ <!-- Storage tiering FOCAL: −52 falls 288 → 236 — the largest saving, the story. y=146, h=50 -->
+ <rect x="688" y="146" width="96" height="50" fill="#f5f5f5"/>
+ <rect x="688" y="146" width="96" height="50" fill="rgba(191,69,32,0.12)" stroke="#bf4520" stroke-width="1" data-role="delta" data-value="-52" data-name="Storage tiering"/>
+ <text x="736" y="208" fill="#2d3142" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" font-weight="600">−52</text>
+
+ <!-- FY26 plan: total 236 = 240 + 64 − 38 + 22 − 52, anchored at the floor. y(236)=196, h=224 -->
+ <rect x="832" y="196" width="96" height="224" fill="#f5f5f5"/>
+ <rect x="832" y="196" width="96" height="224" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1" data-role="total" data-value="236" data-name="FY26 plan"/>
+ <text x="880" y="188" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle">236</text>
+
+ <!-- X-axis category labels -->
+ <text x="160" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY25 base</text>
+ <text x="304" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Headcount</text>
+ <text x="448" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Reserved inst.</text>
+ <text x="592" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">ML workloads</text>
+ <text x="736" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">Storage tiering</text>
+ <text x="880" y="440" fill="#2d3142" font-size="11" font-weight="600" font-family="'Geist', sans-serif" text-anchor="middle">FY26 plan</text>
+
+ <!-- Legend -->
+ <line x1="40" y1="462" x2="960" y2="462" stroke="rgba(45,49,66,0.10)" stroke-width="0.8"/>
+ <text x="40" y="478" fill="#4f5d75" font-size="8" font-family="'Geist Mono', monospace" letter-spacing="0.18em">LEGEND</text>
+
+ <rect x="40" y="488" width="16" height="10" rx="2" fill="rgba(45,49,66,0.08)" stroke="#2d3142" stroke-width="1"/>
+ <text x="64" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Start / end total</text>
+
+ <rect x="200" y="488" width="16" height="10" rx="2" fill="rgba(79,93,117,0.15)" stroke="#4f5d75" stroke-width="1"/>
+ <text x="224" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Cost added</text>
+
+ <rect x="340" y="488" width="16" height="10" rx="2" fill="#f5f5f5" stroke="#4f5d75" stroke-width="1"/>
+ <text x="364" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Cost removed</text>
+
+ <rect x="480" y="488" width="16" height="10" rx="2" fill="rgba(191,69,32,0.12)" stroke="#bf4520" stroke-width="1"/>
+ <text x="504" y="497" fill="#4f5d75" font-size="8.5" font-family="'Geist', sans-serif">Storage tiering · largest saving</text>
+ </svg>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/scripts/test-maintainer-policy.py b/scripts/test-maintainer-policy.py
index 2cb9671..e7f0162 100644
--- a/scripts/test-maintainer-policy.py
+++ b/scripts/test-maintainer-policy.py
@@ -3,8 +3,14 @@
``gates.local_commands`` in ``.maintainer-policy.json`` must list exactly the
gates that ``.github/workflows/ci.yml`` runs, so the local suite a maintainer
-runs on a pull request head is the same suite CI enforces. The set of CI gates
-is derived from the workflow's ``run:`` steps with these rules:
+runs on a pull request head is the same suite CI enforces. Every
+``verify-*.py`` script must also have a registered CI gate and an adversarial
+``test-verify-*.py`` gate. The two older exceptions below have their own test
+arrangement. This prevents a new diagram contract from being implemented but
+omitted from continuous checking.
+
+The set of CI gates is derived from the workflow's ``run:`` steps with these
+rules:
- Every ``python``/``python3`` invocation of a ``.py`` file is one gate, even
inside ``$(...)`` or an ``if`` branch. ``python`` is spelled ``python3``
@@ -43,6 +49,14 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
POLICY = ROOT / ".maintainer-policy.json"
CI_WORKFLOW = ROOT / ".github/workflows/ci.yml"
+SCRIPTS = ROOT / "scripts"
+
+# These predate the verify-X/test-verify-X pairing: the import verifier carries
+# its own adversarial cases, and package verification uses test-plugin-package.
+ALTERNATE_TESTS = {
+ "mermaid-import": None,
+ "plugin-package": "test-plugin-package.py",
+}
EXPECTED_MANIFESTS = {
".claude-plugin/plugin.json",
@@ -298,6 +312,33 @@ def policy_failures(policy: dict, workflow: str) -> list[str]:
return failures
+def verifier_coverage_failures(commands: set[str], scripts: set[str]) -> list[str]:
+ """Require every verifier and its regression test in the CI-backed policy."""
+ failures: list[str] = []
+ for filename in sorted(
+ s for s in scripts if s.startswith("verify-") and s.endswith(".py")
+ ):
+ stem = filename[len("verify-") : -len(".py")]
+ verify_command = f"python3 scripts/{filename}"
+ if not any(
+ command.startswith(verify_command + " ") or command == verify_command
+ for command in commands
+ ):
+ failures.append(f"{filename} has no registered CI gate")
+ test_filename = ALTERNATE_TESTS.get(stem, f"test-verify-{stem}.py")
+ if test_filename is None:
+ continue
+ if test_filename not in scripts:
+ failures.append(f"{filename} has no adversarial test {test_filename}")
+ test_command = f"python3 scripts/{test_filename}"
+ if not any(
+ command.startswith(test_command + " ") or command == test_command
+ for command in commands
+ ):
+ failures.append(f"{test_filename} has no registered CI gate")
+ return failures
+
+
SYNTHETIC_POLICY_COMMANDS = [
"python3 scripts/test-maintainer-policy.py",
"python3 scripts/verify-plugin-package.py --require-no-bump origin/main",
@@ -580,6 +621,22 @@ def self_test() -> list[str]:
problems.append(f"self-test '{name}': expected no failures, got {failures}")
elif expected is not None and not any(expected in failure for failure in failures):
problems.append(f"self-test '{name}': expected {expected!r}, got {failures}")
+ coverage_cases = (
+ ("paired verifier and test", {"verify-waterfall.py", "test-verify-waterfall.py"},
+ {"python3 scripts/verify-waterfall.py --all", "python3 scripts/test-verify-waterfall.py"}, None),
+ ("unregistered verifier", {"verify-waterfall.py", "test-verify-waterfall.py"},
+ {"python3 scripts/test-verify-waterfall.py"}, "verify-waterfall.py has no registered CI gate"),
+ ("missing adversarial test", {"verify-waterfall.py"},
+ {"python3 scripts/verify-waterfall.py --all"}, "verify-waterfall.py has no adversarial test"),
+ ("unregistered adversarial test", {"verify-waterfall.py", "test-verify-waterfall.py"},
+ {"python3 scripts/verify-waterfall.py --all"}, "test-verify-waterfall.py has no registered CI gate"),
+ )
+ for name, scripts, commands, expected in coverage_cases:
+ failures = verifier_coverage_failures(commands, scripts)
+ if expected is None and failures:
+ problems.append(f"self-test '{name}': expected no failures, got {failures}")
+ elif expected is not None and not any(expected in failure for failure in failures):
+ problems.append(f"self-test '{name}': expected {expected!r}, got {failures}")
return problems
@@ -594,6 +651,9 @@ def main() -> int:
policy = json.loads(POLICY.read_text(encoding="utf-8"))
workflow = CI_WORKFLOW.read_text(encoding="utf-8")
failures = policy_failures(policy, workflow)
+ failures.extend(verifier_coverage_failures(
+ set(policy["gates"]["local_commands"]), {path.name for path in SCRIPTS.glob("*.py")}
+ ))
if failures:
print("FAIL maintainer policy")
for failure in failures:
diff --git a/scripts/test-verify-waterfall.py b/scripts/test-verify-waterfall.py
index 508cb9c..eb3a59e 100644
--- a/scripts/test-verify-waterfall.py
+++ b/scripts/test-verify-waterfall.py
@@ -23,6 +23,7 @@ ROOT = Path(__file__).resolve().parent.parent
CHECKER = ROOT / "scripts/verify-waterfall.py"
GOOD = ROOT / "skills/diagram-design/assets/example-waterfall.html"
SHIPPED = sorted(GOOD.parent.glob("example-waterfall*.html"))
+PLAUSIBLE_WRONG = ROOT / "scripts/fixtures/waterfall-plausible-wrong.html"
def run(*args: str, timeout: float | None = None) -> tuple[int, str]:
@@ -80,6 +81,14 @@ def main() -> int:
else:
print("OK: --all passes on the shipped set")
+ # A complete, renderable chart with plausible labels still has to reconcile.
+ # Here the printed savings are -36, so the walk reaches 238, not the shown 236.
+ code, output = run(str(PLAUSIBLE_WRONG))
+ if code != 1 or "declares 236 but the walk arrives at 238" not in output:
+ failures.append(f"plausible wrong chart did not name the arithmetic lie:\n{output}")
+ else:
+ print("OK: plausible wrong chart fails on its 238-versus-236 total")
+
# Negative polarity: each mutation must fail with a finding that names the lie.
# Every case below is (name, old, new, expected fragment of the finding).
cases = (