Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(architecture): report a component a boundary frame swallows without wrapping it
tt-a1i36236cdd4c4d
diff --git a/archify/references/authoring-contract.md b/archify/references/authoring-contract.mdindex 18743452..7fc5c22f 100644--- a/archify/references/authoring-contract.md+++ b/archify/references/authoring-contract.md@@ -283,7 +283,7 @@ After every edit, rerun the complete `finalize` as the delivery contract requireChoose overview or mechanism detail using [Composition and meaning](authoring-defaults.md#composition-and-meaning). Use one obvious primary reading path, which may step across meaningful rows when the requested topology needs room. Keep the overview readable at its chosen abstraction; expand implementation details when they answer the reader's question. Group only real ownership, trust, process, or deployment boundaries. Boundaries do not replace relationships.-Grid placement is preferred when the schema supports it. Free positions are appropriate for a bounded exception, not for prose-level coordinate planning. Keep external actors outside the system boundary when that is factually true.+Grid placement is preferred when the schema supports it. Free positions are appropriate for a bounded exception, not for prose-level coordinate planning. Keep external actors outside the system boundary when that is factually true. A boundary is drawn as the padded box around all of its members, so place them as one compact block and keep every non-member outside that box; `layout/boundary-encloses-non-member` reports a component the box swallows.### Workflowdiff --git a/archify/references/authoring-defaults.md b/archify/references/authoring-defaults.mdindex 90807c7a..38569943 100644--- a/archify/references/authoring-defaults.md+++ b/archify/references/authoring-defaults.md@@ -22,7 +22,7 @@ Place Architecture nodes by their actual connections before assigning coordinateBefore writing positions, trace each non-main relationship: its straight or one-bend corridor must not pass another node or cross another relationship. If it does, move the endpoint that is off the main path. Start the main actor and its first connected step together near the canvas origin; use content rows for vertical rhythm. Omit `meta.viewBox` for a fresh Architecture so the Reader measures intrinsic height. Keep supplied fixed geometry authoritative.-Start with automatic routes and endpoint sides. Pin a side only for a necessary branch, return, or supplied geometry. For a fresh Architecture, leave adjacent request/reply directions automatic when no required side constraint prevents parallel straight lines; preserve supplied side pins. Reserve `via`, `channelX`, `channelY`, and label coordinates for measured defects. Before writing positions, budget every labeled edge between side-by-side boxes, on the main path or not, at `6.5px × ASCII units + 21px` of clear gap, counting CJK as two units; use its own label length, not a row-wide fixed gap. Keep an Architecture canvas within 1240px wide, or 1790px when it is at least 1.55 times as wide as tall; past that its 8px relationship labels drop below the desktop floor. Size Architecture sublabels for their preferred 9px text at `5.4px × text units + 8px`, with CJK counting twice; keep supporting copy concise without dropping required facts. Do not trade readability or meaning for fewer crossings. The [Geometry reference](authoring-contract.md#executable-geometry-rules) has measured spacing, port, canvas, and route rules for a diagnosed layout problem.+Start with automatic routes and endpoint sides. Pin a side only for a necessary branch, return, or supplied geometry. For a fresh Architecture, leave adjacent request/reply directions automatic when no required side constraint prevents parallel straight lines; preserve supplied side pins. Reserve `via`, `channelX`, `channelY`, and label coordinates for measured defects. Before writing positions, budget every labeled edge between side-by-side boxes, on the main path or not, at `6.5px × ASCII units + 21px` of clear gap, counting CJK as two units; use its own label length, not a row-wide fixed gap. A boundary frame is the padded box around all of its members: place them as one compact block and keep every non-member, especially an external actor, outside that box. Keep an Architecture canvas within 1240px wide, or 1790px when it is at least 1.55 times as wide as tall; past that its 8px relationship labels drop below the desktop floor. Size Architecture sublabels for their preferred 9px text at `5.4px × text units + 8px`, with CJK counting twice; keep supporting copy concise without dropping required facts. Do not trade readability or meaning for fewer crossings. The [Geometry reference](authoring-contract.md#executable-geometry-rules) has measured spacing, port, canvas, and route rules for a diagnosed layout problem.## Evidence and schemadiff --git a/archify/renderers/architecture/render-architecture.mjs b/archify/renderers/architecture/render-architecture.mjsindex 6eb8437c..344bbb31 100644--- a/archify/renderers/architecture/render-architecture.mjs+++ b/archify/renderers/architecture/render-architecture.mjs@@ -657,6 +657,37 @@ function validateArchitecture() {}}+ // A boundary frame is drawn as the padded box around its members, so a+ // component that is not in `wraps` but sits wholly inside that box reads as+ // a member. Report it instead of letting the picture claim false ownership.+ // A box the frame border visibly cuts through does not claim membership,+ // and earlier valid inputs depend on that, so only full enclosure fails.+ if (enforcesBoundaryTitleComposition) {+ for (const b of boundaries) {+ const members = new Set(asArray(b.wraps));+ for (const component of components.values()) {+ if (members.has(component.id) || !rectContains(b, component)) continue;+ const message = `Component "${component.id}" is not wrapped by boundary "${b.label}" but sits inside its frame — `+ + 'move it outside the frame, place the wrapped members in one compact block, or add it to wraps only when it truly belongs there.';+ problems.push(message);+ diagnostics.push({+ code: 'layout/boundary-encloses-non-member',+ severity: 'error',+ message,+ subject: { diagramType: 'architecture', boundary: { kind: b.kind, label: b.label, wraps: b.wraps }, component: component.id },+ evidence: {+ bounds: { x: b.x, y: b.y, width: b.width, height: b.height },+ component: componentBox(component),+ },+ supportedFixes: [+ `move "${component.id}" outside the boundary frame`,+ 'reposition the wrapped members into one compact block that leaves non-members outside',+ ],+ });+ }+ }+ }+const connectionList = asArray(arch.connections);const knownComponentIds = [...components.keys()].sort();for (const conn of connectionList) {diff --git a/test/architecture-first-draft.test.mjs b/test/architecture-first-draft.test.mjsindex 0eee6516..7ea9c74b 100644--- a/test/architecture-first-draft.test.mjs+++ b/test/architecture-first-draft.test.mjs@@ -92,6 +92,7 @@ function assertOnlyLabelDefects(receipt) {for (const issue of receipt.diagnostics) {assert.ok(issue.code === 'composition/label-gap'|| issue.code === 'composition/label-route-clearance'+ || issue.code === 'layout/boundary-encloses-non-member'|| /^Label ".*" overlaps component /.test(issue.message), JSON.stringify(issue));}}@@ -161,3 +162,17 @@ test('workflow: every overlapping node pair of a first draft is reported in oneassert.ok(pairs.includes('test_join>staging_deploy'));assert.ok(pairs.includes('metric_gate>rollback_stable'));});++// The same study's queue draft placed the tenant auth component, which only the+// integration boundary wraps, inside the gateway-process frame as well. The+// picture claimed a membership the source never stated.+test('architecture: a component inside a boundary frame it is not wrapped by is reported', () => {+ const { status, receipt } = validate('architecture', path.join(fixtures, 'queue-sol.architecture.json'));+ assert.equal(status, 1);+ const issue = receipt.diagnostics.find((entry) => entry.code === 'layout/boundary-encloses-non-member');+ assert.ok(issue, JSON.stringify(receipt.diagnostics, null, 2));+ assert.equal(issue.subject.component, 'auth');+ assert.equal(issue.subject.boundary.label, 'Queue gateway process');+ const example = validate('architecture', path.join(skillRoot, 'examples', 'production-deployment.architecture.json'));+ assert.equal(example.status, 0, JSON.stringify(example.receipt?.diagnostics));+});diff --git a/test/layout-rules.test.mjs b/test/layout-rules.test.mjsindex dfeaf3c2..18052aca 100644--- a/test/layout-rules.test.mjs+++ b/test/layout-rules.test.mjs@@ -439,7 +439,9 @@ test('workflow: same-lane nodes the solver separated by its exact minimum keep ptest('architecture: ordinary boundaries may express orthogonal overlapping memberships', () => {const d = load('architecture');- d.boundaries[1].wraps.push('auth');+ // users sits outside the region and cdn inside it, so the frames overlap+ // without either one drawing a component it does not wrap.+ d.boundaries[1].wraps = ['users', 'cdn'];const { code, stderr, outPath } = render('architecture', d);assert.equal(code, 0, stderr);const html = fs.readFileSync(outPath, 'utf8');