Skip to content

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

fix(visual-check): explain workflow viewport overflow with lane measurements

tt-a1i62e7c4d6ca98
diff --git a/archify.zip b/archify.zip
index c3c689e0..0c3a54ff 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/SKILL.md b/archify/SKILL.md
index 4011ba54..14942857 100644
--- a/archify/SKILL.md
+++ b/archify/SKILL.md
@@ -103,6 +103,8 @@ After delivery, collect bounded desktop evidence without modifying or rerenderin
node bin/archify.mjs visual-check <output.html> --json
```
+For workflow viewport overflow, read [Workflow viewport repair](references/authoring-contract.md#workflow-viewport-repair) before the next layout edit.
+
`visual-check` collects automated browser evidence from the exact delivered HTML without modifying or rerendering it. Its machine-readable measurements and screenshots do not approve perceptual polish. Follow `references/delivery-contract.md` for the canonical receipt fields, coverage, sidecars, exit behavior, and supplementary manual-record requirements.
Keep the three claims separate: `deliver` proves deterministic artifact checks, `visual-check` proves bounded behavior in a real browser, and perceptual visual review requires an actual human or image-capable reviewer. Report browser evidence and perceptual review independently. An unconstrained glance can support only perceptual review; use the canonical delivery contract when recording supplementary manual browser work or handling an environmental failure.
diff --git a/archify/bin/visual-check.mjs b/archify/bin/visual-check.mjs
index 8adb154b..f9ac1621 100644
--- a/archify/bin/visual-check.mjs
+++ b/archify/bin/visual-check.mjs
@@ -432,6 +432,29 @@ export class ChromeVisualBrowser {
&& typeof Archify.viewerChromeLayout.receipt === 'function'
? Archify.viewerChromeLayout.receipt()
: null;
+ // Read rendered boxes only; source ownership, offsets and hard pins are unknown.
+ var workflowLanes = svg ? Array.from(svg.querySelectorAll('rect[data-composition-frame-kind="lane"]')).map(function (lane) {
+ var rect = lane.getBoundingClientRect();
+ var members = Array.from(svg.querySelectorAll('g[data-node-id]')).map(function (node) {
+ var box = node.querySelector('rect');
+ if (!box) return null;
+ var bounds = box.getBoundingClientRect();
+ if (bounds.top < rect.top - 1 || bounds.bottom > rect.bottom + 1
+ || bounds.left < rect.left - 1 || bounds.right > rect.right + 1) return null;
+ return { id: node.getAttribute('data-node-id'), top: bounds.top, bottom: bounds.bottom };
+ }).filter(Boolean);
+ var top = members.length ? Math.min.apply(null, members.map(function (node) { return node.top; })) : null;
+ var bottom = members.length ? Math.max.apply(null, members.map(function (node) { return node.bottom; })) : null;
+ return {
+ frameId: lane.getAttribute('data-composition-frame-id'),
+ heightPx: Math.round(rect.height),
+ nodeCount: members.length,
+ nodeIds: members.slice(0, 12).map(function (node) { return node.id; }),
+ nodeSpanPx: top === null ? null : Math.round(bottom - top),
+ spaceAboveNodesPx: top === null ? null : Math.round(top - rect.top),
+ spaceBelowNodesPx: bottom === null ? null : Math.round(rect.bottom - bottom)
+ };
+ }).sort(function (a, b) { return b.heightPx - a.heightPx; }).slice(0, 6) : [];
return {
innerWidth: window.innerWidth,
innerHeight: window.innerHeight,
@@ -441,6 +464,7 @@ export class ChromeVisualBrowser {
readerWidth: reader ? reader.getBoundingClientRect().width : 0,
diagramWidth: diagramWidth,
viewBoxWidth: viewBoxWidth,
+ workflowLanes: workflowLanes,
minimumProjectedNodeTextPx: minimum ? minimum.projectedFontPx : null,
minimumProjectedNodeText: minimum ? minimum.text : null,
minimumProjectedNodeTextDetail: minimum ? minimum.detail : null,
@@ -534,6 +558,7 @@ function observation({ width, height, theme, metrics }) {
readerWidth: Number(metrics.readerWidth) || null,
diagramWidth: Number(metrics.diagramWidth) || null,
viewBoxWidth: Number(metrics.viewBoxWidth) || null,
+ ...(metrics.workflowLanes?.length ? { workflowLanes: metrics.workflowLanes } : {}),
minimumProjectedNodeTextPx,
minimumProjectedNodeText: metrics.minimumProjectedNodeText || null,
minimumProjectedNodeTextDetail: metrics.minimumProjectedNodeTextDetail || null,
@@ -604,9 +629,17 @@ function observationDiagnostics({ artifact, allObservations, readabilityObservat
scrollHeight: entry.scrollHeight,
overflowX: entry.overflowX,
overflowY: entry.overflowY,
+ ...(entry.overflowY && entry.workflowLanes?.length ? {
+ workflowLanes: entry.workflowLanes,
+ measurement: 'CSS pixels; rendered node boxes geometrically contained in each lane frame; spaces include headers and routing, not guaranteed removable space',
+ } : {}),
},
supportedFixes: [
- `contain the rendered layout within ${entry.width}x${entry.height}, then rerun visual-check`,
+ ...(entry.overflowY && entry.workflowLanes?.length ? [
+ 'run validate workflow <source.json> --layout-json and compare the tallest rendered lane frames with source lanes, col and yOffset; frame IDs are rendered indices, not source lane IDs',
+ 'where ownership and explicit geometry permit, distribute stacked steps across logical columns and meaningful lanes before increasing yOffset; preserve nodes, branches, labels and hard pins',
+ 'read references/authoring-contract.md#workflow-viewport-repair, then validate and deliver the changed source before rerunning visual-check on the new artifact; this is inspection guidance, not a verified coordinate fix',
+ ] : [`contain the rendered layout within ${entry.width}x${entry.height}, then rerun visual-check`]),
],
}));
}
diff --git a/archify/references/authoring-contract.md b/archify/references/authoring-contract.md
index 890d5c6e..0778f6bf 100644
--- a/archify/references/authoring-contract.md
+++ b/archify/references/authoring-contract.md
@@ -161,6 +161,27 @@ legacy geometry compatibility. Keep the happy path monotonic, preserve semantic
edge labels, and route retries and exception returns outside the main lane
corridor.
+#### Workflow viewport repair
+
+When `viewer/viewport-overflow` includes `workflowLanes`, inspect the tallest
+rendered frames and their node span before changing the source. Measurements
+are CSS pixels; space above/below nodes includes lane titles and routing, so it
+is not a removable-space budget. Frame IDs identify rendered lane indices.
+
+Run `validate workflow <source.json> --layout-json` and match those frames to
+source lanes and nodes. Check whether many steps share the last logical column
+and use large `yOffset` values. Readable-v2 currently reserves symmetric space
+around offsets and shares the base content height between lanes, so increasing
+one offset can enlarge otherwise sparse lanes.
+
+Where the source's ownership and explicit geometry permit, redistribute steps
+across logical columns and meaningful lanes, keeping the main path monotonic.
+Preserve every required node, relationship, label and semantic check. If ownership
+or absolute pins prevent reflow, report that constraint instead of merging lanes
+or moving pins automatically. Validate the changed JSON, deliver a fresh HTML,
+then rerun browser checks and inspect the first screen; a static pass alone does
+not settle viewport fit. These are repair directions, not guaranteed coordinates.
+
### Sequence
Participants are ordered by conversation role. Messages own their vertical order. Use return/async/security variants for meaning, not decoration; sequence does not use Automatic Port Spread.
diff --git a/archify/test/desktop-reader-browser.test.mjs b/archify/test/desktop-reader-browser.test.mjs
index 867a7cb4..000763bc 100644
--- a/archify/test/desktop-reader-browser.test.mjs
+++ b/archify/test/desktop-reader-browser.test.mjs
@@ -6,7 +6,7 @@ import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
-import { findChrome, runVisualCheck } from '../bin/visual-check.mjs';
+import { ChromeVisualBrowser, findChrome, runVisualCheck } from '../bin/visual-check.mjs';
import { DESKTOP_READABILITY_VIEWPORT, MIN_PROJECTED_NODE_TEXT_PX } from '../renderers/shared/desktop-readability.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -56,3 +56,52 @@ test('production showcase is readable in the real 1440 by 900 adaptive reader',
fs.rmSync(tmp, { recursive: true, force: true });
}
});
+
+test('offline workflow viewport repair retains order semantics and identifies overflowing lane frames', {
+ skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',
+}, async () => {
+ const fixtureRoot = path.join(skillRoot, 'test/fixtures/workflow-viewport');
+ const failed = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'order-overflow.workflow.json'), 'utf8'));
+ const repaired = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'order-reflow.workflow.json'), 'utf8'));
+ const meaning = ({ lane, col, yOffset, ...node }) => node;
+ assert.deepEqual(failed.nodes.map(meaning), repaired.nodes.map(meaning));
+ for (const key of ['edges', 'semanticChecks', 'mainPath', 'cards', 'phases', 'meta']) {
+ assert.deepEqual(repaired[key], failed[key], key);
+ }
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-workflow-viewport-'));
+ try {
+ for (const name of ['order-overflow', 'order-reflow']) {
+ const artifact = path.join(tmp, `${name}.html`);
+ execFileSync(process.execPath, [path.join(skillRoot, 'bin/archify.mjs'), 'deliver', 'workflow',
+ path.join(fixtureRoot, `${name}.workflow.json`), artifact, '--quality', 'showcase', '--json'], { cwd: skillRoot });
+ const result = await runVisualCheck({
+ artifactPath: artifact, chromePath,
+ browserFactory: async (executable) => {
+ const browser = new ChromeVisualBrowser(executable);
+ try {
+ const session = await browser.sessionPromise;
+ await browser.cdp.send('Network.enable', {}, session);
+ await browser.cdp.send('Network.setBlockedURLs', { urls: ['http://*', 'https://*'] }, session);
+ return browser;
+ } catch (error) {
+ await browser.close();
+ throw error;
+ }
+ },
+ });
+ if (name === 'order-overflow') {
+ assert.equal(result.exitCode, 1);
+ const diagnostic = result.receipt.diagnostics.find(({ code }) => code === 'viewer/viewport-overflow');
+ assert.ok(diagnostic, JSON.stringify(result.receipt));
+ assert.equal(diagnostic.evidence.workflowLanes[0].frameId, 'lane-0');
+ assert.equal(diagnostic.evidence.workflowLanes[0].nodeCount, 12);
+ assert.ok(diagnostic.evidence.workflowLanes[0].spaceAboveNodesPx > 100);
+ } else {
+ assert.equal(result.exitCode, 0, JSON.stringify(result.receipt));
+ assert.equal(result.receipt.containment.status, 'pass');
+ }
+ }
+ } finally {
+ fs.rmSync(tmp, { recursive: true, force: true });
+ }
+});
diff --git a/archify/test/fixtures/workflow-viewport/README.md b/archify/test/fixtures/workflow-viewport/README.md
new file mode 100644
index 00000000..43cc767a
--- /dev/null
+++ b/archify/test/fixtures/workflow-viewport/README.md
@@ -0,0 +1,20 @@
+# Order workflow viewport regression
+
+Original task (Chinese): 用户提交订单,校验并预占库存,创建待支付订单并等待支付;支付成功扣减库存并发货;库存不足提示失败;支付超时取消订单并释放预占库存;发货失败进入人工处理。
+
+`order-overflow.workflow.json` is the final failed candidate from a Luna trial on
+PR #325 (`d634028`), after three layout repairs. Static showcase validation
+passed, but 1440×900 browser scrollHeight was 1499. This is a known failing
+browser fixture, not a recommended authoring example.
+
+`order-reflow.workflow.json` preserves its node business fields, edges, mainPath,
+semanticChecks, cards, phases and metadata. Only lane grouping, columns and
+vertical offsets differ. Both compile and deliver successfully. The browser
+regression proves the overflow yields measured lane evidence and that a semantic
+reflow can pass without weakening the gate. It blocks remote HTTP(S) resources
+for repeatable font conditions; it does not establish online font reliability.
+
+Rendered frame IDs are indices, not source ownership IDs. The diagnostic's
+contained node boxes and blank-space measurements are observations, not proof
+that headers, routing space, ownership boundaries or absolute pins can be moved.
+The repaired layout is one valid answer to this task, not a universal repair.
diff --git a/archify/test/fixtures/workflow-viewport/order-overflow.workflow.json b/archify/test/fixtures/workflow-viewport/order-overflow.workflow.json
new file mode 100644
index 00000000..a24e25f4
--- /dev/null
+++ b/archify/test/fixtures/workflow-viewport/order-overflow.workflow.json
@@ -0,0 +1,72 @@
+{
+ "schema_version": 2,
+ "diagram_type": "workflow",
+ "meta": {
+ "title": "订单处理工作流",
+ "locale": "zh-CN",
+ "quality_profile": "showcase"
+ },
+ "lanes": [
+ { "id": "order_flow", "label": "订单处理流程" }
+ ],
+ "phases": [
+ { "id": "submit_phase", "label": "提交与校验", "fromCol": 0, "toCol": 1 },
+ { "id": "payment_phase", "label": "支付等待", "fromCol": 2, "toCol": 4, "variant": "emphasis" },
+ { "id": "fulfillment_phase", "label": "履约与收尾", "fromCol": 5, "toCol": 5 }
+ ],
+ "mainPath": ["submit_order", "check_inventory", "reserve_inventory", "create_pending", "wait_payment", "payment_success", "deduct_inventory", "ship_order"],
+ "semanticChecks": {
+ "allowedRoots": ["submit_order"],
+ "allowedTerminals": ["notify_insufficient", "release_inventory", "ship_order", "manual_fulfillment"],
+ "requiredEdges": [
+ { "from": "submit_order", "to": "check_inventory" },
+ { "from": "check_inventory", "to": "reserve_inventory" },
+ { "from": "reserve_inventory", "to": "create_pending" },
+ { "from": "create_pending", "to": "wait_payment" },
+ { "from": "wait_payment", "to": "payment_success" },
+ { "from": "payment_success", "to": "deduct_inventory" },
+ { "from": "deduct_inventory", "to": "ship_order" },
+ { "from": "check_inventory", "to": "notify_insufficient" },
+ { "from": "wait_payment", "to": "cancel_order" },
+ { "from": "cancel_order", "to": "release_inventory" },
+ { "from": "ship_order", "to": "manual_fulfillment" }
+ ],
+ "requiredPaths": [
+ { "from": "check_inventory", "to": "notify_insufficient" },
+ { "from": "wait_payment", "to": "cancel_order" },
+ { "from": "cancel_order", "to": "release_inventory" },
+ { "from": "ship_order", "to": "manual_fulfillment" }
+ ]
+ },
+ "nodes": [
+ { "id": "submit_order", "lane": "order_flow", "col": 0, "type": "external", "label": "提交订单", "sublabel": "用户确认商品" },
+ { "id": "check_inventory", "lane": "order_flow", "col": 1, "type": "backend", "label": "校验库存", "sublabel": "检查可售数量" },
+ { "id": "reserve_inventory", "lane": "order_flow", "col": 2, "type": "database", "label": "预占库存", "sublabel": "锁定可售数量" },
+ { "id": "create_pending", "lane": "order_flow", "col": 3, "type": "backend", "label": "创建待支付订单", "sublabel": "订单状态:待支付", "width": 92 },
+ { "id": "wait_payment", "lane": "order_flow", "col": 4, "type": "external", "label": "等待支付", "sublabel": "等待支付结果" },
+ { "id": "payment_success", "lane": "order_flow", "col": 5, "type": "backend", "label": "支付成功", "sublabel": "确认到账", "yOffset": -110 },
+ { "id": "deduct_inventory", "lane": "order_flow", "col": 5, "type": "database", "label": "扣减库存", "sublabel": "结算预占数量" },
+ { "id": "ship_order", "lane": "order_flow", "col": 5, "type": "backend", "label": "发货", "sublabel": "创建配送任务", "yOffset": 80 },
+ { "id": "notify_insufficient", "lane": "order_flow", "col": 2, "type": "external", "label": "提示库存不足", "sublabel": "订单失败", "yOffset": 100 },
+ { "id": "cancel_order", "lane": "order_flow", "col": 5, "type": "backend", "label": "取消订单", "sublabel": "支付超时", "yOffset": 140 },
+ { "id": "release_inventory", "lane": "order_flow", "col": 4, "type": "database", "label": "释放预占库存", "sublabel": "恢复可售数量", "yOffset": 160 },
+ { "id": "manual_fulfillment", "lane": "order_flow", "col": 5, "type": "external", "label": "人工处理", "sublabel": "发货失败", "yOffset": 260 }
+ ],
+ "edges": [
+ { "id": "submit_to_check", "from": "submit_order", "to": "check_inventory", "role": "main" },
+ { "id": "check_to_reserve", "from": "check_inventory", "to": "reserve_inventory", "label": "库存充足", "role": "main", "variant": "emphasis" },
+ { "id": "reserve_to_pending", "from": "reserve_inventory", "to": "create_pending", "label": "预占成功", "role": "main" },
+ { "id": "pending_to_wait", "from": "create_pending", "to": "wait_payment", "role": "main" },
+ { "id": "wait_to_paid", "from": "wait_payment", "to": "payment_success", "label": "支付成功", "role": "main", "variant": "emphasis" },
+ { "id": "paid_to_deduct", "from": "payment_success", "to": "deduct_inventory", "label": "结算预占", "role": "main" },
+ { "id": "deduct_to_ship", "from": "deduct_inventory", "to": "ship_order", "role": "main", "variant": "emphasis" },
+ { "id": "check_to_insufficient", "from": "check_inventory", "to": "notify_insufficient", "label": "库存不足", "role": "error", "variant": "security" },
+ { "id": "wait_to_timeout", "from": "wait_payment", "to": "cancel_order", "label": "支付超时", "role": "error", "variant": "security" },
+ { "id": "cancel_to_release", "from": "cancel_order", "to": "release_inventory", "label": "释放预占", "role": "error", "variant": "dashed" },
+ { "id": "ship_to_manual", "from": "ship_order", "to": "manual_fulfillment", "label": "发货失败", "role": "error", "variant": "security" }
+ ],
+ "cards": [
+ { "dot": "emerald", "title": "库存语义", "items": ["库存充足后先预占", "支付成功再扣减", "支付超时释放预占"] },
+ { "dot": "amber", "title": "异常出口", "items": ["库存不足提示订单失败", "支付超时取消订单", "发货失败转人工处理"] }
+ ]
+}
diff --git a/archify/test/fixtures/workflow-viewport/order-reflow.workflow.json b/archify/test/fixtures/workflow-viewport/order-reflow.workflow.json
new file mode 100644
index 00000000..b59a2ff7
--- /dev/null
+++ b/archify/test/fixtures/workflow-viewport/order-reflow.workflow.json
@@ -0,0 +1,331 @@
+{
+ "schema_version": 2,
+ "diagram_type": "workflow",
+ "meta": {
+ "title": "订单处理工作流",
+ "locale": "zh-CN",
+ "quality_profile": "showcase"
+ },
+ "lanes": [
+ {
+ "id": "order",
+ "label": "订单与支付"
+ },
+ {
+ "id": "result",
+ "label": "库存与订单结果"
+ },
+ {
+ "id": "fulfil",
+ "label": "履约与异常处理"
+ }
+ ],
+ "phases": [
+ {
+ "id": "submit_phase",
+ "label": "提交与校验",
+ "fromCol": 0,
+ "toCol": 1
+ },
+ {
+ "id": "payment_phase",
+ "label": "支付等待",
+ "fromCol": 2,
+ "toCol": 4,
+ "variant": "emphasis"
+ },
+ {
+ "id": "fulfillment_phase",
+ "label": "履约与收尾",
+ "fromCol": 5,
+ "toCol": 5
+ }
+ ],
+ "mainPath": [
+ "submit_order",
+ "check_inventory",
+ "reserve_inventory",
+ "create_pending",
+ "wait_payment",
+ "payment_success",
+ "deduct_inventory",
+ "ship_order"
+ ],
+ "semanticChecks": {
+ "allowedRoots": [
+ "submit_order"
+ ],
+ "allowedTerminals": [
+ "notify_insufficient",
+ "release_inventory",
+ "ship_order",
+ "manual_fulfillment"
+ ],
+ "requiredEdges": [
+ {
+ "from": "submit_order",
+ "to": "check_inventory"
+ },
+ {
+ "from": "check_inventory",
+ "to": "reserve_inventory"
+ },
+ {
+ "from": "reserve_inventory",
+ "to": "create_pending"
+ },
+ {
+ "from": "create_pending",
+ "to": "wait_payment"
+ },
+ {
+ "from": "wait_payment",
+ "to": "payment_success"
+ },
+ {
+ "from": "payment_success",
+ "to": "deduct_inventory"
+ },
+ {
+ "from": "deduct_inventory",
+ "to": "ship_order"
+ },
+ {
+ "from": "check_inventory",
+ "to": "notify_insufficient"
+ },
+ {
+ "from": "wait_payment",
+ "to": "cancel_order"
+ },
+ {
+ "from": "cancel_order",
+ "to": "release_inventory"
+ },
+ {
+ "from": "ship_order",
+ "to": "manual_fulfillment"
+ }
+ ],
+ "requiredPaths": [
+ {
+ "from": "check_inventory",
+ "to": "notify_insufficient"
+ },
+ {
+ "from": "wait_payment",
+ "to": "cancel_order"
+ },
+ {
+ "from": "cancel_order",
+ "to": "release_inventory"
+ },
+ {
+ "from": "ship_order",
+ "to": "manual_fulfillment"
+ }
+ ]
+ },
+ "nodes": [
+ {
+ "id": "submit_order",
+ "lane": "order",
+ "col": 0,
+ "type": "external",
+ "label": "提交订单",
+ "sublabel": "用户确认商品"
+ },
+ {
+ "id": "check_inventory",
+ "lane": "order",
+ "col": 1,
+ "type": "backend",
+ "label": "校验库存",
+ "sublabel": "检查可售数量"
+ },
+ {
+ "id": "reserve_inventory",
+ "lane": "order",
+ "col": 2,
+ "type": "database",
+ "label": "预占库存",
+ "sublabel": "锁定可售数量"
+ },
+ {
+ "id": "create_pending",
+ "lane": "order",
+ "col": 3,
+ "type": "backend",
+ "label": "创建待支付订单",
+ "sublabel": "订单状态:待支付",
+ "width": 92
+ },
+ {
+ "id": "wait_payment",
+ "lane": "order",
+ "col": 4,
+ "type": "external",
+ "label": "等待支付",
+ "sublabel": "等待支付结果"
+ },
+ {
+ "id": "payment_success",
+ "lane": "order",
+ "col": 5,
+ "type": "backend",
+ "label": "支付成功",
+ "sublabel": "确认到账"
+ },
+ {
+ "id": "deduct_inventory",
+ "lane": "result",
+ "col": 5,
+ "type": "database",
+ "label": "扣减库存",
+ "sublabel": "结算预占数量"
+ },
+ {
+ "id": "ship_order",
+ "lane": "fulfil",
+ "col": 5,
+ "type": "backend",
+ "label": "发货",
+ "sublabel": "创建配送任务"
+ },
+ {
+ "id": "notify_insufficient",
+ "lane": "result",
+ "col": 1,
+ "type": "external",
+ "label": "提示库存不足",
+ "sublabel": "订单失败"
+ },
+ {
+ "id": "cancel_order",
+ "lane": "result",
+ "col": 4,
+ "type": "backend",
+ "label": "取消订单",
+ "sublabel": "支付超时"
+ },
+ {
+ "id": "release_inventory",
+ "lane": "fulfil",
+ "col": 4,
+ "type": "database",
+ "label": "释放预占库存",
+ "sublabel": "恢复可售数量"
+ },
+ {
+ "id": "manual_fulfillment",
+ "lane": "fulfil",
+ "col": 3,
+ "type": "external",
+ "label": "人工处理",
+ "sublabel": "发货失败"
+ }
+ ],
+ "edges": [
+ {
+ "id": "submit_to_check",
+ "from": "submit_order",
+ "to": "check_inventory",
+ "role": "main"
+ },
+ {
+ "id": "check_to_reserve",
+ "from": "check_inventory",
+ "to": "reserve_inventory",
+ "label": "库存充足",
+ "role": "main",
+ "variant": "emphasis"
+ },
+ {
+ "id": "reserve_to_pending",
+ "from": "reserve_inventory",
+ "to": "create_pending",
+ "label": "预占成功",
+ "role": "main"
+ },
+ {
+ "id": "pending_to_wait",
+ "from": "create_pending",
+ "to": "wait_payment",
+ "role": "main"
+ },
+ {
+ "id": "wait_to_paid",
+ "from": "wait_payment",
+ "to": "payment_success",
+ "label": "支付成功",
+ "role": "main",
+ "variant": "emphasis"
+ },
+ {
+ "id": "paid_to_deduct",
+ "from": "payment_success",
+ "to": "deduct_inventory",
+ "label": "结算预占",
+ "role": "main"
+ },
+ {
+ "id": "deduct_to_ship",
+ "from": "deduct_inventory",
+ "to": "ship_order",
+ "role": "main",
+ "variant": "emphasis"
+ },
+ {
+ "id": "check_to_insufficient",
+ "from": "check_inventory",
+ "to": "notify_insufficient",
+ "label": "库存不足",
+ "role": "error",
+ "variant": "security"
+ },
+ {
+ "id": "wait_to_timeout",
+ "from": "wait_payment",
+ "to": "cancel_order",
+ "label": "支付超时",
+ "role": "error",
+ "variant": "security"
+ },
+ {
+ "id": "cancel_to_release",
+ "from": "cancel_order",
+ "to": "release_inventory",
+ "label": "释放预占",
+ "role": "error",
+ "variant": "dashed"
+ },
+ {
+ "id": "ship_to_manual",
+ "from": "ship_order",
+ "to": "manual_fulfillment",
+ "label": "发货失败",
+ "role": "error",
+ "variant": "security"
+ }
+ ],
+ "cards": [
+ {
+ "dot": "emerald",
+ "title": "库存语义",
+ "items": [
+ "库存充足后先预占",
+ "支付成功再扣减",
+ "支付超时释放预占"
+ ]
+ },
+ {
+ "dot": "amber",
+ "title": "异常出口",
+ "items": [
+ "库存不足提示订单失败",
+ "支付超时取消订单",
+ "发货失败转人工处理"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/archify/test/visual-check.test.mjs b/archify/test/visual-check.test.mjs
index 2f488144..4a3a4c39 100644
--- a/archify/test/visual-check.test.mjs
+++ b/archify/test/visual-check.test.mjs
@@ -398,3 +398,26 @@ test('visual-check returns 2 with a truthful skipped receipt when Chrome is unav
});
process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));
+
+test('vertical workflow overflow reports measured frames and conditional reflow guidance without changing the artifact', async () => {
+ const file = artifact('workflow-overflow.html');
+ const before = sha256(file);
+ const browser = fakeBrowser();
+ const inspect = browser.inspect.bind(browser);
+ const lanes = [{ frameId: 'lane-0', heightPx: 720, nodeCount: 12, nodeIds: ['wait', 'cancel'], nodeSpanPx: 480, spaceAboveNodesPx: 180, spaceBelowNodesPx: 60 }];
+ browser.inspect = async (args) => ({ ...(await inspect(args)), scrollHeight: args.height + 599, workflowLanes: lanes });
+ const result = await runVisualCheck({ artifactPath: file, chromePath: '/fake/chrome', browserFactory: async () => browser });
+ assert.equal(result.exitCode, 1);
+ const diagnostic = result.receipt.diagnostics.find(({ code }) => code === 'viewer/viewport-overflow');
+ assert.deepEqual(diagnostic.evidence.workflowLanes, lanes);
+ assert.match(diagnostic.evidence.measurement, /not guaranteed removable/);
+ assert.match(diagnostic.supportedFixes.join('\n'), /--layout-json/);
+ assert.match(diagnostic.supportedFixes.join('\n'), /ownership and explicit geometry permit/);
+ assert.match(diagnostic.supportedFixes.join('\n'), /not a verified coordinate fix/);
+ assert.equal(sha256(file), before);
+ browser.inspect = async (args) => ({ ...(await inspect(args)), scrollWidth: args.width + 1, workflowLanes: lanes });
+ const horizontal = await runVisualCheck({ artifactPath: file, chromePath: '/fake/chrome', browserFactory: async () => browser });
+ const horizontalOverflow = horizontal.receipt.diagnostics.find(({ code }) => code === 'viewer/viewport-overflow');
+ assert.equal(horizontalOverflow.evidence.workflowLanes, undefined);
+ assert.equal(horizontalOverflow.supportedFixes.length, 1);
+});