Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

feat: enforce relationship label clearance (#42)

tt-a1idacbcc60850c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c01ac35f..c9758048 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,10 +5,11 @@ All notable changes are documented here. Format loosely follows [Keep a Changelo
## [Unreleased]
### Added
+- **Clean Label Gate.** Relationship label masks are now measured against every other authored relationship route across all five typed renderers and again in the final HTML checker. `standard` records sub-2px clearance as an exact warning, while `showcase` rejects sub-4px clearance before write and at delivery with both relationship identities, the hit segment, label rectangle, measured distance, threshold, and supported repair controls. A label's own path fragments remain exempt, but shared source/target fan-out does not hide another route. The one real Event Stream collision moved to a clear authored label position, and Proof Lab now publishes 99/99 checks with zero label-route debt. No auto-layout, route rewrite, schema, viewer, export, dependency, or mobile surface was added.
- **Copy Share Card.** The Export menu can now copy the existing canonical 1200×630 Share Card directly as `image/png`, reusing one rasterization promise and preserving the current theme, preset, full-diagram containment, and cleanup contract. A successful clipboard write records the same exact dimensions, bytes, and canonical receipt as download. Unsupported image clipboard APIs disable only the copy action; Share Card download and full-diagram Copy PNG remain unchanged. Real Chrome smoke coverage reads back the copied PNG signature and dimensions without adding a toolbar button, dependency, server, storage, schema, layout, or mobile surface.
- **Verified Open.** `archify deliver ... --open` now hands the exact committed absolute HTML path to the native macOS, Linux, or Windows opener only after render, artifact checks, receipt creation, and atomic replacement succeed. The option is off by default, uses bounded argument arrays without shell interpolation, and never runs on a failed delivery. Missing, unsupported, timed-out, or failed openers leave the verified artifact successful, add a truthful `open.status` to the one-object JSON receipt, and print the manual absolute path to stderr. No viewer, server, watcher, dependency, network, storage, schema, renderer, layout, export, or mobile surface was added.
- **Share Card export.** Every ordinary artifact can now export one canonical 1200×630 PNG for README, release, social, and launch previews. The fixed card chrome fits title and subtitle while the full diagram uses contain-only placement without cropping, preserves the current theme and visual preset, and reuses canonical cleanup so temporary viewer state never enters the image. Exact dimensions, bytes, filename, and canonical state are recorded without claiming validation. Wide-architecture and tall-sequence pixel smoke tests reject blank or malformed cards.
-- **Atomic Verified Delivery.** The zero-dependency CLI now exposes `archify deliver <type> <input.json> [output.html]`: it renders into a unique candidate beside the target, runs the existing eight artifact and composition checks, computes an exact byte count and SHA-256 receipt, and atomically replaces the target only after every deterministic gate passes. `--json` returns stable success or input/prepare/render/check/receipt/commit failure facts for agents and CI. Any failure removes the candidate and preserves the previous artifact byte-for-byte. Existing `render`, `validate`, and `check` behavior remains available for iteration and diagnosis; no schema, renderer, layout, viewer, dependency, network, storage, export, or mobile surface changed. The ZIP builder now also resolves caller-relative output paths before entering its temporary staging directory, and CI exercises that exact packaged path.
+- **Atomic Verified Delivery.** The zero-dependency CLI now exposes `archify deliver <type> <input.json> [output.html]`: it renders into a unique candidate beside the target, runs the complete artifact and composition checks, computes an exact byte count and SHA-256 receipt, and atomically replaces the target only after every deterministic gate passes. `--json` returns stable success or input/prepare/render/check/receipt/commit failure facts for agents and CI. Any failure removes the candidate and preserves the previous artifact byte-for-byte. Existing `render`, `validate`, and `check` behavior remains available for iteration and diagnosis; no schema, renderer, layout, viewer, dependency, network, storage, export, or mobile surface changed. The ZIP builder now also resolves caller-relative output paths before entering its temporary staging directory, and CI exercises that exact packaged path.
- **Live Visual Style Try-on.** Every generated artifact now exposes one compact `Style` control and <kbd>S</kbd> shortcut that cycles the existing Classic, Signal Flow, and Blueprint presets over the exact same authored topology. The page and canonical SVG update together, so an explicit reader choice reaches PNG/JPEG/WebP/SVG/WebM export without moving a node or relationship. The authored preset remains the reload default; no preference, URL, source JSON, schema, layout, dependency, fourth style, or dedicated mobile surface is added, and passive embeds/print remain control-free. A same-topology regression proves canonical SVG geometry is identical across all three presets.
- **Ambiguous Relationship Corridor Gate.** Unrelated relationships that overlap along the same orthogonal lane for at least 8px now produce exact `composition/ambiguous-corridor` evidence instead of silently reading as a false merge or branch. `standard` keeps dense engineering diagrams renderable and records the finding as a warning; `showcase` rejects it before write and in the final artifact check. Relationships sharing a semantic endpoint, point touches, and shorter overlaps remain legal. Two canonical outer-rail routes were repaired without heuristic rerouting, all five renderers share the same detector, and Proof Lab grows to 88/88 checks with zero corridor debt.
- **Artifact-to-install start loop.** The existing viewer footer now offers one restrained, viewer-only `Create yours` link carrying only the typed diagram mode and suppressing its document referrer. A focused bilingual `/start` page turns that mode into canonical install commands, one exact bounded prompt, required evidence, and a verified Proof Lab example without receiving repository content, diagram data, titles, paths, or source JSON; print and canonical exports remain clean.
diff --git a/README.md b/README.md
index 930c6bf6..5a850e54 100644
--- a/README.md
+++ b/README.md
@@ -140,7 +140,7 @@ Architecture examples: [`web-app`](examples/web-app.html) · [`Archify pipeline`
- **Layout judgment over generic auto-layout** — the agent chooses hierarchy, spacing, routes, and emphasis; shared automatic endpoints spread deterministically instead of piling arrows on one midpoint.
- **Typed JSON IR** — every renderer-backed mode has a schema and reproducible source.
-- **Atomic validation before delivery** — schema, layout, HTML/SVG, route, and optional showcase checks must all pass before a final artifact replaces the last known good output.
+- **Atomic validation before delivery** — schema, layout, HTML/SVG, route, and label-to-route clearance checks must all pass before a showcase artifact replaces the last known good output.
- **Truthful interaction** — focus, routes, role comparison, and stories reuse authored nodes and relationships instead of inventing topology.
- **Portable by default** — the result is one HTML file; exports remain full-diagram and free of temporary viewer state.
diff --git a/README_EN.md b/README_EN.md
index 930c6bf6..5a850e54 100644
--- a/README_EN.md
+++ b/README_EN.md
@@ -140,7 +140,7 @@ Architecture examples: [`web-app`](examples/web-app.html) · [`Archify pipeline`
- **Layout judgment over generic auto-layout** — the agent chooses hierarchy, spacing, routes, and emphasis; shared automatic endpoints spread deterministically instead of piling arrows on one midpoint.
- **Typed JSON IR** — every renderer-backed mode has a schema and reproducible source.
-- **Atomic validation before delivery** — schema, layout, HTML/SVG, route, and optional showcase checks must all pass before a final artifact replaces the last known good output.
+- **Atomic validation before delivery** — schema, layout, HTML/SVG, route, and label-to-route clearance checks must all pass before a showcase artifact replaces the last known good output.
- **Truthful interaction** — focus, routes, role comparison, and stories reuse authored nodes and relationships instead of inventing topology.
- **Portable by default** — the result is one HTML file; exports remain full-diagram and free of temporary viewer state.
diff --git a/README_ZH.md b/README_ZH.md
index 18682126..3f7a410e 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -136,7 +136,7 @@ Architecture 示例:[`Web App`](examples/web-app.html) · [`Archify Pipeline`]
- **用布局判断代替通用自动布局** —— Agent 根据故事选择层级、留白、线路和强调关系;共享的自动端点会确定性展开,不再让多支箭头堆在同一个中点。
- **Typed JSON IR** —— 每种 Renderer 模式都有 Schema 和可复现的源文件。
-- **原子交付前校验** —— Schema、布局、HTML/SVG、线路和可选 Showcase 检查必须全部通过,成品才会替换上一份可信结果。
+- **原子交付前校验** —— Schema、布局、HTML/SVG、线路和标签到其他路径的净空检查必须全部通过,Showcase 成品才会替换上一份可信结果。
- **交互不编造拓扑** —— 聚焦、路径、角色对比和故事都复用作者定义的节点与关系。
- **结果默认便携** —— 一个 HTML 文件即可分享;导出永远是完整原图,不携带临时 Viewer 状态。
diff --git a/ROADMAP.md b/ROADMAP.md
index 61333409..226e545c 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,8 +1,10 @@
# Archify Roadmap
-As of v2.11.0, the coordinate-stability work has shipped as JSON IR plus typed renderers for architecture, workflow, sequence, data-flow, and lifecycle diagrams. Workflow diagrams now also have phase/group/exception-lane structure, happy-path linting, trace animation, and route-crossing guards. The shared viewer adds deterministic semantic node IDs, optional author-controlled relationship IDs with durable `#relation=` links, a pre-click Intent Trace for exact one-hop traffic, a two-endpoint Route Probe with an inspectable Route Journey over deterministic shortest authored paths, searchable Node Finder navigation, read-only one-hop focus with a renderer-owned Semantic Passport and copyable focus link, a runtime-built Semantic Radar for desktop viewport navigation, bounded typed guided views with a visible Named Chapter Rail, pre-commit Chapter Delta Preview, Shared Anchor Handoff, and path-aware Semantic Story Beats, a reader-controlled Live/Still Motion Governor, share-ready one-shot chapters with a title/route/step/state/progress cue, a viewport-filling Presentation Stage, Semantic Camera framing, pan/zoom, three reader-switchable visual presets, a contain-only 1200×630 Share Card, and browser-native WebM export. A generated Proof Lab publishes 11 live scenario artifacts with their exact sources, three named reader views, 88 artifact checks, and named composition receipts; its preview grid stays static while deliberate proof links play one named chapter once. The landing-page Live Proof Stage promotes three of those generated artifacts into the first bounded motion proof, and the README motion reel carries the same proof-first story onto GitHub without claiming SVG animation support. A question-first scenario guide maps concrete user needs to those 11 bounded recipes across the five modes, with one shared source for CLI and GitHub Pages and direct proof navigation. A unified CLI (`bin/archify.mjs`) wraps guide, render, deliver, validate, check, and examples, with an optional verified post-commit open for interactive local handoff. This file records the design decisions that led there, plus the ideas that were explicitly declined. The original v2.4 / v2.5 backlog (export-scale URL param, color-blind palette, gzip+base64 share links) was considered and dropped — see [Not planned](#not-planned) for the rationale on each.
+As of v2.11.0, the coordinate-stability work has shipped as JSON IR plus typed renderers for architecture, workflow, sequence, data-flow, and lifecycle diagrams. Workflow diagrams now also have phase/group/exception-lane structure, happy-path linting, trace animation, and route-crossing guards. The shared viewer adds deterministic semantic node IDs, optional author-controlled relationship IDs with durable `#relation=` links, a pre-click Intent Trace for exact one-hop traffic, a two-endpoint Route Probe with an inspectable Route Journey over deterministic shortest authored paths, searchable Node Finder navigation, read-only one-hop focus with a renderer-owned Semantic Passport and copyable focus link, a runtime-built Semantic Radar for desktop viewport navigation, bounded typed guided views with a visible Named Chapter Rail, pre-commit Chapter Delta Preview, Shared Anchor Handoff, and path-aware Semantic Story Beats, a reader-controlled Live/Still Motion Governor, share-ready one-shot chapters with a title/route/step/state/progress cue, a viewport-filling Presentation Stage, Semantic Camera framing, pan/zoom, three reader-switchable visual presets, a contain-only 1200×630 Share Card, and browser-native WebM export. A generated Proof Lab publishes 11 live scenario artifacts with their exact sources, three named reader views, 99 artifact checks, and named composition receipts; its preview grid stays static while deliberate proof links play one named chapter once. The landing-page Live Proof Stage promotes three of those generated artifacts into the first bounded motion proof, and the README motion reel carries the same proof-first story onto GitHub without claiming SVG animation support. A question-first scenario guide maps concrete user needs to those 11 bounded recipes across the five modes, with one shared source for CLI and GitHub Pages and direct proof navigation. A unified CLI (`bin/archify.mjs`) wraps guide, render, deliver, validate, check, and examples, with an optional verified post-commit open for interactive local handoff. This file records the design decisions that led there, plus the ideas that were explicitly declined. The original v2.4 / v2.5 backlog (export-scale URL param, color-blind palette, gzip+base64 share links) was considered and dropped — see [Not planned](#not-planned) for the rationale on each.
-The latest sharing slice adds Copy Share Card. The existing canonical 1200×630 PNG can now move directly to an image clipboard from the Export menu, reusing one rasterization promise and retaining current theme, preset, contain-only geometry, and temporary-state cleanup. Only a successful clipboard write records exact dimensions, bytes, and canonical state. Missing image clipboard support disables this one action while download and full-diagram Copy PNG remain available. Real Chrome smoke reads back the copied PNG signature and dimensions without adding a toolbar control, second renderer, dependency, server, storage, schema, layout, or mobile surface.
+The latest stability slice adds Clean Label Gate across all five typed renderers and the final artifact checker. Actual rendered label masks must remain at least 4px from every other relationship route in `showcase`; `standard` records sub-2px clearance as a warning. Diagnostics preserve both relationship identities, exact segment geometry, the label rectangle, measured distance, threshold, and renderer-supported repair controls. The label's own path fragments are exempt, but shared endpoints do not hide another route. One real Event Stream label moved to a clear authored position, Proof Lab reaches 99/99 checks, and no auto-layout, route rewrite, schema, viewer, export, dependency, or mobile surface was added.
+
+The previous sharing slice added Copy Share Card. The existing canonical 1200×630 PNG can now move directly to an image clipboard from the Export menu, reusing one rasterization promise and retaining current theme, preset, contain-only geometry, and temporary-state cleanup. Only a successful clipboard write records exact dimensions, bytes, and canonical state. Missing image clipboard support disables this one action while download and full-diagram Copy PNG remain available. Real Chrome smoke reads back the copied PNG signature and dimensions without adding a toolbar control, second renderer, dependency, server, storage, schema, layout, or mobile surface.
The previous onboarding slice added Verified Open. `archify deliver ... --open` invokes only the exact absolute final HTML after every renderer, checker, receipt, and atomic-commit gate has passed. macOS, Linux, and Windows use bounded argument-array openers with no shell interpolation. Unsupported, missing, timed-out, or failed openers leave the verified delivery successful, preserve one-object JSON stdout, record a truthful `open.status`, and print the manual absolute path to stderr. The option is off by default and adds no viewer mutation, server, watch process, dependency, network, storage, schema, renderer, layout, export, or mobile surface.
diff --git a/archify.zip b/archify.zip
index fb7da72b..06903504 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/SKILL.md b/archify/SKILL.md
index 4ed9dcdc..e4928d0c 100644
--- a/archify/SKILL.md
+++ b/archify/SKILL.md
@@ -80,7 +80,7 @@ All five modes follow the same loop:
4. Commit the final artifact with `node bin/archify.mjs deliver <type> <input>.json <output>.html --json` and the chosen `--quality`. Deliver renders a unique same-directory candidate, runs the complete artifact checker, computes the exact byte count and SHA-256 receipt, and only replaces the target after all artifact checks pass. Add `--open` only when the user wants an immediate local preview: it runs after that atomic commit, uses one argument-array OS opener with a five-second bound, and records `open.status` without changing delivery success when opening fails or is unsupported. Keep it off for CI, unattended agents, and non-interactive environments. Renderer, checker, receipt, or commit failure returns non-zero, removes the candidate, preserves the previous target unchanged, and never invokes an opener.
5. If any step fails, the error names the JSON path or the fix (thresholds, valid ranges, which knob to change). Fix the JSON and re-run; never edit the renderer.
-Schema violations exit non-zero with path-prefixed messages like `/nodes/3 (id/label: "router") must NOT have additional properties`. The renderers additionally fail fast on established layout problems: node/state overlap (including cross-lane), labels colliding with nodes or other labels, labels wider than their node, out-of-range columns/rows, too-short edges, and legends outside the viewBox. A relationship passing through an unrelated opaque semantic node is always a hard correctness failure, even when neither `meta.quality_profile` nor CLI `--quality` is present: paint order must never make one authored relationship look like a different topology. The shared Clean Flow Gate reports `clean-flow/edge-through-node`, the exact collection/index and optional relationship ID, obstacle ID, first intersecting segment, 2px clearance, and supported routing/placement knobs before output is written. Stricter composition preferences remain profile-aware. For new or edited work, choose `standard` or `showcase` explicitly; structural container-border rules apply to both explicit profiles, unrelated proper X crossings and unrelated collinear overlaps of at least 8px warn in `standard` and fail in `showcase`, and showcase also fails any sub-8px route segment and sub-16px interior turn while preserving ordinary 8–15px endpoint stubs. Collinear corridors are not proper crossings; the separate `composition/ambiguous-corridor` rule exempts relationships with a shared semantic endpoint, point touches, and overlaps below 8px. Source/target boxes are endpoints; boundaries, lanes, stages, lifecycle bands, sequence segments/lifelines/activations, and other containers remain intentional pass-through geometry. CJK text is measured at double width automatically.
+Schema violations exit non-zero with path-prefixed messages like `/nodes/3 (id/label: "router") must NOT have additional properties`. The renderers additionally fail fast on established layout problems: node/state overlap (including cross-lane), labels colliding with nodes or other labels, labels wider than their node, out-of-range columns/rows, too-short edges, and legends outside the viewBox. A relationship passing through an unrelated opaque semantic node is always a hard correctness failure, even when neither `meta.quality_profile` nor CLI `--quality` is present: paint order must never make one authored relationship look like a different topology. The shared Clean Flow Gate reports `clean-flow/edge-through-node`, the exact collection/index and optional relationship ID, obstacle ID, first intersecting segment, 2px clearance, and supported routing/placement knobs before output is written. Stricter composition preferences remain profile-aware. For new or edited work, choose `standard` or `showcase` explicitly; structural container-border rules apply to both explicit profiles, unrelated proper X crossings and unrelated collinear overlaps of at least 8px warn in `standard` and fail in `showcase`, and showcase also fails any sub-8px route segment and sub-16px interior turn while preserving ordinary 8–15px endpoint stubs. The Clean Label Gate measures each renderer's actual relationship-label mask against every other authored route: sub-2px clearance is a `standard` warning, while sub-4px clearance fails `showcase` before write and in the final artifact check. A label's own relationship fragments are exempt, but shared source/target fan-out is not; fix with `labelAt`, `labelDx`/`labelDy`, `labelSegment`, route/via/channel controls, or message `y` in sequence diagrams. Collinear corridors are not proper crossings; the separate `composition/ambiguous-corridor` rule exempts relationships with a shared semantic endpoint, point touches, and overlaps below 8px. Source/target boxes are endpoints; boundaries, lanes, stages, lifecycle bands, sequence segments/lifelines/activations, and other containers remain intentional pass-through geometry. CJK text is measured at double width automatically.
Automatic Port Spread is a default renderer behavior for architecture, workflow, data-flow, and lifecycle diagrams. When two or more eligible automatic relationships share one node-side midpoint, assign deterministic, symmetric edge ports ordered by the opposite endpoint, while preserving a 16px corner gutter. It does not apply to sequence messages, a single relationship, or any relationship with explicit `via`, `channelX`, `channelY`, `labelAt`, or a non-`auto` route; authored geometry always wins. This is bounded endpoint separation, not a graph layout engine, and it must not change topology, schema, labels, presets, viewer state, or export behavior.
@@ -332,7 +332,7 @@ Typography inherits JetBrains Mono from the SVG root. Sizes: 11–12px component
- **Two-rect pattern everywhere**: opaque `c-mask` rect first, styled `c-<type>` rect on top — semi-transparent fills otherwise let arrows bleed through.
- **Arrows before components** in document order (SVG paints in order; arrows must sit behind boxes).
- **Clean flow before delivery**: with or without a quality profile, a relationship may touch its own source/target boxes but must not pass through any unrelated semantic node. If both bounded architecture auto candidates are blocked, fix `clean-flow/edge-through-node` with `fromSide`/`toSide`, a route/channel, explicit `via`, or node placement; do not hide the defect with paint order. This semantic correctness rule is universal, while older profile-less schema-v1 inputs retain advisory handling for stricter composition preferences.
-- **Choose a composition profile deliberately with the user**: `standard` keeps dense engineering topologies renderable and records route-rhythm, proper-X, and unrelated ≥8px collinear-corridor findings as warnings; `showcase` fails those same findings. Both explicit profiles enforce structural border-run checks; universal Clean Flow applies before profile selection. Endpoint stubs from 8–15px, point touches, short corridor overlaps, and shared-endpoint fan-out/merge remain valid. Use `meta.quality_profile` or CLI `--quality`, then repair with route/channel/via/side or placement controls. Do not silently add a profile to an existing v1 file.
+- **Choose a composition profile deliberately with the user**: `standard` keeps dense engineering topologies renderable and records route-rhythm, proper-X, unrelated ≥8px collinear-corridor, and sub-2px label-route clearance findings as warnings; `showcase` fails those findings and requires 4px label-route clearance. Both explicit profiles enforce structural border-run checks; universal Clean Flow applies before profile selection. Endpoint stubs from 8–15px, point touches, short corridor overlaps, and shared-endpoint fan-out/merge remain valid only where they do not pass under another relationship's label mask. Use `meta.quality_profile` or CLI `--quality`, then repair with label, route/channel/via/side, message-y, or placement controls. Do not silently add a profile to an existing v1 file.
- **Vertical stacking**: ≥40px gap between components; inline connectors (message buses, 20px tall) live inside the gap, never overlapping boxes.
- **Boundary padding**: boundary `y` = inner `y` − 30, boundary `height` = inner `height` + 50, label baseline 18px below the boundary top.
- **Legend placement**: outside ALL boundary boxes, ≥20px below the lowest one; grow the viewBox if needed.
diff --git a/archify/examples/event-stream.dataflow.json b/archify/examples/event-stream.dataflow.json
index c6f428a7..9145f1e4 100644
--- a/archify/examples/event-stream.dataflow.json
+++ b/archify/examples/event-stream.dataflow.json
@@ -48,7 +48,7 @@
{ "from": "validate", "to": "dlq", "label": "invalid event", "classification": "dead letter", "variant": "security", "fromSide": "top", "toSide": "top", "via": [[530, 80], [20, 80], [20, 550], [745, 550]], "labelAt": [300, 550] },
{ "from": "enrich", "to": "dlq", "label": "poison event", "classification": "dead letter", "variant": "security", "route": "bottom-channel", "labelDy": 30 },
{ "from": "dlq", "to": "ops", "label": "failure sample", "classification": "restricted", "variant": "security", "route": "vertical-channel" },
- { "from": "dlq", "to": "replay", "label": "approved replay", "classification": "audited batch", "variant": "dashed", "route": "straight" }
+ { "from": "dlq", "to": "replay", "label": "approved replay", "classification": "audited batch", "variant": "dashed", "route": "straight", "labelDy": 30 }
],
"cards": [
{ "dot": "amber", "title": "Transit Contract", "items": ["Every event and topic is named", "Partition keys preserve per-order ordering", "Consumer groups expose processing ownership"] },
diff --git a/archify/renderers/architecture/render-architecture.mjs b/archify/renderers/architecture/render-architecture.mjs
index e8fd995a..e58f9f4c 100644
--- a/archify/renderers/architecture/render-architecture.mjs
+++ b/archify/renderers/architecture/render-architecture.mjs
@@ -14,6 +14,7 @@ import {
cleanAmbiguousCorridorProblems,
cleanBorderRunProblems,
cleanRouteRhythmProblems,
+ cleanLabelRouteClearanceProblems,
suggestLabelObstacleFix,
suggestComponentSeparation,
anchor,
@@ -251,11 +252,11 @@ function validateArchitecture() {
// Connection labels must not land on top of components.
const labelRects = [];
- for (const conn of asArray(arch.connections)) {
+ for (const [connectionIndex, conn] of asArray(arch.connections).entries()) {
if (!conn.label || !components.has(conn.from) || !components.has(conn.to)) continue;
const [lx, ly] = labelPoint(conn, pathFor(conn).points);
const w = Math.max(30, textUnits(conn.label) * 4.8 + 10);
- labelRects.push({ label: conn.label, x: lx - w / 2, y: ly - 10, width: w, height: 14, lx, ly });
+ labelRects.push({ relation: conn, relationIndex: connectionIndex, label: conn.label, x: lx - w / 2, y: ly - 10, width: w, height: 14, lx, ly });
}
for (const rect of labelRects) {
for (const c of components.values()) {
@@ -264,6 +265,15 @@ function validateArchitecture() {
}
}
}
+ problems.push(...cleanLabelRouteClearanceProblems({
+ relations: arch.connections,
+ labels: labelRects,
+ endpointIds: new Set(components.keys()),
+ pathFor,
+ diagramType: 'architecture',
+ relationCollection: 'connections',
+ profile: arch.meta?.quality_profile,
+ }));
if (problems.length) {
throw new Error(`Architecture layout validation failed:\n- ${problems.join('\n- ')}`);
diff --git a/archify/renderers/dataflow/render-dataflow.mjs b/archify/renderers/dataflow/render-dataflow.mjs
index ae94b4f4..e21dc8c1 100644
--- a/archify/renderers/dataflow/render-dataflow.mjs
+++ b/archify/renderers/dataflow/render-dataflow.mjs
@@ -11,6 +11,7 @@ import {
cleanAmbiguousCorridorProblems,
cleanBorderRunProblems,
cleanRouteRhythmProblems,
+ cleanLabelRouteClearanceProblems,
suggestLabelObstacleFix,
suggestLabelPairFix,
anchor,
@@ -48,6 +49,14 @@ const layout = {
labelH: 16
};
+function flowLabelSize(flow) {
+ const longestLine = Math.max(textUnits(flow.label), textUnits(flow.classification || ''));
+ return {
+ width: Math.round(Math.max(34, longestLine * 4.9 + 12) * 10) / 10,
+ height: flow.classification ? 27 : layout.labelH,
+ };
+}
+
function stageX(index) {
return layout.leftX + index * layout.colGap;
}
@@ -205,13 +214,11 @@ function validateDataflow() {
}));
const labelRects = [];
- for (const flow of asArray(dataflow.flows)) {
+ for (const [flowIndex, flow] of asArray(dataflow.flows).entries()) {
if (!flow.label || !nodes.has(flow.from) || !nodes.has(flow.to)) continue;
const [lx, ly] = labelPoint(flow, pathFor(flow).points);
- const longestLine = Math.max(textUnits(flow.label), textUnits(flow.classification || ''));
- const width = Math.max(34, longestLine * 4.9 + 12);
- const height = flow.classification ? 27 : layout.labelH;
- labelRects.push({ label: flow.label, x: lx - width / 2, y: ly - 11, width, height, lx, ly });
+ const { width, height } = flowLabelSize(flow);
+ labelRects.push({ relation: flow, relationIndex: flowIndex, label: flow.label, x: lx - width / 2, y: ly - 11, width, height, lx, ly });
}
for (const rect of labelRects) {
for (const node of nodes.values()) {
@@ -227,6 +234,16 @@ function validateDataflow() {
}
}
}
+ problems.push(...cleanLabelRouteClearanceProblems({
+ relations: dataflow.flows,
+ labels: labelRects,
+ endpointIds: new Set(nodes.keys()),
+ pathFor,
+ diagramType: 'dataflow',
+ relationCollection: 'flows',
+ profile: dataflow.meta?.quality_profile,
+ routeHint: 'adjust labelAt, labelDx, labelDy, or labelSegment; otherwise adjust the other flow route/via/channelX/channelY'
+ }));
const lastStageX = stageX(asArray(dataflow.stages).length - 1);
if (lastStageX + layout.stageW / 2 > viewBox[0] - 24) {
@@ -319,12 +336,10 @@ function renderFlowPath(flow, index) {
function renderFlowLabel(flow, index) {
const routed = pathFor(flow);
const [lx, ly] = labelPoint(flow, routed.points);
- const longestLine = Math.max(textUnits(flow.label), textUnits(flow.classification || ''));
- const labelW = Math.max(34, longestLine * 4.9 + 12);
+ const { width: labelW, height: labelH } = flowLabelSize(flow);
const classification = flow.classification
? `\n <text data-detail="fine" x="${lx}" y="${ly + 11}" class="t-dim" font-size="7" text-anchor="middle">${esc(flow.classification)}</text>`
: '';
- const labelH = flow.classification ? 27 : layout.labelH;
return ` <g data-detail="context" ${focusEdgeAttrs(flow.from, flow.to, flow.label, index, flow.id)}>
<rect x="${lx - labelW / 2}" y="${ly - 11}" width="${labelW}" height="${labelH}" rx="4" class="c-mask"/>
<text x="${lx}" y="${ly}" class="${variantAccent(flow.variant)}" font-size="8" text-anchor="middle">${esc(flow.label)}</text>${classification}
diff --git a/archify/renderers/lifecycle/render-lifecycle.mjs b/archify/renderers/lifecycle/render-lifecycle.mjs
index 191164b1..93e45e7a 100644
--- a/archify/renderers/lifecycle/render-lifecycle.mjs
+++ b/archify/renderers/lifecycle/render-lifecycle.mjs
@@ -11,6 +11,7 @@ import {
cleanAmbiguousCorridorProblems,
cleanBorderRunProblems,
cleanRouteRhythmProblems,
+ cleanLabelRouteClearanceProblems,
suggestLabelObstacleFix,
suggestLabelPairFix,
anchor,
@@ -245,13 +246,13 @@ function validateLifecycle() {
}));
const labelRects = [];
- for (const transition of asArray(lifecycle.transitions)) {
+ for (const [transitionIndex, transition] of asArray(lifecycle.transitions).entries()) {
if (!transition.label || !states.has(transition.from) || !states.has(transition.to)) continue;
const [lx, ly] = labelPoint(transition, pathFor(transition).points);
const longestLine = Math.max(textUnits(transition.label), textUnits(transition.note || ''));
const width = Math.max(32, longestLine * 4.9 + 12);
const height = transition.note ? 27 : 16;
- labelRects.push({ label: transition.label, x: lx - width / 2, y: ly - 11, width, height, lx, ly });
+ labelRects.push({ relation: transition, relationIndex: transitionIndex, label: transition.label, x: lx - width / 2, y: ly - 11, width, height, lx, ly });
}
for (const rect of labelRects) {
for (const state of states.values()) {
@@ -267,6 +268,15 @@ function validateLifecycle() {
}
}
}
+ problems.push(...cleanLabelRouteClearanceProblems({
+ relations: lifecycle.transitions,
+ labels: labelRects,
+ endpointIds: new Set(states.keys()),
+ pathFor,
+ diagramType: 'lifecycle',
+ relationCollection: 'transitions',
+ profile: lifecycle.meta?.quality_profile,
+ }));
if (problems.length) {
throw new Error(`Lifecycle layout validation failed:\n- ${problems.join('\n- ')}`);
diff --git a/archify/renderers/sequence/render-sequence.mjs b/archify/renderers/sequence/render-sequence.mjs
index 14b706cd..9b2a91cc 100644
--- a/archify/renderers/sequence/render-sequence.mjs
+++ b/archify/renderers/sequence/render-sequence.mjs
@@ -2,7 +2,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { esc, renderDefinitions, renderSemanticSigil, textUnits } from '../shared/utils.mjs';
import { animateAttr, focusEdgeAttrs, focusNodeAttrs, focusNodeTitle, loadDiagram, writeDiagram, svgAccessibleText, svgRootAttrs } from '../shared/cli.mjs';
-import { componentFill, arrowClassMap, rectsOverlap, cleanFlowProblems, cleanCrossingProblems, cleanAmbiguousCorridorProblems, cleanBorderRunProblems, cleanRouteRhythmProblems, routePointsValue, asArray, isFinitePoint } from '../shared/geometry.mjs';
+import { componentFill, arrowClassMap, rectsOverlap, cleanFlowProblems, cleanCrossingProblems, cleanAmbiguousCorridorProblems, cleanBorderRunProblems, cleanRouteRhythmProblems, cleanLabelRouteClearanceProblems, routePointsValue, asArray, isFinitePoint } from '../shared/geometry.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const { diagram: sequence, template, outPath } = loadDiagram({
@@ -183,13 +183,14 @@ function validateSequence() {
// Label masks can extend well past the arrow span, so check the actual
// label rectangles too — tangent arrows with long labels still collide.
const labelRects = asArray(sequence.messages)
- .filter((m) => participants.has(m.from) && participants.has(m.to) && typeof m.y === 'number')
- .map((m) => {
+ .map((m, messageIndex) => {
+ if (!participants.has(m.from) || !participants.has(m.to) || typeof m.y !== 'number') return null;
const x1 = participants.get(m.from).cx;
const x2 = participants.get(m.to).cx;
const width = Math.max(34, textUnits(m.label) * 5.2 + 12);
- return { label: m.label, x: (x1 + x2) / 2 - width / 2, y: m.y - 20, width, height: layout.labelH };
- });
+ return { relation: m, relationIndex: messageIndex, label: m.label, x: (x1 + x2) / 2 - width / 2, y: m.y - 20, width, height: layout.labelH };
+ })
+ .filter(Boolean);
for (let i = 0; i < labelRects.length; i += 1) {
for (let j = i + 1; j < labelRects.length; j += 1) {
if (rectsOverlap(labelRects[i], labelRects[j], -2)) {
@@ -197,6 +198,16 @@ function validateSequence() {
}
}
}
+ problems.push(...cleanLabelRouteClearanceProblems({
+ relations: sequence.messages,
+ labels: labelRects,
+ endpointIds: new Set(participants.keys()),
+ pathFor: messagePath,
+ diagramType: 'sequence',
+ relationCollection: 'messages',
+ profile: sequence.meta?.quality_profile,
+ routeHint: 'spread the message y values, shorten the label, or reorder participants so the adjacent route stays visible'
+ }));
for (const segment of asArray(sequence.segments)) {
if (segment.to <= segment.from) {
diff --git a/archify/renderers/shared/geometry.mjs b/archify/renderers/shared/geometry.mjs
index 6d9818cf..ea42b0a1 100644
--- a/archify/renderers/shared/geometry.mjs
+++ b/archify/renderers/shared/geometry.mjs
@@ -41,6 +41,135 @@ export function segmentIntersectsRect(segment, rect, gap = 0) {
);
}
+export function segmentRectClearance(segment, rect) {
+ if (!segment || !rect) return null;
+ const { start, end } = segment;
+ if (!Array.isArray(start) || !Array.isArray(end) || start.length !== 2 || end.length !== 2) return null;
+ if (!isFinitePoint(...start, ...end, rect.x, rect.y, rect.width, rect.height)) return null;
+ if (rect.width < 0 || rect.height < 0) return null;
+ if (segmentIntersectsRect(segment, rect)) return 0;
+
+ const corners = [
+ [rect.x, rect.y],
+ [rect.x + rect.width, rect.y],
+ [rect.x + rect.width, rect.y + rect.height],
+ [rect.x, rect.y + rect.height],
+ ];
+ return Math.min(
+ pointRectDistance(start, rect),
+ pointRectDistance(end, rect),
+ ...corners.map((corner) => pointSegmentDistance(corner, start, end)),
+ );
+}
+
+export function segmentRectIntersectionLength(segment, rect) {
+ if (!segment || !rect) return null;
+ const { start, end } = segment;
+ if (!Array.isArray(start) || !Array.isArray(end) || start.length !== 2 || end.length !== 2) return null;
+ if (!isFinitePoint(...start, ...end, rect.x, rect.y, rect.width, rect.height)) return null;
+ if (rect.width < 0 || rect.height < 0) return null;
+
+ const dx = end[0] - start[0];
+ const dy = end[1] - start[1];
+ const length = Math.hypot(dx, dy);
+ if (length <= 0.0000001) return 0;
+ const bounds = [
+ [-dx, start[0] - rect.x],
+ [dx, rect.x + rect.width - start[0]],
+ [-dy, start[1] - rect.y],
+ [dy, rect.y + rect.height - start[1]],
+ ];
+ let enter = 0;
+ let leave = 1;
+ for (const [direction, distance] of bounds) {
+ if (Math.abs(direction) <= 0.0000001) {
+ if (distance < -0.0000001) return 0;
+ continue;
+ }
+ const ratio = distance / direction;
+ if (direction < 0) enter = Math.max(enter, ratio);
+ else leave = Math.min(leave, ratio);
+ if (enter > leave + 0.0000001) return 0;
+ }
+ return length * Math.max(0, leave - enter);
+}
+
+export function collectLabelRouteClearance({ labels, routedRelations, threshold }) {
+ if (!Number.isFinite(threshold) || threshold < 0) return [];
+ const routeCandidates = asArray(routedRelations).map((entry, fallbackIndex) => {
+ const relation = entry?.relation || entry;
+ const points = normalizeRoutePoints(entry?.points || relation?.routePoints);
+ if (!relation || points.length < 2) return null;
+ return {
+ relation,
+ relationIndex: Number.isInteger(entry?.relationIndex) ? entry.relationIndex : fallbackIndex,
+ points,
+ };
+ }).filter(Boolean);
+ const seenRoutes = new Set();
+ const routes = routeCandidates.filter((route) => {
+ const identity = relationshipIdentity(route.relation, route.relationIndex);
+ if (seenRoutes.has(identity)) return false;
+ seenRoutes.add(identity);
+ return true;
+ });
+ const hits = [];
+ const seenLabels = new Set();
+
+ for (const [fallbackIndex, label] of asArray(labels).entries()) {
+ const rect = label?.rect || label;
+ if (!rect || !isFinitePoint(rect.x, rect.y, rect.width, rect.height) || rect.width < 0 || rect.height < 0) continue;
+ const relationIndex = Number.isInteger(label?.relationIndex) ? label.relationIndex : fallbackIndex;
+ const labelIdentity = relationshipIdentity(label?.relation, relationIndex);
+ if (seenLabels.has(labelIdentity)) continue;
+ seenLabels.add(labelIdentity);
+ for (const route of routes) {
+ if (relationIndex === route.relationIndex || sameRelationship(label?.relation, route.relation)) continue;
+ let nearest = null;
+ for (let segmentIndex = 0; segmentIndex < route.points.length - 1; segmentIndex += 1) {
+ const start = route.points[segmentIndex];
+ const end = route.points[segmentIndex + 1];
+ const clearance = segmentRectClearance({ start, end }, rect);
+ if (clearance == null) continue;
+ if (!nearest || clearance < nearest.clearance) {
+ nearest = {
+ clearance,
+ intersectionLength: segmentRectIntersectionLength({ start, end }, rect),
+ segmentIndex,
+ start,
+ end,
+ };
+ }
+ }
+ if (!nearest || nearest.clearance + 0.0001 >= threshold) continue;
+ hits.push({
+ label,
+ labelRelation: label?.relation,
+ labelRelationIndex: relationIndex,
+ otherRelation: route.relation,
+ otherRelationIndex: route.relationIndex,
+ rect,
+ ...nearest,
+ threshold,
+ });
+ }
+ }
+ return hits;
+}
+
+function relationshipIdentity(relation, relationIndex) {
+ if (relation?.key !== undefined) return `key:${relation.key}`;
+ if (relation?.id) return `id:${relation.from || ''}\u0000${relation.to || ''}\u0000${relation.id}`;
+ return `index:${relationIndex}`;
+}
+
+function sameRelationship(left, right) {
+ if (!left || !right) return false;
+ if (left === right) return true;
+ if (left.key !== undefined && right.key !== undefined) return left.key === right.key;
+ return Boolean(left.id && right.id && left.id === right.id && left.from === right.from && left.to === right.to);
+}
+
// One mechanical quality gate for every renderer-owned relationship path.
// A renderer supplies its semantic obstacle set; source/target boxes are
// always exempt because paths are expected to terminate on their boundaries.
@@ -451,6 +580,37 @@ export function cleanRouteRhythmProblems({
});
}
+export function cleanLabelRouteClearanceProblems({
+ relations,
+ labels,
+ endpointIds,
+ pathFor,
+ diagramType,
+ relationCollection,
+ profile,
+ threshold = 4,
+ routeHint = 'adjust labelAt, labelDx, labelDy, or labelSegment; otherwise adjust the other relationship route/via/channel',
+}) {
+ const requestedProfile = process.env.ARCHIFY_QUALITY_PROFILE || profile;
+ if (requestedProfile !== 'showcase') return [];
+ const routedRelations = asArray(relations).map((relation, relationIndex) => {
+ if (!relation || typeof relation.from !== 'string' || typeof relation.to !== 'string') return null;
+ if (endpointIds && (!endpointIds.has(relation.from) || !endpointIds.has(relation.to))) return null;
+ return { relation, relationIndex, points: pathFor(relation)?.points };
+ }).filter(Boolean);
+ return collectLabelRouteClearance({ labels, routedRelations, threshold }).map((hit) => {
+ const describe = (relation, relationIndex) => {
+ const relationId = relation?.id ? ` id "${relation.id}"` : '';
+ const relationLabel = relation?.label ? ` label "${relation.label}"` : '';
+ return `${relationCollection}[${relationIndex}]${relationId} "${relation?.from}" -> "${relation?.to}"${relationLabel}`;
+ };
+ const clearance = Math.round(hit.clearance * 10) / 10;
+ const from = hit.start.map((value) => Math.round(value * 10) / 10).join(', ');
+ const to = hit.end.map((value) => Math.round(value * 10) / 10).join(', ');
+ return `[composition/label-route-clearance] showcase ${diagramType} label "${hit.label?.label || hit.labelRelation?.label || ''}" on ${describe(hit.labelRelation, hit.labelRelationIndex)} is ${clearance}px from ${describe(hit.otherRelation, hit.otherRelationIndex)} segment ${hit.segmentIndex} [${from}] -> [${to}] (label rect ${formatRect(hit.rect)}; minimum ${threshold}px) — ${routeHint}.`;
+ });
+}
+
function segmentPosition(index, segmentCount) {
if (index === 0) return 'source-stub';
if (index === segmentCount - 1) return 'target-stub';
@@ -472,6 +632,21 @@ function normalizeRoutePoints(points) {
return normalized;
}
+function pointRectDistance(point, rect) {
+ const dx = Math.max(rect.x - point[0], 0, point[0] - (rect.x + rect.width));
+ const dy = Math.max(rect.y - point[1], 0, point[1] - (rect.y + rect.height));
+ return Math.hypot(dx, dy);
+}
+
+function pointSegmentDistance(point, start, end) {
+ const dx = end[0] - start[0];
+ const dy = end[1] - start[1];
+ const lengthSquared = dx * dx + dy * dy;
+ if (lengthSquared <= 0.0000001) return Math.hypot(point[0] - start[0], point[1] - start[1]);
+ const projection = Math.max(0, Math.min(1, ((point[0] - start[0]) * dx + (point[1] - start[1]) * dy) / lengthSquared));
+ return Math.hypot(point[0] - (start[0] + projection * dx), point[1] - (start[1] + projection * dy));
+}
+
function collinearForward(a, b, c) {
if (Math.abs(crossProduct(a, b, c)) > 0.0001) return false;
return (b[0] - a[0]) * (c[0] - b[0]) + (b[1] - a[1]) * (c[1] - b[1]) >= -0.0001;
diff --git a/archify/renderers/workflow/render-workflow.mjs b/archify/renderers/workflow/render-workflow.mjs
index 394d006a..094f0c11 100644
--- a/archify/renderers/workflow/render-workflow.mjs
+++ b/archify/renderers/workflow/render-workflow.mjs
@@ -11,6 +11,7 @@ import {
cleanAmbiguousCorridorProblems,
cleanBorderRunProblems,
cleanRouteRhythmProblems,
+ cleanLabelRouteClearanceProblems,
suggestLabelObstacleFix,
suggestLabelPairFix,
anchor,
@@ -349,11 +350,11 @@ function validateWorkflow() {
}
const labelRects = [];
- for (const edge of workflow.edges) {
+ for (const [edgeIndex, edge] of workflow.edges.entries()) {
if (!edge.label || !nodes.has(edge.from) || !nodes.has(edge.to)) continue;
const [lx, ly] = labelPoint(edge, pathFor(edge).points);
const width = Math.max(30, textUnits(edge.label) * 4.8 + 10);
- labelRects.push({ label: edge.label, x: lx - width / 2, y: ly - 10, width, height: 14, lx, ly });
+ labelRects.push({ relation: edge, relationIndex: edgeIndex, label: edge.label, x: lx - width / 2, y: ly - 10, width, height: 14, lx, ly });
}
for (const rect of labelRects) {
for (const node of nodes.values()) {
@@ -369,6 +370,15 @@ function validateWorkflow() {
}
}
}
+ problems.push(...cleanLabelRouteClearanceProblems({
+ relations: workflow.edges,
+ labels: labelRects,
+ endpointIds: new Set(nodes.keys()),
+ pathFor,
+ diagramType: 'workflow',
+ relationCollection: 'edges',
+ profile: workflow.meta?.quality_profile,
+ }));
if (viewBox[0] < layout.laneX + layout.laneW + 16) {
problems.push(`viewBox width ${viewBox[0]} clips the ${layout.laneW}px lanes — set meta.viewBox[0] to at least ${layout.laneX + layout.laneW + 16}.`);
diff --git a/archify/scripts/check-render-output.mjs b/archify/scripts/check-render-output.mjs
index 495d64b7..3b592725 100644
--- a/archify/scripts/check-render-output.mjs
+++ b/archify/scripts/check-render-output.mjs
@@ -2,7 +2,7 @@
import fs from 'node:fs';
import path from 'node:path';
-import { collectAmbiguousCorridors, collectBorderRuns, collectRouteRhythmIssues, routeBudgetMetrics } from '../renderers/shared/geometry.mjs';
+import { collectAmbiguousCorridors, collectBorderRuns, collectLabelRouteClearance, collectRouteRhythmIssues, routeBudgetMetrics } from '../renderers/shared/geometry.mjs';
const input = process.argv[2];
@@ -34,6 +34,8 @@ let composition = {
properCrossings: 0,
ambiguousCorridors: 0,
containerBorderRuns: 0,
+ labelRouteClearanceIssues: 0,
+ minLabelRouteClearance: null,
maxBends: 0,
routesOverSuggestedBends: 0,
maxStretch: null,
@@ -90,16 +92,31 @@ if (svgMatches.length === 1) {
const routeMetrics = routeBudgetMetrics({ routedRelations: routedRelationships });
const routeRhythmIssues = collectRouteRhythmIssues({ routedRelations: routedRelationships });
const ambiguousCorridors = collectAmbiguousCorridors({ routedRelations: routedRelationships });
+ const relationshipLabels = collectRelationshipLabelMasks(beforeLegend, arrows);
+ const labelClearanceThreshold = qualityProfile === 'showcase' ? 4 : 2;
+ const labelRouteMeasurements = collectLabelRouteClearance({
+ labels: relationshipLabels,
+ routedRelations: arrows.map((arrow) => ({ relation: arrow, relationIndex: arrow.index, points: arrow.routePoints })),
+ threshold: Number.MAX_VALUE,
+ });
+ const labelRouteClearance = collectLabelRouteClearance({
+ labels: relationshipLabels,
+ routedRelations: arrows.map((arrow) => ({ relation: arrow, relationIndex: arrow.index, points: arrow.routePoints })),
+ threshold: labelClearanceThreshold,
+ });
const crossingIsError = qualityProfile === 'showcase';
const corridorIsError = qualityProfile === 'showcase';
const rhythmIsError = qualityProfile === 'showcase';
+ const labelClearanceIsError = qualityProfile === 'showcase';
const compositionErrors = (qualityGatesEnforced ? containerBorderRuns.length : 0)
+ (crossingIsError ? relationshipCrossings.length : 0)
+ (corridorIsError ? ambiguousCorridors.length : 0)
+ + (labelClearanceIsError ? labelRouteClearance.length : 0)
+ (rhythmIsError ? routeRhythmIssues.length : 0);
const compositionWarnings = (qualityGatesEnforced ? 0 : containerBorderRuns.length)
+ (crossingIsError ? 0 : relationshipCrossings.length)
+ (corridorIsError ? 0 : ambiguousCorridors.length)
+ + (labelClearanceIsError ? 0 : labelRouteClearance.length)
+ (rhythmIsError ? 0 : routeRhythmIssues.length);
composition = {
schemaVersion: 1,
@@ -113,6 +130,10 @@ if (svgMatches.length === 1) {
properCrossings: relationshipCrossings.length,
ambiguousCorridors: ambiguousCorridors.length,
containerBorderRuns: containerBorderRuns.length,
+ labelRouteClearanceIssues: labelRouteClearance.length,
+ minLabelRouteClearance: labelRouteMeasurements.length
+ ? Math.round(Math.min(...labelRouteMeasurements.map((hit) => hit.clearance)) * 10) / 10
+ : null,
...roundedRouteMetrics(routeMetrics),
},
suggestedLimits: { bendsPerRelationship: 2, stretch: 1.35, segmentPx: 16, microSegmentPx: 8 },
@@ -128,6 +149,20 @@ if (svgMatches.length === 1) {
from: hit.overlapStart.map((value) => Math.round(value * 10) / 10),
to: hit.overlapEnd.map((value) => Math.round(value * 10) / 10),
})),
+ ...labelRouteClearance.map((hit) => ({
+ severity: labelClearanceIsError ? 'error' : 'warning',
+ code: 'composition/label-route-clearance',
+ label: hit.label?.label || hit.labelRelation?.label || '',
+ labelRelationship: relationshipRecord(hit.labelRelation),
+ otherRelationship: relationshipRecord(hit.otherRelation),
+ segmentIndex: hit.segmentIndex,
+ labelRect: roundedRect(hit.rect),
+ clearance: Math.round(hit.clearance * 10) / 10,
+ intersectionLength: Math.round((hit.intersectionLength || 0) * 10) / 10,
+ threshold: hit.threshold,
+ from: hit.start.map((value) => Math.round(value * 10) / 10),
+ to: hit.end.map((value) => Math.round(value * 10) / 10),
+ })),
...relationshipCrossings.map((hit) => ({
severity: crossingIsError ? 'error' : 'warning',
code: 'composition/proper-crossing',
@@ -158,6 +193,13 @@ if (svgMatches.length === 1) {
})),
],
};
+ addCheck(
+ 'label_route_clearance',
+ !labelClearanceIsError || labelRouteClearance.length === 0,
+ labelRouteClearance.map((hit) => (
+ `[composition/label-route-clearance] ${qualityProfile} label "${hit.label?.label || hit.labelRelation?.label || ''}" on ${relationshipName(hit.labelRelation)} is ${Math.round(hit.clearance * 10) / 10}px from ${relationshipName(hit.otherRelation)} segment ${hit.segmentIndex} [${formatPoint(hit.start)}] -> [${formatPoint(hit.end)}]${hit.intersectionLength > 0 ? ` with ${Math.round(hit.intersectionLength * 10) / 10}px hidden by the mask` : ''} (minimum ${hit.threshold}px) — use renderer-supported label controls (message y for sequence; otherwise labelAt, labelDx, labelDy, or labelSegment), or adjust the other relationship route/via/channel.`
+ )),
+ );
addCheck(
'relationship_crossings',
!crossingIsError || relationshipCrossings.length === 0,
@@ -232,12 +274,66 @@ function collectArrows(fragment) {
from: attrs['data-edge-from'] || attrs['data-composition-edge-from'],
to: attrs['data-edge-to'] || attrs['data-composition-edge-to'],
id: attrs['data-edge-id'] || attrs['data-composition-edge-id'],
+ key: attrs['data-edge-key'],
+ label: attrs['data-edge-label'],
+ offset: tag.index,
});
}
return arrows;
}
+function collectRelationshipLabelMasks(fragment, arrows) {
+ const labels = [];
+ for (const match of fragment.matchAll(/<g\b[^>]*\bdata-edge-(?:key|id|from)="[^"]*"[^>]*>[\s\S]*?<\/g>/gi)) {
+ const group = match[0];
+ const groupAttrs = parseAttrs(group.match(/<g\b[^>]*>/i)?.[0] || '');
+ const rectTag = [...group.matchAll(/<rect\b[^>]*>/gi)]
+ .map((item) => item[0])
+ .find((tag) => /\bclass="[^"]*\bc-mask\b/.test(tag));
+ if (!rectTag) continue;
+ const attrs = parseAttrs(rectTag);
+ const rect = {
+ x: numberAttr(attrs, 'x'),
+ y: numberAttr(attrs, 'y'),
+ width: numberAttr(attrs, 'width'),
+ height: numberAttr(attrs, 'height'),
+ };
+ if (![rect.x, rect.y, rect.width, rect.height].every(Number.isFinite)) continue;
+ const groupStart = match.index;
+ const groupEnd = groupStart + group.length;
+ const containedOwner = arrows.find((arrow) => (
+ arrow.offset > groupStart
+ && arrow.offset < groupEnd
+ && arrow.from === groupAttrs['data-edge-from']
+ && arrow.to === groupAttrs['data-edge-to']
+ && (!groupAttrs['data-edge-id'] || !arrow.id || arrow.id === groupAttrs['data-edge-id'])
+ ));
+ const owner = arrows.find((arrow) => (
+ groupAttrs['data-edge-key'] !== undefined && arrow.key === groupAttrs['data-edge-key']
+ )) || containedOwner || arrows.find((arrow) => (
+ arrow.id === groupAttrs['data-edge-id']
+ && arrow.from === groupAttrs['data-edge-from']
+ && arrow.to === groupAttrs['data-edge-to']
+ ));
+ if (!owner) continue;
+ if (owner.key === undefined && groupAttrs['data-edge-key'] !== undefined) owner.key = groupAttrs['data-edge-key'];
+ if (!owner.id && groupAttrs['data-edge-id']) owner.id = groupAttrs['data-edge-id'];
+ if (!owner.label && groupAttrs['data-edge-label']) owner.label = groupAttrs['data-edge-label'];
+ labels.push({
+ relation: owner,
+ relationIndex: owner.index,
+ label: groupAttrs['data-edge-label'] || '',
+ rect,
+ });
+ }
+ return labels;
+}
+
+function roundedRect(rect) {
+ return Object.fromEntries(Object.entries(rect).map(([key, value]) => [key, Math.round(value * 10) / 10]));
+}
+
function roundedRouteMetrics(metrics) {
return {
...metrics,
@@ -282,10 +378,13 @@ function relationshipName(arrow) {
}
function relationshipRecord(arrow) {
+ const stableIndex = Number(arrow.key);
return {
id: arrow.id,
from: arrow.from,
to: arrow.to,
+ label: arrow.label || '',
+ collectionIndex: Number.isInteger(stableIndex) && stableIndex >= 0 ? stableIndex : arrow.index - 1,
artifactIndex: arrow.index,
};
}
diff --git a/archify/test/cli.test.mjs b/archify/test/cli.test.mjs
index 08d8da66..8b169eee 100644
--- a/archify/test/cli.test.mjs
+++ b/archify/test/cli.test.mjs
@@ -244,8 +244,8 @@ test('cli: deliver atomically writes a checked artifact and structured receipt',
assert.equal(receipt.artifact.sha256, sha256(out));
assert.equal(receipt.artifact.bytes, fs.statSync(out).size);
assert.deepEqual(receipt.validation, {
- checksPassed: 8,
- checkCount: 8,
+ checksPassed: 9,
+ checkCount: 9,
compositionProfile: 'showcase',
compositionStatus: 'pass',
errors: 0,
@@ -373,7 +373,7 @@ test('cli: deliver works from an installed skill without node_modules', () => {
});
assert.equal(result.status, 0, `${type}: ${result.stderr}`);
- assert.equal(JSON.parse(result.stdout).validation.checkCount, 8, type);
+ assert.equal(JSON.parse(result.stdout).validation.checkCount, 9, type);
assert.equal(fs.existsSync(out), true, type);
}
});
@@ -510,7 +510,7 @@ test('cli: validate emits structured json without keeping html output', () => {
const parsed = JSON.parse(result.stdout);
assert.equal(parsed.ok, true);
assert.equal(parsed.type, 'workflow');
- assert.equal(parsed.checks.length, 8);
+ assert.equal(parsed.checks.length, 9);
assert.equal(parsed.composition.profile, 'showcase');
assert.deepEqual(parsed.composition.summary, { errors: 0, warnings: 0 });
assert.equal(parsed.composition.metrics.containerBorderRuns, 0);
diff --git a/archify/test/gallery.test.mjs b/archify/test/gallery.test.mjs
index 9694d5b4..4bf295f3 100644
--- a/archify/test/gallery.test.mjs
+++ b/archify/test/gallery.test.mjs
@@ -27,14 +27,14 @@ test('generated proof gallery matches its sources, receipts, and checked-in arti
path.join(repoRoot, 'scripts', 'build-gallery.mjs'),
generatedRoot,
], { encoding: 'utf8' });
- assert.match(output, /gallery 11 artifacts \/ 88 checks/);
+ assert.match(output, /gallery 11 artifacts \/ 99 checks/);
const manifestPath = path.join(generatedRoot, 'gallery', 'manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
assert.equal(manifest.schemaVersion, 1);
assert.equal(manifest.archifyVersion, JSON.parse(fs.readFileSync(path.join(skillRoot, 'package.json'))).version);
assert.equal(manifest.entryCount, 11);
- assert.equal(manifest.checkCount, 88);
+ assert.equal(manifest.checkCount, 99);
assert.deepEqual(new Set(manifest.entries.map((entry) => entry.type)), new Set([
'architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle',
]));
@@ -63,13 +63,14 @@ test('generated proof gallery matches its sources, receipts, and checked-in arti
assert.ok(fs.existsSync(source), `${entry.id}: source missing`);
assert.equal(sha256(artifact), entry.artifactSha256, `${entry.id}: artifact digest drift`);
assert.equal(sha256(source), entry.sourceSha256, `${entry.id}: source digest drift`);
- assert.equal(entry.checks.length, 8);
+ assert.equal(entry.checks.length, 9);
assert.ok(entry.checks.every((check) => check.ok), `${entry.id}: validation receipt not green`);
assert.equal(entry.composition.profile, 'showcase', `${entry.id}: expected showcase composition profile`);
assert.equal(entry.composition.status, 'pass', `${entry.id}: showcase composition is not green`);
assert.equal(entry.composition.metrics.properCrossings, 0, `${entry.id}: proper crossing debt remains`);
assert.equal(entry.composition.metrics.ambiguousCorridors, 0, `${entry.id}: ambiguous corridor debt remains`);
assert.equal(entry.composition.metrics.containerBorderRuns, 0, `${entry.id}: container border-run debt remains`);
+ assert.equal(entry.composition.metrics.labelRouteClearanceIssues, 0, `${entry.id}: label-route clearance debt remains`);
assert.equal(entry.composition.metrics.shortInteriorSegmentCount, 0, `${entry.id}: cramped interior turn remains`);
assert.equal(entry.composition.metrics.microSegmentCount, 0, `${entry.id}: micro segment remains`);
assert.equal(entry.viewCount, 3, `${entry.id}: expected a three-step reader story`);
diff --git a/archify/test/geometry.test.mjs b/archify/test/geometry.test.mjs
index bab3b53c..4cc0be15 100644
--- a/archify/test/geometry.test.mjs
+++ b/archify/test/geometry.test.mjs
@@ -10,6 +10,9 @@ import assert from 'node:assert/strict';
import {
rectsOverlap,
segmentIntersectsRect,
+ segmentRectClearance,
+ segmentRectIntersectionLength,
+ collectLabelRouteClearance,
cleanFlowProblems,
cleanCrossingProblems,
collectAmbiguousCorridors,
@@ -66,6 +69,52 @@ test('segmentIntersectsRect: detects an edge crossing a node box', () => {
assert.equal(segmentIntersectsRect({ start: [0, 20], end: [20, 20] }, rect(8, 0, 4, 10)), false);
});
+test('segmentRectClearance measures horizontal, vertical, and reversed diagonal segments', () => {
+ const box = rect(10, 10, 10, 10);
+ assert.equal(segmentRectClearance({ start: [0, 6], end: [30, 6] }, box), 4);
+ assert.equal(segmentRectClearance({ start: [6, 0], end: [6, 30] }, box), 4);
+ assert.equal(segmentRectClearance({ start: [0, 0], end: [8, 8] }, box), Math.sqrt(8));
+ assert.equal(segmentRectClearance({ start: [8, 8], end: [0, 0] }, box), Math.sqrt(8));
+ assert.equal(segmentRectClearance({ start: [0, 15], end: [30, 15] }, box), 0);
+});
+
+test('label-route clearance locks tangent, sub-threshold, boundary, and reversed coordinates', () => {
+ const box = rect(10, 10, 10, 10);
+ const cases = [
+ { segment: { start: [0, 10], end: [30, 10] }, clearance: 0, intersection: 10 },
+ { segment: { start: [10, 0], end: [10, 30] }, clearance: 0, intersection: 10 },
+ { segment: { start: [0, 0], end: [30, 30] }, clearance: 0, intersection: Math.sqrt(200) },
+ { segment: { start: [0, 0], end: [10, 10] }, clearance: 0, intersection: 0 },
+ { segment: { start: [0, 8.1], end: [30, 8.1] }, clearance: 1.9, intersection: 0 },
+ { segment: { start: [0, 8], end: [30, 8] }, clearance: 2, intersection: 0 },
+ { segment: { start: [0, 6.1], end: [30, 6.1] }, clearance: 3.9, intersection: 0 },
+ { segment: { start: [0, 6], end: [30, 6] }, clearance: 4, intersection: 0 },
+ { segment: { start: [0, 0], end: [5, 0] }, clearance: Math.sqrt(125), intersection: 0 },
+ ];
+ for (const { segment, clearance, intersection } of cases) {
+ assert.ok(Math.abs(segmentRectClearance(segment, box) - clearance) < 0.000001);
+ assert.ok(Math.abs(segmentRectIntersectionLength(segment, box) - intersection) < 0.000001);
+ const reversed = { start: segment.end, end: segment.start };
+ assert.ok(Math.abs(segmentRectClearance(reversed, box) - clearance) < 0.000001);
+ assert.ok(Math.abs(segmentRectIntersectionLength(reversed, box) - intersection) < 0.000001);
+ }
+});
+
+test('collectLabelRouteClearance exempts only the owning relationship at an exact threshold', () => {
+ const owner = { id: 'owner', from: 'a', to: 'b' };
+ const sharedSource = { id: 'other', from: 'a', to: 'c' };
+ const labels = [{ relation: owner, relationIndex: 0, label: 'handoff', ...rect(80, 48, 60, 14) }];
+ const routedRelations = [
+ { relation: owner, relationIndex: 0, points: [[20, 60], [200, 60]] },
+ { relation: sharedSource, relationIndex: 1, points: [[70, 64], [150, 64]] },
+ ];
+ assert.deepEqual(collectLabelRouteClearance({ labels, routedRelations, threshold: 2 }), []);
+ const hits = collectLabelRouteClearance({ labels, routedRelations, threshold: 4 });
+ assert.equal(hits.length, 1);
+ assert.equal(hits[0].clearance, 2);
+ assert.equal(hits[0].otherRelation, sharedSource);
+});
+
test('cleanFlowProblems reports collection index, ids, segment, clearance, and fix', () => {
const relations = [{ id: 'checkout', from: 'client', to: 'database' }];
const obstacles = [
diff --git a/archify/test/layout-rules.test.mjs b/archify/test/layout-rules.test.mjs
index 92a3d1fa..81a538c2 100644
--- a/archify/test/layout-rules.test.mjs
+++ b/archify/test/layout-rules.test.mjs
@@ -209,6 +209,77 @@ test('architecture: Clean Flow Gate rejects a connection through a component', (
assert.match(stderr, /segment 0 .*2px clearance/);
});
+test('dataflow: showcase rejects a relationship label that hides another route', () => {
+ const d = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', 'event-stream.dataflow.json'), 'utf8'));
+ const approvedReplay = d.flows.find((flow) => flow.label === 'approved replay');
+ delete approvedReplay.labelAt;
+ delete approvedReplay.labelDx;
+ delete approvedReplay.labelDy;
+ delete approvedReplay.labelSegment;
+ const { code, stderr } = render('dataflow', d);
+ assert.notEqual(code, 0, `expected non-zero exit; stderr:\n${stderr}`);
+ assert.match(stderr, /\[composition\/label-route-clearance\] showcase dataflow/);
+ assert.match(stderr, /approved replay.*failure sample/);
+ assert.match(stderr, /labelAt.*labelDx.*labelDy.*labelSegment/);
+});
+
+test('dataflow: validator and SVG share the 27px CJK/emoji classification mask', () => {
+ const d = load('dataflow');
+ const flow = d.flows[0];
+ flow.label = '写入🚀';
+ flow.classification = '机密🔐';
+ const { code, stderr, outPath } = render('dataflow', d);
+ assert.equal(code, 0, stderr);
+ const html = fs.readFileSync(outPath, 'utf8');
+ const group = html.match(/<g data-detail="context"[^>]*data-edge-id="web-clickstream"[^>]*>[\s\S]*?<\/g>/)?.[0] || '';
+ assert.match(group, /data-edge-label="写入🚀"/);
+ assert.match(group, /<rect x="[^\"]+" y="[^\"]+" width="41\.4" height="27" rx="4" class="c-mask"\/>/);
+ assert.match(group, />机密🔐<\/text>/);
+});
+
+test('architecture: showcase rejects a connection label that hides another route', () => {
+ const d = load('architecture');
+ d.connections[0].labelAt = [620, 330];
+ const { code, stderr } = render('architecture', d);
+ assert.notEqual(code, 0, `expected non-zero exit; stderr:\n${stderr}`);
+ assert.match(stderr, /\[composition\/label-route-clearance\] showcase architecture/);
+ assert.match(stderr, /HTTPS.*lb-to-api/);
+});
+
+test('workflow: showcase rejects an edge label that hides another route', () => {
+ const d = load('workflow');
+ d.edges.find((edge) => edge.id === 'plan-request').labelAt = [562, 491];
+ const { code, stderr } = render('workflow', d);
+ assert.notEqual(code, 0, `expected non-zero exit; stderr:\n${stderr}`);
+ assert.match(stderr, /\[composition\/label-route-clearance\] showcase workflow/);
+ assert.match(stderr, /plan.*retry-request/);
+});
+
+test('lifecycle: showcase rejects a transition label that hides another route', () => {
+ const d = load('lifecycle');
+ d.transitions[0].label = 'approval gate';
+ d.transitions[0].labelAt = [556, 250];
+ const { code, stderr } = render('lifecycle', d);
+ assert.notEqual(code, 0, `expected non-zero exit; stderr:\n${stderr}`);
+ assert.match(stderr, /\[composition\/label-route-clearance\] showcase lifecycle/);
+ assert.match(stderr, /approval gate.*review-blocked/);
+});
+
+test('sequence: showcase rejects a message label that hides an adjacent route', () => {
+ const d = load('sequence');
+ d.messages = d.messages.slice(0, 2);
+ d.messages[0].label = 'customer authorization context';
+ d.messages[0].y = 250;
+ d.messages[1].label = 'ok';
+ d.messages[1].y = 245;
+ d.segments = [];
+ d.activations = [];
+ const { code, stderr } = render('sequence', d);
+ assert.notEqual(code, 0, `expected non-zero exit; stderr:\n${stderr}`);
+ assert.match(stderr, /\[composition\/label-route-clearance\] showcase sequence/);
+ assert.match(stderr, /customer authorization context.*dashboard-request/);
+});
+
function autoRoutePassThroughDocument(connection) {
return {
schema_version: 1,
diff --git a/archify/test/render-output-checks.test.mjs b/archify/test/render-output-checks.test.mjs
index bdaf2b5c..e3fd2c60 100644
--- a/archify/test/render-output-checks.test.mjs
+++ b/archify/test/render-output-checks.test.mjs
@@ -110,6 +110,126 @@ test('render output check: shared endpoints and endpoint touches pass showcase',
assert.equal(result.composition.metrics.ambiguousCorridors, 0);
});
+test('render output check: relationship labels cannot hide another shared-source route', () => {
+ for (const profile of ['standard', 'showcase']) {
+ const { code, result } = checkHtml(`label-route-${profile}`, `
+ <path data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-composition-points="20,60;200,60" d="M 20 60 L 200 60" class="a-default" marker-end="url(#arrowhead)"/>
+ <path data-edge-key="1" data-edge-id="sample" data-edge-from="dlq" data-edge-to="ops" data-composition-points="70,55;150,55" d="M 70 55 L 150 55" class="a-dashed" marker-end="url(#arrowhead-dashed)"/>
+ <g data-detail="context" data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-edge-label="approved replay">
+ <rect x="80" y="48" width="60" height="14" rx="3" class="c-mask"/>
+ <text x="110" y="58">approved replay</text>
+ </g>
+ `, profile);
+
+ assert.equal(result.composition.metrics.labelRouteClearanceIssues, 1);
+ assert.equal(result.composition.metrics.minLabelRouteClearance, 0);
+ const issue = result.composition.issues.find((item) => item.code === 'composition/label-route-clearance');
+ assert.deepEqual(issue.labelRelationship, { id: 'approved', from: 'dlq', to: 'replay', label: 'approved replay', collectionIndex: 0, artifactIndex: 1 });
+ assert.deepEqual(issue.otherRelationship, { id: 'sample', from: 'dlq', to: 'ops', label: '', collectionIndex: 1, artifactIndex: 2 });
+ assert.equal(issue.segmentIndex, 0);
+ assert.deepEqual(issue.labelRect, { x: 80, y: 48, width: 60, height: 14 });
+ assert.equal(issue.clearance, 0);
+ assert.equal(issue.intersectionLength, 60);
+ assert.equal(issue.threshold, profile === 'showcase' ? 4 : 2);
+ const check = result.checks.find((item) => item.name === 'label_route_clearance');
+ if (profile === 'standard') {
+ assert.equal(code, 0);
+ assert.equal(check.ok, true);
+ assert.equal(issue.severity, 'warning');
+ assert.deepEqual(result.composition.summary, { errors: 0, warnings: 1 });
+ } else {
+ assert.notEqual(code, 0);
+ assert.equal(check.ok, false);
+ assert.match(check.details[0], /approved.*sample/);
+ assert.match(check.details[0], /labelAt.*labelDx.*labelDy.*labelSegment/);
+ assert.equal(issue.severity, 'error');
+ assert.deepEqual(result.composition.summary, { errors: 1, warnings: 0 });
+ }
+ }
+});
+
+test('render output check: repeated endpoint messages keep their own stable owner identity', () => {
+ const { code, result } = checkHtml('sequence-repeated-endpoints', `
+ <g data-edge-key="0" data-edge-from="client" data-edge-to="api" data-edge-label="first request">
+ <path data-composition-edge-from="client" data-composition-edge-to="api" data-composition-points="20,20;200,20" d="M 20 20 L 200 20" class="a-default" marker-end="url(#arrowhead)"/>
+ <g data-detail="context"><rect x="70" y="2" width="80" height="16" class="c-mask"/></g>
+ </g>
+ <g data-edge-key="1" data-edge-from="client" data-edge-to="api" data-edge-label="second request">
+ <path data-composition-edge-from="client" data-composition-edge-to="api" data-composition-points="20,60;200,60" d="M 20 60 L 200 60" class="a-default" marker-end="url(#arrowhead)"/>
+ <g data-detail="context"><rect x="70" y="72" width="80" height="16" class="c-mask"/></g>
+ </g>
+ <path data-edge-key="2" data-edge-from="worker" data-edge-to="store" data-composition-points="20,80;200,80" d="M 20 80 L 200 80" class="a-dashed" marker-end="url(#arrowhead-dashed)"/>
+ `, 'showcase');
+ assert.notEqual(code, 0);
+ const issues = result.composition.issues.filter((item) => item.code === 'composition/label-route-clearance');
+ assert.equal(issues.length, 1);
+ assert.equal(issues[0].label, 'second request');
+ assert.equal(issues[0].labelRelationship.collectionIndex, 1);
+ assert.equal(issues[0].otherRelationship.collectionIndex, 2);
+});
+
+test('render output check: duplicate fragments of the owning relationship stay exempt', () => {
+ const { code, result } = checkHtml('label-owner-fragments', `
+ <path data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-composition-points="20,60;200,60" d="M 20 60 L 200 60" class="a-default" marker-end="url(#arrowhead)"/>
+ <path data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-composition-points="20,60;200,60" d="M 20 60 L 200 60" class="a-default" marker-end="url(#arrowhead)"/>
+ <g data-detail="context" data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-edge-label="approved replay">
+ <rect x="80" y="48" width="60" height="14" rx="3" class="c-mask"/>
+ <text x="110" y="58">approved replay</text>
+ </g>
+ `, 'showcase');
+ assert.equal(code, 0);
+ assert.equal(result.composition.metrics.labelRouteClearanceIssues, 0);
+ assert.equal(result.composition.metrics.minLabelRouteClearance, null);
+});
+
+test('render output check: duplicate fragments of another relationship count once', () => {
+ const { result } = checkHtml('label-other-fragments', `
+ <path data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-composition-points="20,60;200,60" d="M 20 60 L 200 60" class="a-default" marker-end="url(#arrowhead)"/>
+ <path data-edge-key="1" data-edge-id="sample" data-edge-from="dlq" data-edge-to="ops" data-composition-points="70,55;150,55" d="M 70 55 L 150 55" class="a-dashed" marker-end="url(#arrowhead-dashed)"/>
+ <path data-edge-key="1" data-edge-id="sample" data-edge-from="dlq" data-edge-to="ops" data-composition-points="70,55;150,55" d="M 70 55 L 150 55" class="a-dashed" marker-end="url(#arrowhead-dashed)"/>
+ <g data-detail="context" data-edge-key="0" data-edge-id="approved" data-edge-from="dlq" data-edge-to="replay" data-edge-label="approved replay">
+ <rect x="80" y="48" width="60" height="14" rx="3" class="c-mask"/>
+ <text x="110" y="58">approved replay</text>
+ </g>
+ `, 'showcase');
+ assert.equal(result.composition.metrics.labelRouteClearanceIssues, 1);
+});
+
+test('render output check: label-route thresholds include exact 2px and 4px boundaries', () => {
+ const body = (otherY) => `
+ <path data-edge-key="0" data-edge-from="a" data-edge-to="b" data-composition-points="20,70;200,70" d="M 20 70 L 200 70" class="a-default" marker-end="url(#arrowhead)"/>
+ <path data-edge-key="1" data-edge-from="c" data-edge-to="d" data-composition-points="70,${otherY};150,${otherY}" d="M 70 ${otherY} L 150 ${otherY}" class="a-dashed" marker-end="url(#arrowhead-dashed)"/>
+ <g data-detail="context" data-edge-key="0" data-edge-from="a" data-edge-to="b" data-edge-label="handoff">
+ <rect x="80" y="48" width="60" height="14" rx="3" class="c-mask"/>
+ <text x="110" y="58">handoff</text>
+ </g>
+ `;
+ const standardAtTwo = checkHtml('label-standard-two', body(64), 'standard');
+ assert.equal(standardAtTwo.code, 0);
+ assert.equal(standardAtTwo.result.composition.metrics.labelRouteClearanceIssues, 0);
+ assert.equal(standardAtTwo.result.composition.metrics.minLabelRouteClearance, 2);
+
+ const standardBelowTwo = checkHtml('label-standard-one-nine', body(63.9), 'standard');
+ assert.equal(standardBelowTwo.code, 0);
+ assert.equal(standardBelowTwo.result.composition.metrics.labelRouteClearanceIssues, 1);
+ assert.equal(standardBelowTwo.result.composition.summary.warnings, 1);
+
+ const showcaseAtTwo = checkHtml('label-showcase-two', body(64), 'showcase');
+ assert.notEqual(showcaseAtTwo.code, 0);
+ assert.equal(showcaseAtTwo.result.composition.metrics.labelRouteClearanceIssues, 1);
+ assert.equal(showcaseAtTwo.result.composition.issues.find((item) => item.code === 'composition/label-route-clearance').threshold, 4);
+
+ const showcaseAtFour = checkHtml('label-showcase-four', body(66), 'showcase');
+ assert.equal(showcaseAtFour.code, 0);
+ assert.equal(showcaseAtFour.result.composition.metrics.labelRouteClearanceIssues, 0);
+ assert.equal(showcaseAtFour.result.composition.metrics.minLabelRouteClearance, 4);
+
+ const showcaseBelowFour = checkHtml('label-showcase-three-nine', body(65.9), 'showcase');
+ assert.notEqual(showcaseBelowFour.code, 0);
+ assert.equal(showcaseBelowFour.result.composition.metrics.labelRouteClearanceIssues, 1);
+ assert.equal(showcaseBelowFour.result.composition.summary.errors, 1);
+});
+
test('render output check: unrelated shared corridors warn in standard and fail showcase', () => {
for (const profile of ['standard', 'showcase']) {
const { code, result } = checkHtml(`corridor-${profile}`, `
diff --git a/docs/gallery.html b/docs/gallery.html
index 7c93b6ef..9e284c86 100644
--- a/docs/gallery.html
+++ b/docs/gallery.html
@@ -278,7 +278,7 @@
</div>
<div class="proof-board" aria-label="Gallery quality summary">
<div class="proof-row"><span class="proof-value">11</span><span class="proof-label" data-en="scenario proofs<br>from real IR" data-zh="个场景成品<br>来自真实 IR">scenario proofs<br>from real IR</span></div>
- <div class="proof-row"><span class="proof-value">88</span><span class="proof-label" data-en="structural checks<br>passed" data-zh="项结构检查<br>全部通过">structural checks<br>passed</span></div>
+ <div class="proof-row"><span class="proof-value">99</span><span class="proof-label" data-en="structural checks<br>passed" data-zh="项结构检查<br>全部通过">structural checks<br>passed</span></div>
<div class="proof-row"><span class="proof-value proof-status">PASS</span><span class="proof-label" data-en="generated from<br>source of truth" data-zh="从源数据<br>自动生成">generated from<br>source of truth</span></div>
</div>
</div>
@@ -321,7 +321,7 @@
<div class="card-body">
<p class="card-description" data-en="A policy-aware agent loop with planning, approval, tool execution, exception handling, and observability lanes." data-zh="包含规划、审批、工具执行、异常处理与可观测泳道的策略感知智能体闭环。">A policy-aware agent loop with planning, approval, tool execution, exception handling, and observability lanes.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 11E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="194692a1cbc60fdc69862e3cf68facd67472f5cce317b0b473c1c78f2a16330b">194692a1cbc6</span></div>
@@ -349,7 +349,7 @@
<div class="card-body">
<p class="card-description" data-en="Regions, private networks, workload owners, state, cross-region replication, audit evidence, and named boundary crossings." data-zh="展示区域、私有网络、工作负载归属、状态、跨区复制、审计证据和明确的边界穿越。">Regions, private networks, workload owners, state, cross-region replication, audit evidence, and named boundary crossings.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7827b34ca8cee86c4448dd8738c55a60f56640ff12d8217d9d1c45afff4468a0">7827b34ca8ce</span></div>
@@ -377,7 +377,7 @@
<div class="card-body">
<p class="card-description" data-en="A time-ordered request path covering authentication, cache fallback, persistence, return traffic, and async tracing." data-zh="按时间展开鉴权、缓存回退、持久化、返回流量与异步追踪。">A time-ordered request path covering authentication, cache fallback, persistence, return traffic, and async tracing.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 12E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="a695f636f38a595ed8b3e76942bc07cbea6455ae4b066b005131645ed0c482dc">a695f636f38a</span></div>
@@ -405,7 +405,7 @@
<div class="card-body">
<p class="card-description" data-en="A change moves through reproducible build, blocking gates, human approval, canary verification, communication, and rollback." data-zh="一次变更依次经过可复现构建、阻断检查、人工审批、金丝雀验证、沟通和回滚。">A change moves through reproducible build, blocking gates, human approval, canary verification, communication, and rollback.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="5cf4cd7ebaa73d42ec6dac441234736f111f75a29f3de077ffe956cd0aa71791">5cf4cd7ebaa7</span></div>
@@ -433,7 +433,7 @@
<div class="card-body">
<p class="card-description" data-en="Detection, incident command, mitigation, stakeholder communication, escalation, rollback, and recovery evidence." data-zh="覆盖发现、事故指挥、缓解、干系人沟通、升级、回滚和恢复证据。">Detection, incident command, mitigation, stakeholder communication, escalation, rollback, and recovery evidence.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 10E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="5bdb76d9cacbda597f50f466601983d635da5ac9168f25f91df110a81ec67237">5bdb76d9cacb</span></div>
@@ -461,7 +461,7 @@
<div class="card-body">
<p class="card-description" data-en="Events move through consent, streaming, PII isolation, warehouse sync, and governed downstream consumers." data-zh="事件依次经过用户同意、流处理、PII 隔离、数仓同步和受治理的下游消费者。">Events move through consent, streaming, PII isolation, warehouse sync, and governed downstream consumers.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 10E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="c29e59f0b5516a49bb3c5e146d202b30c565990c61c76df1387cf777d67d2f80">c29e59f0b551</span></div>
@@ -489,7 +489,7 @@
<div class="card-body">
<p class="card-description" data-en="A fast acknowledgement leads into durable queueing, background work, retry, final-state storage, webhook, and polling fallback." data-zh="快速确认后进入持久队列、后台处理、重试、终态存储、Webhook 和轮询回退。">A fast acknowledgement leads into durable queueing, background work, retry, final-state storage, webhook, and polling fallback.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 14E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="3fcefeff29ac56a83b3a1574ba58b70da8be3dbfaea0eb0d565ef24930ec95c0">3fcefeff29ac</span></div>
@@ -517,10 +517,10 @@
<div class="card-body">
<p class="card-description" data-en="Named producers, partitioned topics, consumer groups, idempotent state, dead letters, operator ownership, and controlled replay." data-zh="展示命名生产者、分区 Topic、消费者组、幂等状态、死信、负责人和受控重放。">Named producers, partitioned topics, consumer groups, idempotent state, dead letters, operator ownership, and controlled replay.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">12N · 12E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="66161b977dbcd51c0c6468bbffb7d8b59f78831330a3257433255e784594eb7b">66161b977dbc</span></div>
+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="c5d4c203813461384f8151ed15b7331bafbd7f1c287a7345ffaeafba955314cb">c5d4c2038134</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/event-stream.dataflow.html?present=1&amp;play=1#view=order-transit" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@ -545,7 +545,7 @@
<div class="card-body">
<p class="card-description" data-en="Planning, execution, review, human approval, retry, cancellation, and terminal outcomes in one state model." data-zh="用一套状态模型表达规划、执行、复核、人工审批、重试、取消和终态。">Planning, execution, review, human approval, retry, cancellation, and terminal outcomes in one state model.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 5E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7b169efec1693b1885a88b384934ad46b91d649d2d99b98787c5c17b8696ff94">7b169efec169</span></div>
@@ -573,7 +573,7 @@
<div class="card-body">
<p class="card-description" data-en="The deployment object moves through build, verification, approval, promotion, health pause, rollback, and explicit terminal outcomes." data-zh="部署对象经过构建、验证、审批、晋级、健康暂停、回滚和明确终态。">The deployment object moves through build, verification, approval, promotion, health pause, rollback, and explicit terminal outcomes.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">11N · 6E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="11c330d90bb690c4b94fd678e7d81fd0737ea0491c5ef290617426fb496919ea">11c330d90bb6</span></div>
@@ -601,7 +601,7 @@
<div class="card-body">
<p class="card-description" data-en="A classic AWS web stack with edge delivery, authentication, API services, cache, persistence, and background work." data-zh="经典 AWS Web 栈:边缘分发、鉴权、API 服务、缓存、持久化与后台任务。">A classic AWS web stack with edge delivery, authentication, API services, cache, persistence, and background work.</p>
<div class="receipt" aria-label="Validation receipt">
- <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">8/8 pass</span></div>
+ <div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">10N · 9E</span></div>
<div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="5b8368b97a3941f483ee41ad0cf96b37157a11c9b7a9e870d9ba3c249dae8092">5b8368b97a39</span></div>
@@ -640,7 +640,7 @@ render dataflow ✓
render lifecycle ✓
render architecture ✓
-receipt 88 checks / 11 artifacts / deterministic hashes</pre>
+receipt 99 checks / 11 artifacts / deterministic hashes</pre>
</div>
</div>
</section>
@@ -658,7 +658,7 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"generator": "scripts/build-gallery.mjs",
"archifyVersion": "2.11.0",
"entryCount": 11,
- "checkCount": 88,
+ "checkCount": 99,
"entries": [
{
"id": "agent-tool-call",
@@ -698,6 +698,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -731,6 +735,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 52.1,
"maxBends": 2,
"routesOverSuggestedBends": 0,
"maxStretch": 1.257,
@@ -789,6 +795,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -822,6 +832,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 36,
"maxBends": 2,
"routesOverSuggestedBends": 0,
"maxStretch": 1.098,
@@ -880,6 +892,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -913,6 +929,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 15,
"maxBends": 0,
"routesOverSuggestedBends": 0,
"maxStretch": 1,
@@ -971,6 +989,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1004,6 +1026,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 36.3,
"maxBends": 2,
"routesOverSuggestedBends": 0,
"maxStretch": 1.214,
@@ -1062,6 +1086,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1095,6 +1123,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 119,
"maxBends": 3,
"routesOverSuggestedBends": 1,
"maxStretch": 3.465,
@@ -1153,6 +1183,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1186,6 +1220,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 57,
"maxBends": 3,
"routesOverSuggestedBends": 2,
"maxStretch": 1.369,
@@ -1244,6 +1280,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1277,6 +1317,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 22,
"maxBends": 0,
"routesOverSuggestedBends": 0,
"maxStretch": 1,
@@ -1318,10 +1360,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"animation": "trace",
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 541323,
- "artifactSha256": "66161b977dbcd51c0c6468bbffb7d8b59f78831330a3257433255e784594eb7b",
- "sourceBytes": 5528,
- "sourceSha256": "6541e9d00ea1efc38e4afc9c1cb4bbbea6e4468781e64da43ad9787cd6d51efc",
+ "artifactBytes": 541271,
+ "artifactSha256": "c5d4c203813461384f8151ed15b7331bafbd7f1c287a7345ffaeafba955314cb",
+ "sourceBytes": 5543,
+ "sourceSha256": "bbfedc2f1b73bf50932490f7f56d45d5f853e970d2fab26660a04947a783969c",
"checks": [
{
"name": "single_svg",
@@ -1335,6 +1377,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1368,6 +1414,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 9,
"maxBends": 4,
"routesOverSuggestedBends": 1,
"maxStretch": 2.663,
@@ -1426,6 +1474,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1459,6 +1511,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": null,
"maxBends": 3,
"routesOverSuggestedBends": 1,
"maxStretch": 2.368,
@@ -1517,6 +1571,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1550,6 +1608,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": null,
"maxBends": 0,
"routesOverSuggestedBends": 0,
"maxStretch": 1,
@@ -1608,6 +1668,10 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -1641,6 +1705,8 @@ receipt 88 checks / 11 artifacts / deterministic hashes</pre>
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 20,
"maxBends": 3,
"routesOverSuggestedBends": 1,
"maxStretch": 1,
diff --git a/docs/gallery/artifacts/event-stream.dataflow.html b/docs/gallery/artifacts/event-stream.dataflow.html
index 6b568c0b..04194edf 100644
--- a/docs/gallery/artifacts/event-stream.dataflow.html
+++ b/docs/gallery/artifacts/event-stream.dataflow.html
@@ -4083,7 +4083,7 @@
<text data-detail="fine" x="207.5" y="386" class="t-dim" font-size="7" text-anchor="middle">schema v2</text>
</g>
<g data-detail="context" data-edge-from="orders" data-edge-to="validate" data-edge-label="ordered orders" data-edge-key="2">
- <rect x="382.2" y="136" width="80.60000000000001" height="27" rx="4" class="c-mask"/>
+ <rect x="382.2" y="136" width="80.6" height="27" rx="4" class="c-mask"/>
<text x="422.5" y="147" class="t-backend" font-size="8" text-anchor="middle">ordered orders</text>
<text data-detail="fine" x="422.5" y="158" class="t-dim" font-size="7" text-anchor="middle">consumer group</text>
</g>
@@ -4103,7 +4103,7 @@
<text data-detail="fine" x="630" y="329" class="t-dim" font-size="7" text-anchor="middle">idempotent</text>
</g>
<g data-detail="context" data-edge-from="state" data-edge-to="fulfillment" data-edge-label="ready orders" data-edge-key="6">
- <rect x="809.6" y="193" width="70.80000000000001" height="27" rx="4" class="c-mask"/>
+ <rect x="809.6" y="193" width="70.8" height="27" rx="4" class="c-mask"/>
<text x="845" y="204" class="t-backend" font-size="8" text-anchor="middle">ready orders</text>
<text data-detail="fine" x="845" y="215" class="t-dim" font-size="7" text-anchor="middle">read model</text>
</g>
@@ -4118,19 +4118,19 @@
<text data-detail="fine" x="300" y="561" class="t-dim" font-size="7" text-anchor="middle">dead letter</text>
</g>
<g data-detail="context" data-edge-from="enrich" data-edge-to="dlq" data-edge-label="poison event" data-edge-key="9">
- <rect x="602.1" y="677" width="70.80000000000001" height="27" rx="4" class="c-mask"/>
+ <rect x="602.1" y="677" width="70.8" height="27" rx="4" class="c-mask"/>
<text x="637.5" y="688" class="t-security" font-size="8" text-anchor="middle">poison event</text>
<text data-detail="fine" x="637.5" y="699" class="t-dim" font-size="7" text-anchor="middle">dead letter</text>
</g>
<g data-detail="context" data-edge-from="dlq" data-edge-to="ops" data-edge-label="failure sample" data-edge-key="10">
- <rect x="804.7" y="526" width="80.60000000000001" height="27" rx="4" class="c-mask"/>
+ <rect x="804.7" y="526" width="80.6" height="27" rx="4" class="c-mask"/>
<text x="845" y="537" class="t-security" font-size="8" text-anchor="middle">failure sample</text>
<text data-detail="fine" x="845" y="548" class="t-dim" font-size="7" text-anchor="middle">restricted</text>
</g>
<g data-detail="context" data-edge-from="dlq" data-edge-to="replay" data-edge-label="approved replay" data-edge-key="11">
- <rect x="809.75" y="592" width="85.5" height="27" rx="4" class="c-mask"/>
- <text x="852.5" y="603" class="t-messagebus" font-size="8" text-anchor="middle">approved replay</text>
- <text data-detail="fine" x="852.5" y="614" class="t-dim" font-size="7" text-anchor="middle">audited batch</text>
+ <rect x="809.75" y="622" width="85.5" height="27" rx="4" class="c-mask"/>
+ <text x="852.5" y="633" class="t-messagebus" font-size="8" text-anchor="middle">approved replay</text>
+ <text data-detail="fine" x="852.5" y="644" class="t-dim" font-size="7" text-anchor="middle">audited batch</text>
</g>
<!-- Legend -->
diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.json
index 307b87c0..9a88298e 100644
--- a/docs/gallery/manifest.json
+++ b/docs/gallery/manifest.json
@@ -3,7 +3,7 @@
"generator": "scripts/build-gallery.mjs",
"archifyVersion": "2.11.0",
"entryCount": 11,
- "checkCount": 88,
+ "checkCount": 99,
"entries": [
{
"id": "agent-tool-call",
@@ -43,6 +43,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -76,6 +80,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 52.1,
"maxBends": 2,
"routesOverSuggestedBends": 0,
"maxStretch": 1.257,
@@ -134,6 +140,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -167,6 +177,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 36,
"maxBends": 2,
"routesOverSuggestedBends": 0,
"maxStretch": 1.098,
@@ -225,6 +237,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -258,6 +274,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 15,
"maxBends": 0,
"routesOverSuggestedBends": 0,
"maxStretch": 1,
@@ -316,6 +334,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -349,6 +371,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 36.3,
"maxBends": 2,
"routesOverSuggestedBends": 0,
"maxStretch": 1.214,
@@ -407,6 +431,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -440,6 +468,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 119,
"maxBends": 3,
"routesOverSuggestedBends": 1,
"maxStretch": 3.465,
@@ -498,6 +528,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -531,6 +565,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 57,
"maxBends": 3,
"routesOverSuggestedBends": 2,
"maxStretch": 1.369,
@@ -589,6 +625,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -622,6 +662,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 22,
"maxBends": 0,
"routesOverSuggestedBends": 0,
"maxStretch": 1,
@@ -663,10 +705,10 @@
"animation": "trace",
"nodeCount": 12,
"edgeCount": 12,
- "artifactBytes": 541323,
- "artifactSha256": "66161b977dbcd51c0c6468bbffb7d8b59f78831330a3257433255e784594eb7b",
- "sourceBytes": 5528,
- "sourceSha256": "6541e9d00ea1efc38e4afc9c1cb4bbbea6e4468781e64da43ad9787cd6d51efc",
+ "artifactBytes": 541271,
+ "artifactSha256": "c5d4c203813461384f8151ed15b7331bafbd7f1c287a7345ffaeafba955314cb",
+ "sourceBytes": 5543,
+ "sourceSha256": "bbfedc2f1b73bf50932490f7f56d45d5f853e970d2fab26660a04947a783969c",
"checks": [
{
"name": "single_svg",
@@ -680,6 +722,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -713,6 +759,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 9,
"maxBends": 4,
"routesOverSuggestedBends": 1,
"maxStretch": 2.663,
@@ -771,6 +819,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -804,6 +856,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": null,
"maxBends": 3,
"routesOverSuggestedBends": 1,
"maxStretch": 2.368,
@@ -862,6 +916,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -895,6 +953,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": null,
"maxBends": 0,
"routesOverSuggestedBends": 0,
"maxStretch": 1,
@@ -953,6 +1013,10 @@
"name": "orthogonal_arrows",
"ok": true
},
+ {
+ "name": "label_route_clearance",
+ "ok": true
+ },
{
"name": "relationship_crossings",
"ok": true
@@ -986,6 +1050,8 @@
"properCrossings": 0,
"ambiguousCorridors": 0,
"containerBorderRuns": 0,
+ "labelRouteClearanceIssues": 0,
+ "minLabelRouteClearance": 20,
"maxBends": 3,
"routesOverSuggestedBends": 1,
"maxStretch": 1,
diff --git a/docs/gallery/sources/event-stream.dataflow.json b/docs/gallery/sources/event-stream.dataflow.json
index c6f428a7..9145f1e4 100644
--- a/docs/gallery/sources/event-stream.dataflow.json
+++ b/docs/gallery/sources/event-stream.dataflow.json
@@ -48,7 +48,7 @@
{ "from": "validate", "to": "dlq", "label": "invalid event", "classification": "dead letter", "variant": "security", "fromSide": "top", "toSide": "top", "via": [[530, 80], [20, 80], [20, 550], [745, 550]], "labelAt": [300, 550] },
{ "from": "enrich", "to": "dlq", "label": "poison event", "classification": "dead letter", "variant": "security", "route": "bottom-channel", "labelDy": 30 },
{ "from": "dlq", "to": "ops", "label": "failure sample", "classification": "restricted", "variant": "security", "route": "vertical-channel" },
- { "from": "dlq", "to": "replay", "label": "approved replay", "classification": "audited batch", "variant": "dashed", "route": "straight" }
+ { "from": "dlq", "to": "replay", "label": "approved replay", "classification": "audited batch", "variant": "dashed", "route": "straight", "labelDy": 30 }
],
"cards": [
{ "dot": "amber", "title": "Transit Contract", "items": ["Every event and topic is named", "Partition keys preserve per-order ordering", "Consumer groups expose processing ownership"] },