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(class): normalize empty waypoint lists before routing
To3akaRin1f2de27b4f11
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 36f98910..5fce1a84 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,7 +12,7 @@ All notable changes are documented here. Format loosely follows [Keep a Changelo### Fixed-- **类图混合关系的主干冲突(#791)。** 自动继承/实现主干会检查组外路线的端口、走廊和交叉;冲突组回退到独立路由,避免依赖箭头被继承三角覆盖或实线覆盖实现虚线。无冲突主干、显式几何及关系语义保持不变。+- **类图混合关系的主干冲突(#791)。** 自动继承/实现主干会检查组外路线的端口、走廊和交叉;冲突组回退到独立路由,避免依赖箭头被继承三角覆盖或实线覆盖实现虚线。无冲突主干、显式几何及关系语义保持不变;空 `via: []` 与省略路径点统一处理,避免合法输入在回退后产生非法斜线。- **SVG 路径检查(#641)。** 统一解析关系线和结构边界的 `M/L/H/V/Q/Z` 路径,正确保留子路径与闭合语义;截断参数、非法数值和不支持的命令现在有限失败并给出定位诊断,避免检查挂起、漏检或虚构跨子路径线段。非共线 `Q` 前后的直线保留真实连续性,避免虚假交叉、标签遮挡和漏检;曲线采样点不会增加微线段预算。普通有效产物的 9 项检查保持不变。- **Inactive brand icon declarations.** Capture ignores icon markup in comments, raw text (including `noscript` for `text/html`), quoted attributes and templates, so inactive page edits cannot replace the selected image or break its pinned digest. Complete link attributes keep quoted delimiters and distinguish `href` from `data-href`; XHTML `noscript` discovery and links after empty elements are preserved. Old pins to inactive markup may require inspecting and explicitly recapturing the intended icon; digest checking remains enforced.- **Brand ICO data bounds (#585).** Capture and pinned re-fetches reject empty, directory-overlapping or out-of-bounds image ranges in ICO directory entries, while preserving valid PNG/DIB payloads and normal icon fallback.diff --git a/archify.zip b/archify.zipindex 08ce737f..f48f4aa8 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/renderers/class/README.md b/archify/renderers/class/README.mdindex c0733deb..efaea675 100644--- a/archify/renderers/class/README.md+++ b/archify/renderers/class/README.md@@ -109,6 +109,9 @@ rhythm, and label-clearance gates.Labels sit on the segment with the most room: above a horizontal run, beside avertical one. `labelAt`, `labelDx`/`labelDy`, and `labelSegment` override it.+`via: []` 与省略 `via` 等价,在主干选择和回退路由前统一按无路径点处理。+非空 `via` 仍是显式几何;其他路由与标签控制不变,原始 JSON 不会被改写。+## Reader and exportAn automatic canvas declares `data-reader-fit="intrinsic-height"` and a 7.5pxdiff --git a/archify/renderers/class/render-class.mjs b/archify/renderers/class/render-class.mjsindex 22537ce9..706d9e7e 100644--- a/archify/renderers/class/render-class.mjs+++ b/archify/renderers/class/render-class.mjs@@ -246,7 +246,13 @@ const types = new Map(measuredTypes.map((type) => {}}-const relationships = asArray(cd.relationships);+const relationships = asArray(cd.relationships).map((relationship) => {+ if (!Array.isArray(relationship.via) || relationship.via.length) return relationship;+ // 空路径与省略字段等价,统一主干和普通路由的判断,同时保留作者原始文档。+ const automatic = { ...relationship };+ delete automatic.via;+ return automatic;+});const typeSteps = new Map();for (const [index, relationship] of relationships.entries()) {diff --git a/docs/evidence/class-bus-routing/README.md b/docs/evidence/class-bus-routing/README.mdindex 601f0e42..574194bb 100644--- a/docs/evidence/class-bus-routing/README.md+++ b/docs/evidence/class-bus-routing/README.md@@ -1,6 +1,17 @@# 类图主干与组外路由协调:#791 证据-## 版本和观察范围+## 空 via 审查跟进++CodeRabbit 在 `b17b5171` 指出合法的 `via: []` 在主干回退后会被普通路由器误认为显式路径。+Class 关系入口现在只克隆并移除空数组字段,统一主干与普通路由的判断;非空路径及其他控制原样保留,不改写原始输入。++- 新增 7 项回归在修复前为 5 失败/2 通过;修复后连同原套件共 **41 项通过,0 失败,0 跳过**。+- 覆盖一条、主干成员、全部关系带空 via,standard/showcase 以及原序/逆序,验证与省略 via 的 SVG 相同;显式侧边、straight、labelAt 和非空 via 保留。+- Chrome 场景改为实际携带空 via;**2 项真实浏览器检查通过**,包含 light/dark 的 Focus 和独立 SVG 导出。generated 检查通过。+- 原 18 个固定输入重新运行公开 validate/render/check,完整 HTML 均与前一候选逐字节一致,见 [empty-via-followup.json](empty-via-followup.json)。因此复用下方原有截图和视觉观察,保留原修订归属,不重新标注为本轮截图。+- 新 ZIP 为 149 文件,两次构建一致,仓库外解包 smoke 通过;SHA-256:`1a3cb744929202d3fbfac0a3666a140073477746c56a3beacbf43ff7aa0b62c9`。++## 初版版本和观察范围比较基线:`9ef09617bd9ed2fe7bb4ad17fba7c8fce6b0ce76`。候选运行时的 SHA-256、输入和输出摘要见 [comparison.json](comparison.json);提交前以相同运行时代码采集。环境为 macOS 15.7.7、官方 Node 22.23.1、Chrome 154.0.8037.98。@@ -14,7 +25,7 @@- 等高交错排列:只移除主干仍会让普通路线共享 115px 走廊;回退后开启已有独立端口模式,修复该边界。- 已有 shapes 案例:继承主干的横段与 Group → Shape 的组合关系在 `(593,206)` 交叉。修复后取消该主干并重排自动关系;节点和成员文本不变。-## 验证结果+## 初版验证结果| 检查 | 结果 || --- | --- |diff --git a/docs/evidence/class-bus-routing/empty-via-followup.json b/docs/evidence/class-bus-routing/empty-via-followup.jsonnew file mode 100644index 00000000..36cba9d5--- /dev/null+++ b/docs/evidence/class-bus-routing/empty-via-followup.json@@ -0,0 +1,140 @@+{+ "previousHead": "b17b5171a5be8acaccbf9e65513ef5d22bebddfc",+ "node": "22.23.1",+ "runtimeSha256": "bc99a08bd8fba4908b3fd2c3fa3116d0b4cd8fa33f698f42e26f9196a86bf836",+ "cases": [+ {+ "name": "bus-with-ordinary",+ "inputSha256": "6a3c4764a34b0d568ecb5c7843a3240cab70c0e007d285b57e9ba2a1c6ef3c2d",+ "htmlSha256": "8ea8ecdac71264ee95670234c7456f587c7414b5e5d78c79a2a5971a2c2855f5",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "bus-with-dependency",+ "inputSha256": "0dfdd7022b67d0d095c87c1f100e96179cffec95fd3eabc85fcad5a4cbe1e0b3",+ "htmlSha256": "2a8c67aa69b72ecbbabff6a2c14874bd30b86c16590caa781eba4b7ff0a851c2",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "mixedbus",+ "inputSha256": "fb16f2ba68ca13988b9b56e59d376ae8931ea844043979dc3a460f9377d1598a",+ "htmlSha256": "b516afc04117ca8e7a99df4059ac4ed9b6bae33689f77b1a4f5437d53bfc7426",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "interleaved",+ "inputSha256": "ec09e455b15cbb2d5215e45fcf03040677cccdd77043f505dfc4cd8acb45e3b1",+ "htmlSha256": "ccb33246fec6b8434a07e38d8b1bfd9dd7c486eaabc53996b0f5f2c78284c09c",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "payments.class",+ "inputSha256": "afba837f97a041e14687cbe8893523232c4afad7afd922d9b128606d1b3f12c8",+ "htmlSha256": "f029ebdc68271f80b47ee423fc2b7deccee9f17aebf4b9dc7a93effc386640e8",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "payment-processors.class",+ "inputSha256": "98742b997db4782981460e8110e5fba899d8500c92c086aa867c5c62c3b89222",+ "htmlSha256": "dfd08e5216cdf56fd85b2c42e8b76bc2ff13d4c8042be48676242323b819cebf",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "first-draft-notifications",+ "inputSha256": "46a167626026ff9ad41117a15ac5f7dd78d6162057b4dcc7cd50042e4d1e2df1",+ "htmlSha256": "b732cd828a7cf76d17b1bba6da29c70fba03570e34fc5ba5d23c94723286977d",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "first-draft-repository",+ "inputSha256": "d89d998866abd61ed4dd52f0ebfde7de7aaf4e40e23308d6344e0448daea62cb",+ "htmlSha256": "1ca170f539ecb8fa27ad0d9535fae014f041c246f38dbbd49f297771c4c1fb25",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "first-draft-shapes",+ "inputSha256": "fc18a7d3a82f968aaa715c9834c7eaa23dd1110142610b64ac8e55254e9b760e",+ "htmlSha256": "3ff3cb4858e74bde814f3f29563e1b91cf50374e8fb6a66f9574460565de2b91",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "web-app.architecture",+ "inputSha256": "95e051b27a9e4a3307e194c0f666fca4af51470be7e2228d400ff48aea5b353b",+ "htmlSha256": "747dbf4a3de9ebd096f585ce431e52019557989b3d4fa197f8d88e54aab8e233",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "agent-tool-call.workflow",+ "inputSha256": "d67965d50872c97e4ff3476271e645bf19fab6b3ab44e111bdb44b063e3aa36f",+ "htmlSha256": "9e9d633be97f552d402895216ee622e469cd04709da0dfc8d24ee6af363ca124",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "cache-miss-request.sequence",+ "inputSha256": "f8486daa803fff6c295cecca4604c561fbbf9acb2e83326022b5a87639e8afe6",+ "htmlSha256": "1a65397a6450427a4a9d51f1087917d9709181a2ccea99a1199fd1559be3fd71",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "product-analytics.dataflow",+ "inputSha256": "8a635db9e51a5b1a8d2955b9d66f5b9a450e0a298432ce8f2e2f0be11f372e05",+ "htmlSha256": "8896e6da9307ab452bcf8e0d478f708f0ea4ae517efd330d322bfbec5ce7b9f5",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "agent-run.lifecycle",+ "inputSha256": "5ba36f5ce91ed428cb48b599e275424916d82b619b9a3231cbd1bbc3966fc54b",+ "htmlSha256": "88e481d8a20d726c1123e616ac4d3ab48a18b482ef8e43ee8754ac66115c5b39",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "orders.erd",+ "inputSha256": "1777a374647084466f4d7ce3a968004be6ab70ac9cf82459b96bed7c556cdfdd",+ "htmlSha256": "d1f3bd878a9af715e4db96732a4f2b5b191f3cfc8bb1ba57ef6d8a09b2057bfd",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "payment-platform.tree",+ "inputSha256": "1e99f37b3845d67fa97c9a2ff33109981c23bfdb0d03ba05b7d92944dcdfc61f",+ "htmlSha256": "7c0b26eea2e3278cd235ff9629b52653b87b7e68bc4d4b57ecacec9cf2676a67",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "payment-incident.timeline",+ "inputSha256": "c1f535b3cc915ddd47ecd7df4e3ef02c441c8c3191daced5cf4422cff8dec95f",+ "htmlSha256": "57a6fc41ab05091dd5ad6a4088be93398745c673691713b3abd6599094da838a",+ "identicalToPreviousCandidate": true+ },+ {+ "name": "checkout-request.waterfall",+ "inputSha256": "55a5f74699a0f0e44018a4a000556d43c90430b95f39accac6141af8318b5133",+ "htmlSha256": "cb4e88162469e555f11af3d8bdff11509f4cf4b9ec9e00c0736513684d6aaa60",+ "identicalToPreviousCandidate": true+ }+ ],+ "allPreviousArtifactsIdentical": true,+ "focused": {+ "passed": 41,+ "failed": 0,+ "skipped": 0+ },+ "browser": {+ "passed": 2,+ "failed": 0,+ "skipped": 0,+ "fixtureUsesEmptyVia": true+ },+ "generated": "passed",+ "regressionsBeforeFix": {+ "passed": 2,+ "failed": 5,+ "skipped": 0+ },+ "package": {+ "files": 149,+ "exit": 0,+ "sha256": "1a3cb744929202d3fbfac0a3666a140073477746c56a3beacbf43ff7aa0b62c9",+ "repeatedBytesIdentical": true,+ "outsideRepository": true+ }+}diff --git a/docs/specs/class-bus-routing-validation.md b/docs/specs/class-bus-routing-validation.mdindex 35703322..c199643a 100644--- a/docs/specs/class-bus-routing-validation.md+++ b/docs/specs/class-bus-routing-validation.md@@ -13,11 +13,12 @@3. 有冲突时整组回退,通过现有普通路由器重新分配;仅发生回退后启用已有的独立端口模式,防止等高交错关系重新共享走廊。4. 每轮只删除冲突组,再检查剩余主干。候选集合单调缩小,最多候选组数次回退;不增加无界重试。5. 节点位置、文本、关系身份和方向不变。保留显式 via、侧边、直线路由及 labelAt;不增加对所有固定路线间距或任意布局成功的保证。+ 空数组 `via: []` 在关系入口与省略字段统一;仅克隆需要归一化的条目,不改原始文档,非空路径仍保持显式控制。6. 正常同类主干保留反向绘制和 source-to-target 的 data-motion-path,Focus 与独立 SVG 导出继续使用正确语义。## 验收记录-基线为 `9ef09617bd9ed2fe7bb4ad17fba7c8fce6b0ce76`,运行时代码的内容摘要记录在[比较证据](../evidence/class-bus-routing/comparison.json)中。+基线为 `9ef09617bd9ed2fe7bb4ad17fba7c8fce6b0ce76`,初版运行时代码的内容摘要记录在[比较证据](../evidence/class-bus-routing/comparison.json)中。空 via 跟进的代码摘要及 18 个输出复核记录见[跟进证据](../evidence/class-bus-routing/empty-via-followup.json)。| 行为 | 检查及结果 || --- | --- |@@ -31,7 +32,7 @@| 类型与成员信息 | 全部 9 个 Class 对比输入的节点位置、尺寸、文字与关系身份/种类一致 || 实际视觉观察 | 3 个案例、light/dark、前后共 12 张截图检查通过 |-34 项 Class 专项、18 项核心 smoke、2 项真实 Chrome 检查及 generated 检查通过。无需改写其他图类型的黄金结果;本轮没有执行本地 test:full,远端最终提交的适用 CI 另行验证并记录于 PR。+初版 34 项 Class 专项、18 项核心 smoke、2 项真实 Chrome 检查及 generated 检查通过。空 via 跟进后 Class 专项为 41 项,Chrome 2 项与 generated 检查重新通过;旧 18 个输入的公开命令及输出字节重新核验一致。无需改写其他图类型的黄金结果;本轮没有执行本地 test:full,远端最终提交的适用 CI 另行验证并记录于 PR。## 边界diff --git a/test/class-bus-routing.test.mjs b/test/class-bus-routing.test.mjsindex 80426792..31ec644e 100644--- a/test/class-bus-routing.test.mjs+++ b/test/class-bus-routing.test.mjs@@ -60,12 +60,14 @@ function render(t, document, quality = 'showcase') {t.after(() => fs.rmSync(directory, { recursive: true, force: true }));const input = path.join(directory, 'input.class.json');const output = path.join(directory, 'output.html');- fs.writeFileSync(input, JSON.stringify(document));+ const authoredInput = JSON.stringify(document);+ fs.writeFileSync(input, authoredInput);const validation = JSON.parse(run(['validate', 'class', input, '--quality', quality, '--json'], directory));assert.equal(validation.ok, true);run(['render', 'class', input, output, '--quality', quality], directory);const check = JSON.parse(run(['check', output, '--json'], directory));assert.equal(check.ok, true);+ assert.equal(fs.readFileSync(input, 'utf8'), authoredInput, '路由归一化不得改写作者输入');assert.equal(check.composition.summary.errors, 0);const svg = fs.readFileSync(output, 'utf8').match(/<svg\b[\s\S]*?<\/svg>/)?.[0];assert.ok(svg, '渲染结果应包含 SVG');@@ -166,6 +168,26 @@ for (const quality of ['standard', 'showcase']) {}}+for (const quality of ['standard', 'showcase']) {+ for (const kind of ['dependency', 'realization']) {+ test(`class ${quality}: empty via keeps ${kind} fallback equivalent to omitted waypoints`, (t) => {+ for (const reverse of [false, true]) {+ const omitted = diagram(kind);+ if (reverse) omitted.relationships.reverse();+ const expected = render(t, omitted, quality);+ for (const selection of ['one', 'hierarchy', 'all']) {+ const document = structuredClone(omitted);+ const members = document.relationships.filter((relation) => selection === 'all' || relation.kind === 'inheritance');+ for (const relation of selection === 'one' ? members.slice(0, 1) : members) relation.via = [];+ const actual = render(t, document, quality);+ assertDistinctNotation(actual.routes);+ assert.equal(actual.svg, expected.svg, `${selection}: 空 via 与省略字段应有相同渲染行为`);+ }+ }+ });+ }+}+for (const kind of ['inheritance', 'realization']) {test(`class: an isolated ${kind} hierarchy retains its shared bus`, (t) => {const document = diagram();@@ -201,10 +223,12 @@ test('class: a separate storage hierarchy keeps its bus while another hierarchy}});-for (const control of ['via', 'sides', 'route', 'labelAt']) {- test(`class: bus coordination preserves authored ${control}`, (t) => {+for (const [control, emptyVia] of ['via', 'sides', 'route', 'labelAt']+ .flatMap((control) => (control === 'via' ? [[control, false]] : [[control, false], [control, true]]))) {+ test(`class: bus coordination preserves authored ${control}${emptyVia ? ' with empty via' : ''}`, (t) => {const document = diagram('dependency');const relation = document.relationships.at(-1);+ if (emptyVia) relation.via = [];if (control === 'via') {Object.assign(relation, { fromSide: 'right', toSide: 'right', via: [[584, 313], [584, 62]] });} else if (control === 'sides') {@@ -218,7 +242,7 @@ for (const control of ['via', 'sides', 'route', 'labelAt']) {const route = routes.find(({ id }) => id === relation.id);if (relation.fromSide) assert.ok(onSide(route.points[0], boxes.get(relation.from), relation.fromSide));if (relation.toSide) assert.ok(onSide(route.points.at(-1), boxes.get(relation.to), relation.toSide));- if (relation.via) assert.deepEqual(route.points.slice(1, -1), relation.via, '作者 via 点必须原样保留');+ if (relation.via?.length) assert.deepEqual(route.points.slice(1, -1), relation.via, '作者 via 点必须原样保留');if (relation.route === 'straight') assert.equal(route.points.length, 2, '作者要求的直线路由不能被自动绕行替代');if (relation.labelAt) {const labelGroup = [...svg.matchAll(/<g\b[^>]*data-edge-id="impl_relation"[^>]*>[\s\S]*?<\/g>/g)]diff --git a/test/class-motion-browser.test.mjs b/test/class-motion-browser.test.mjsindex 33bfc731..08734ec7 100644--- a/test/class-motion-browser.test.mjs+++ b/test/class-motion-browser.test.mjs@@ -112,8 +112,8 @@ test('class: mixed hierarchy fallback keeps dependency notation in focus and SVG{ id: 'client', label: 'Client', kind: 'class', row: 2, col: 1 },],relationships: [- { id: 'left_extends', from: 'left', to: 'base', kind: 'inheritance' },- { id: 'right_extends', from: 'right', to: 'base', kind: 'inheritance' },+ { id: 'left_extends', from: 'left', to: 'base', kind: 'inheritance', via: [] },+ { id: 'right_extends', from: 'right', to: 'base', kind: 'inheritance', via: [] },{ id: 'client_uses', from: 'client', to: 'base', kind: 'dependency' },],}));