From 86e00063d3f1cb88eba2f5fd493d05cb42008a6e Mon Sep 17 00:00:00 2001 From: buildnwrite <39439424+ggplab@users.noreply.github.com> Date: Tue, 18 Aug 2026 16:24:05 +0900 Subject: [PATCH] fix(verify-geometry): recognize wider label masks (#84) Extend the verified label-mask width range to 200px while retaining the 14px height cap, with adversarial and shipped-asset coverage, and publish synchronized plugin version 2.4.7. --- .claude-plugin/plugin.json | 2 +- .codex-plugin/plugin.json | 2 +- docs/adr/0005-label-geometry-is-verified.md | 7 ++++++- scripts/test-verify-geometry.py | 22 +++++++++++++++++++++ scripts/verify-geometry.py | 8 +++++--- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index e4b6903..a361f84 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "diagram-design", "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, or DP security matrix diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.", - "version": "2.4.6", + "version": "2.4.7", "author": { "name": "Cathryn Lavery", "url": "https://github.com/cathrynlavery" diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 7798b26..57a3ca5 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "diagram-design", "description": "Create branded architecture, IT current-state, flowchart, sequence, state machine, ER/data model, timeline, swimlane, quadrant, radar/spider, loop/flywheel, nested, tree, org chart, layer stack, Venn, pyramid/funnel, bar, line, Gantt and scatter charts, high-level, process, medallion, data flow, DP integration, or DP security matrix diagrams as standalone HTML/SVG/PNG. Redraw .drawio/.drawio.png/.drawio.svg or Mermaid .mmd sources at a chosen size/detail; onboard brand tokens from a website; add semantic patterns, callouts, accessible motion, or sketchy/hand-drawn styling.", - "version": "2.4.6", + "version": "2.4.7", "author": { "name": "Cathryn Lavery", "url": "https://github.com/cathrynlavery" diff --git a/docs/adr/0005-label-geometry-is-verified.md b/docs/adr/0005-label-geometry-is-verified.md index 49638ae..11ba50b 100644 --- a/docs/adr/0005-label-geometry-is-verified.md +++ b/docs/adr/0005-label-geometry-is-verified.md @@ -32,8 +32,13 @@ three variants at a time. - Geometric contracts in this repo are expressed as checkers with fixtures, in line with how the import extractors are verified. A rule that only lives in prose is a rule that ships broken examples. -- The heuristics are shape-based (node ≥ 60×40, mask 20–120 × 8–14) and match the shipped +- The heuristics are shape-based (node ≥ 60×40, mask 20–200 × 8–14) and match the shipped templates. A future type with markedly different proportions may need the thresholds revisited — widen them in the checker, and add the case to the adversarial tests. + (The width cap was originally 120; the long mono plates in example-sequence-oauth.html + are 128 wide and fell outside the window, so every mask past 120 — including the wider + plates CJK labels produce — went unverified. Widened to 200 with the height cap kept at + 14: raising it to 18 would misclassify ~80 shipped rects — zone eyebrows, container + header bars, row stripes — as masks.) - The checker does not evaluate the 6–10px connector gap from rule 2, which needs stroke geometry rather than rectangles. That rule remains a checklist item. diff --git a/scripts/test-verify-geometry.py b/scripts/test-verify-geometry.py index 3108c3b..ac1b637 100644 --- a/scripts/test-verify-geometry.py +++ b/scripts/test-verify-geometry.py @@ -14,6 +14,7 @@ ASSET_DIR = ROOT / "skills/diagram-design/assets" ARCHITECTURE = ASSET_DIR / "example-architecture.html" SWIMLANE = ASSET_DIR / "example-swimlane.html" ZONED = ASSET_DIR / "example-dp-integration.html" +SEQUENCE_OAUTH = ASSET_DIR / "example-sequence-oauth.html" def load_verifier(): @@ -99,9 +100,30 @@ def main() -> int: 0, ) + # A long mono plate (128px, as shipped in example-sequence-oauth.html) or a + # wide CJK label plate must be recognized as a mask and checked like any other. + check( + "wide mono mask clipped by a later node", + document('' + node), + 1, + ) + check( + "wide mono mask over an earlier node is legal", + document(node + ''), + 0, + ) + # Wide-but-tall rects are container header bars or row stripes, not masks — + # the height cap stays at 14 so they are never reported. + check( + "container header bar is not a mask", + document('' + node), + 0, + ) + check_file("shipped architecture example", ARCHITECTURE, 0) check_file("shipped swimlane example", SWIMLANE, 0) check_file("shipped zoned example", ZONED, 0) + check_file("shipped sequence-oauth example", SEQUENCE_OAUTH, 0) if failures: print("\nFAILURES:") diff --git a/scripts/verify-geometry.py b/scripts/verify-geometry.py index 7fde4c5..34d65b2 100644 --- a/scripts/verify-geometry.py +++ b/scripts/verify-geometry.py @@ -17,8 +17,10 @@ Paint order is what makes this a defect rather than a stylistic choice: Shape heuristics follow the shipped templates: * A node is a `` at least 60x40 - large enough for a title and sublabel. -* A label mask is a `` 20-120 wide and 8-14 tall - the masking plate that - SKILL.md prescribes for arrow labels and zone eyebrows. +* A label mask is a `` 20-200 wide and 8-14 tall - the masking plate that + SKILL.md prescribes for arrow labels and zone eyebrows. The width cap covers + the long mono plates shipped in example-sequence-oauth.html (128px) and the + wider plates CJK labels need at the same glyph count. * A mask fully contained in a node is a badge chip (`EXT`, `EDGE`, `ORIG`) and is legal. @@ -49,7 +51,7 @@ RECT_RE = re.compile( NODE_MIN_W = 60.0 NODE_MIN_H = 40.0 MASK_MIN_W = 20.0 -MASK_MAX_W = 120.0 +MASK_MAX_W = 200.0 MASK_MIN_H = 8.0 MASK_MAX_H = 14.0 EPSILON = 0.5