Skip to content

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

Merge current dev Passport repair into renderer batch

tt-a1iee72e1072c4e
diff --cc archify/test/semantic-passport.test.mjs
index d5699801,5997c803..32c4e3b4
--- a/archify/test/semantic-passport.test.mjs
+++ b/archify/test/semantic-passport.test.mjs
@@@ -83,22 -128,64 +128,78 @@@ test('Relationship Lens renders one Sem
assert.match(html, /target\.closest\('\[data-node-id\], \[data-relationship-hit-key\], \.overview-map'\)/);
assert.match(html, /document\.addEventListener\('click',[\s\S]+?clear\(\);\s+\}, true\);/);
assert.match(html, /Archify\.focus\.clear\(\{ restoreFocus: true \}\)/);
+ assert.match(html, /renderRelationshipLens\(normalized\[0\],\s*byId\);\s*placeRelationshipLens\(\);/);
+ assert.match(html, /applyReachability[\s\S]*?placeRelationshipLens\(\);/);
+ assert.match(html, /clearRelationshipPreview[\s\S]*?renderRelationshipCopyAction\(\);\s*placeRelationshipLens\(\);/);
+ assert.match(html, /previewRelationship[\s\S]*?renderRelationshipPulse\(key\);\s*placeRelationshipLens\(\);/);
+ assert.match(html, /relationsBtn\.addEventListener\('click'[\s\S]*?placeRelationshipLens\(\);/);
+ assert.match(html, /reposition:\s*placeRelationshipLens/);
+ });
+
+ test('semantic passport computes and applies target top synchronously on open and switch without a 1-frame snap', {
+ skip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',
+ }, async () => {
+ const artifact = path.join(tmp, 'passport-synchronous-placement.html');
+ execFileSync(process.execPath, [
+ path.join(skillRoot, 'bin', 'archify.mjs'),
+ 'render',
+ 'architecture',
+ path.join(skillRoot, 'examples', CASES.architecture),
+ artifact,
+ ]);
+ const browser = new ChromeVisualBrowser(chromePath);
+ try {
+ const sessionId = await loadArtifact(browser, artifact, { width: 1440, height: 900 });
+ const result = await evaluate(browser, sessionId, `(function () {
+ var chip = document.getElementById('focus-chip');
+ var initialHidden = chip.hidden;
+ var initialTop = chip.style.top;
+
+ // Focus node 'auth' (top rank): must compute and apply top synchronously before next paint
+ Archify.focus.set('auth', { toggle: false });
+ var synchronousTopAuth = chip.style.top;
+ var hiddenAuth = chip.hidden;
+
+ // Switch focus to node 's3' (bottom rank): must update top synchronously without stale 1-frame delay
+ Archify.focus.set('s3', { toggle: false });
+ var synchronousTopS3 = chip.style.top;
+ var hiddenS3 = chip.hidden;
+
+ return {
+ initialHidden: initialHidden,
+ initialTop: initialTop,
+ synchronousTopAuth: synchronousTopAuth,
+ hiddenAuth: hiddenAuth,
+ synchronousTopS3: synchronousTopS3,
+ hiddenS3: hiddenS3
+ };
+ })()`);
+
+ assert.equal(result.initialHidden, true);
+ assert.equal(result.hiddenAuth, false);
+ assert.notEqual(result.synchronousTopAuth, '', 'passport target position must land synchronously before next paint');
+ assert.equal(result.hiddenS3, false);
+ assert.notEqual(result.synchronousTopS3, '', 'switched passport target position must land synchronously');
+ assert.notEqual(result.synchronousTopAuth, result.synchronousTopS3, 'target positions for different nodes must differ');
+ } finally {
+ await browser.close().catch(() => {});
+ }
});
+test('committed lifecycle focus hides the non-semantic primary rail', () => {
+ const html = render('lifecycle', CASES.lifecycle);
+ const diagram = svg(html);
+ const rail = diagram.match(/<path\b[^>]*data-lifecycle-rail[^>]*>/)?.[0] || '';
+
+ assert.ok(rail, 'lifecycle: expected the primary decorative rail to be identifiable');
+ assert.doesNotMatch(rail, /data-edge-from|data-edge-to/, 'the rail must remain non-semantic');
+ assert.match(
+ html,
+ /svg\[data-focus-active\] \[data-lifecycle-rail\]\s*\{\s*opacity:\s*0;/,
+ 'committed node focus must not expose the decorative rail through dimmed nodes',
+ );
+});
+
test('Node Finder searches and presents the same passport facts', () => {
const html = render('dataflow', CASES.dataflow);
assert.match(html, /var authored = node\.getAttribute\('data-node-kind'\)/);