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(erd): check domain bands against tables belonging to other domains
tt-a1i4f8e3d9e4f07
diff --git a/archify.zip b/archify.zipindex 840bb367..00d272f9 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/renderers/erd/render-erd.mjs b/archify/renderers/erd/render-erd.mjsindex f14db426..24034323 100644--- a/archify/renderers/erd/render-erd.mjs+++ b/archify/renderers/erd/render-erd.mjs@@ -953,8 +953,8 @@ function validateEr() {// A band claims the box it covers. With gaps smaller than the band padding the// box reaches a table the domain does not own, which is the same false claim as// a band drawn across a gap.- const memberIds = new Set([...domainGroups.flatMap((group) => group.members)].map((entity) => entity.id));for (const { tag, members } of domainGroups) {+ const memberIds = new Set(members.map((entity) => entity.id));const box = domainBandBox(members);const intruder = [...entities.values()].find((entity) => !memberIds.has(entity.id)&& entity.x < box.x + box.width && entity.x + entity.width > box.xdiff --git a/archify/test/erd-rendering.test.mjs b/archify/test/erd-rendering.test.mjsindex 4c583cdd..77999589 100644--- a/archify/test/erd-rendering.test.mjs+++ b/archify/test/erd-rendering.test.mjs@@ -1109,3 +1109,32 @@ test('a domain that cannot be drawn as a band stops the render instead of losingconst untaggedRun = render(untagged, untaggedDirectory);assert.equal(untaggedRun.status, 0, untaggedRun.stderr);});+++test('a domain band rejects intrusion into another tagged domain', () => {+ const input = cloneWithoutViews(example);+ input.entities = ['alpha', 'beta'].map((id, col) => ({+ id, label: id, tag: `${id} domain`, row: 0, col,+ attributes: [{ name: 'id', type: 'bigint', key: 'pk' }],+ }));+ input.relationships = [];+ input.cards = [];+ for (const orientation of ['horizontal', 'vertical']) {+ input.layout = { mode: 'grid', gapX: 1, gapY: 1 };+ input.entities.forEach((entity, index) => {+ entity.row = orientation === 'vertical' ? index : 0;+ entity.col = orientation === 'horizontal' ? index : 0;+ });+ const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-intrusion-'));+ const rejected = render(input, directory);+ assert.notEqual(rejected.status, 0, `${orientation}: tagged neighbours must not bypass membership checking`);+ assert.match(rejected.stderr + rejected.stdout, /erd\/domain-not-drawn/);+ assert.match(rejected.stderr + rejected.stdout, /cover the unrelated table/);+ assert.equal(fs.existsSync(rejected.output), false);+ input.layout.gapX = 72;+ input.layout.gapY = 38;+ const spacedDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-er-domain-separated-'));+ const spaced = render(input, spacedDirectory);+ assert.equal(spaced.status, 0, spaced.stderr);+ }+});