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(checker): handle large clearance receipt sets
Oleksandr Mekhovove5d158ffdee8
diff --git a/archify.zip b/archify.zipindex f7fdf0f8..fdc10ac1 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/renderers/shared/geometry.mjs b/archify/renderers/shared/geometry.mjsindex 733129c2..102e6f82 100644--- a/archify/renderers/shared/geometry.mjs+++ b/archify/renderers/shared/geometry.mjs@@ -167,6 +167,15 @@ export function collectLabelRouteClearance({ labels, routedRelations, thresholdreturn hits;}+export function minimumLabelRouteClearance(measurements) {+ if (!asArray(measurements).length) return null;+ const minimum = measurements.reduce(+ (value, hit) => Math.min(value, hit.clearance),+ Infinity,+ );+ return Math.round(minimum * 10) / 10;+}+function relationshipIdentity(relation, relationIndex) {if (relation?.key !== undefined) return `key:${relation.key}`;if (relation?.id) return `id:${relation.from || ''}\u0000${relation.to || ''}\u0000${relation.id}`;diff --git a/archify/scripts/check-render-output.mjs b/archify/scripts/check-render-output.mjsindex f7149687..e7fb6181 100644--- a/archify/scripts/check-render-output.mjs+++ b/archify/scripts/check-render-output.mjs@@ -2,7 +2,7 @@import fs from 'node:fs';import path from 'node:path';-import { collectAmbiguousCorridors, collectBorderRuns, collectLabelRouteClearance, collectRouteRhythmIssues, routeBudgetMetrics } from '../renderers/shared/geometry.mjs';+import { collectAmbiguousCorridors, collectBorderRuns, collectLabelRouteClearance, collectRouteRhythmIssues, minimumLabelRouteClearance, routeBudgetMetrics } from '../renderers/shared/geometry.mjs';import {DESKTOP_READABILITY_VIEWPORT,DESKTOP_READER_DIAGRAM_WIDTH,@@ -170,9 +170,7 @@ if (svgMatches.length === 1) {ambiguousCorridors: ambiguousCorridors.length,containerBorderRuns: containerBorderRuns.length,labelRouteClearanceIssues: labelRouteClearance.length,- minLabelRouteClearance: labelRouteMeasurements.length- ? Math.round(Math.min(...labelRouteMeasurements.map((hit) => hit.clearance)) * 10) / 10- : null,+ minLabelRouteClearance: minimumLabelRouteClearance(labelRouteMeasurements),desktopReadabilityIssues: desktopReadabilityIssue ? 1 : 0,minProjectedNodeTextPx: desktopReadabilityIssue?.projectedFontPx ?? null,...roundedRouteMetrics(routeMetrics),diff --git a/archify/test/geometry.test.mjs b/archify/test/geometry.test.mjsindex 2b93f8c4..768f8a50 100644--- a/archify/test/geometry.test.mjs+++ b/archify/test/geometry.test.mjs@@ -13,6 +13,7 @@ import {segmentRectClearance,segmentRectIntersectionLength,collectLabelRouteClearance,+ minimumLabelRouteClearance,cleanEndpointSideProblems,cleanFlowProblems,cleanCrossingProblems,@@ -151,6 +152,15 @@ test('collectLabelRouteClearance exempts only the owning relationship at an exacassert.equal(hits[0].otherRelation, sharedSource);});+test('minimumLabelRouteClearance handles receipt sets above the argument limit', () => {+ const measurements = Array.from(+ { length: 200_000 },+ (_, index) => ({ clearance: index === 199_999 ? 1.24 : 9.87 }),+ );+ assert.equal(minimumLabelRouteClearance(measurements), 1.2);+ assert.equal(minimumLabelRouteClearance([]), null);+});+test('endpoint-side direction distinguishes perpendicular entry from a tangent border run', () => {const clean = [[350, 160], [350, 200], [150, 200], [150, 240]];const tangent = [[350, 160], [350, 200], [100, 200], [100, 240], [150, 240]];