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(viewer): reduce or declare a 1px reader overflow remainder
tt-a1id5e97effe5b1
diff --git a/archify/assets/template.html b/archify/assets/template.htmlindex d6e38665..b647d248 100644--- a/archify/assets/template.html+++ b/archify/assets/template.html@@ -9752,11 +9752,13 @@ OTHER DEALINGS IN THE FONT SOFTWARE.document.documentElement.scrollHeight,document.body.scrollHeight) - window.innerHeight - belowFold();- if (overflow > 1 && !widthFirstReading && lastWidth > Math.ceil(minWidth)) {+ // visual-check fails any page whose rounded-up height exceeds the+ // viewport, so even a 1px remainder must be reduced or declared.+ if (overflow > 0 && !widthFirstReading && lastWidth > Math.ceil(minWidth)) {applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4), minWidth);settledCap = lastWidth;html.setAttribute('data-reader-overflow', 'reduced');- } else if (overflow > 1) {+ } else if (overflow > 0) {html.setAttribute('data-reader-overflow', 'authored');} else {html.removeAttribute('data-reader-overflow');diff --git a/test/desktop-reader-browser.test.mjs b/test/desktop-reader-browser.test.mjsindex ddf62c58..be6f3b30 100644--- a/test/desktop-reader-browser.test.mjs+++ b/test/desktop-reader-browser.test.mjs@@ -414,6 +414,32 @@ test('offline intrinsic workflows fit while authored overflow still identifies l}});+// Every unpinned three-lane, five-column workflow measures 528 viewBox units+// tall. Width-first reading enlarges it to 1.5x, so the 1600x1000 page ends+// 1px past the viewport. The Reader ignored overflow up to 1px while+// visual-check rejects any rounded-up remainder, so browser-check failed+// a first draft that every earlier gate had accepted.+test('a 1px width-first remainder is declared instead of failing browser containment', {+ skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',+}, async () => {+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-reader-remainder-'));+ try {+ const artifact = path.join(tmp, 'three-lane-remainder.html');+ execFileSync(process.execPath, [path.join(skillRoot, 'bin/archify.mjs'), 'deliver', 'workflow',+ path.join(skillRoot, '..', 'test', 'fixtures/workflow-viewport/three-lane-remainder.workflow.json'),+ artifact, '--quality', 'showcase', '--json'], { cwd: skillRoot });+ assert.match(fs.readFileSync(artifact, 'utf8'), /viewBox="0 0 \d+ 528" data-reader-fit="width-first"/);+ const result = await runVisualCheck({ artifactPath: artifact, chromePath });+ assert.equal(result.exitCode, 0, JSON.stringify(result.receipt));+ assert.equal(result.receipt.containment.status, 'pass');+ const tall = result.receipt.containment.viewports.find(({ width, height }) => width === 1600 && height === 1000);+ assert.ok(tall, JSON.stringify(result.receipt.containment));+ assert.ok(tall.scrollHeight <= tall.innerHeight || tall.readerOverflow === 'authored', JSON.stringify(tall));+ } finally {+ fs.rmSync(tmp, { recursive: true, force: true });+ }+});+test('issue #250 tall intrinsic workflow uses reading width and permits readable page scroll', {skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',}, async () => {diff --git a/test/fixtures/workflow-viewport/README.md b/test/fixtures/workflow-viewport/README.mdindex 26a1dac1..5850074c 100644--- a/test/fixtures/workflow-viewport/README.md+++ b/test/fixtures/workflow-viewport/README.md@@ -20,3 +20,14 @@ Rendered frame IDs are indices, not source ownership IDs. The diagnostic'scontained node boxes and blank-space measurements are observations, not proofthat 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.++## Three-lane remainder regression++`three-lane-remainder.workflow.json` is a minimal unpinned three-lane, five-column+workflow. It compiles to a 528-unit-tall width-first canvas, and the Reader's+1.5× enlargement turns it into a page exactly 1px taller than a 1600×1000+viewport. The Reader used to tolerate a 1px remainder while browser containment+rounds every remainder up, so each first draft of this shape failed only the+final browser gate, and the diagnostic told the author to pin a smaller viewBox.+The browser regression checks that the remainder is either reduced or declared as+authored reading overflow.diff --git a/test/fixtures/workflow-viewport/three-lane-remainder.workflow.json b/test/fixtures/workflow-viewport/three-lane-remainder.workflow.jsonnew file mode 100644index 00000000..8a7c5ccf--- /dev/null+++ b/test/fixtures/workflow-viewport/three-lane-remainder.workflow.json@@ -0,0 +1,23 @@+{+ "schema_version": 2,+ "diagram_type": "workflow",+ "meta": { "title": "Leave request", "quality_profile": "showcase", "output": "three-lane.html" },+ "lanes": [+ { "id": "staff", "label": "Employee" },+ { "id": "lead", "label": "Team lead" },+ { "id": "hr", "label": "HR" }+ ],+ "nodes": [+ { "id": "apply", "lane": "staff", "col": 0, "type": "frontend", "label": "Request leave" },+ { "id": "review", "lane": "lead", "col": 1, "type": "security", "label": "Approve" },+ { "id": "record", "lane": "hr", "col": 2, "type": "backend", "label": "Record" },+ { "id": "calendar", "lane": "hr", "col": 3, "type": "backend", "label": "Update calendar" },+ { "id": "notify", "lane": "staff", "col": 4, "type": "frontend", "label": "Notified" }+ ],+ "edges": [+ { "from": "apply", "to": "review", "label": "submit" },+ { "from": "review", "to": "record", "label": "approved" },+ { "from": "record", "to": "calendar" },+ { "from": "calendar", "to": "notify", "label": "notify" }+ ]+}diff --git a/viewer/reader-layout.js b/viewer/reader-layout.jsindex f0eaa922..567d2969 100644--- a/viewer/reader-layout.js+++ b/viewer/reader-layout.js@@ -297,11 +297,13 @@document.documentElement.scrollHeight,document.body.scrollHeight) - window.innerHeight - belowFold();- if (overflow > 1 && !widthFirstReading && lastWidth > Math.ceil(minWidth)) {+ // visual-check fails any page whose rounded-up height exceeds the+ // viewport, so even a 1px remainder must be reduced or declared.+ if (overflow > 0 && !widthFirstReading && lastWidth > Math.ceil(minWidth)) {applyWidth(Math.max(minWidth, lastWidth - overflow * ratio - 4), minWidth);settledCap = lastWidth;html.setAttribute('data-reader-overflow', 'reduced');- } else if (overflow > 1) {+ } else if (overflow > 0) {html.setAttribute('data-reader-overflow', 'authored');} else {html.removeAttribute('data-reader-overflow');