Skip to content

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

fix(delta): report brand and locale changes in architecture comparisons (#415)

kape5eea9c369b3f
diff --git a/archify.zip b/archify.zip
index a4963eb5..5902a52a 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/delta/architecture-delta.mjs b/archify/delta/architecture-delta.mjs
index dddf3cc8..5bd54a70 100644
--- a/archify/delta/architecture-delta.mjs
+++ b/archify/delta/architecture-delta.mjs
@@ -155,7 +155,7 @@ function fieldChanges(before, after, groups) {
}
const COMPONENT_FIELDS = {
- semantic: ['type', 'label', 'sublabel', 'tag'],
+ semantic: ['type', 'label', 'sublabel', 'tag', 'brand'],
evidence: ['sources'],
geometry: ['row', 'col', 'pos', 'size'],
};
@@ -202,6 +202,7 @@ function summaryFor(changes, shape) {
function presentationChanged(base, head) {
const basePresentation = {
title: base.meta?.title,
+ locale: base.meta?.locale,
subtitle: base.meta?.subtitle,
animation: base.meta?.animation,
visual_preset: base.meta?.visual_preset,
@@ -215,6 +216,7 @@ function presentationChanged(base, head) {
};
const headPresentation = {
title: head.meta?.title,
+ locale: head.meta?.locale,
subtitle: head.meta?.subtitle,
animation: head.meta?.animation,
visual_preset: head.meta?.visual_preset,
diff --git a/archify/test/architecture-delta.test.mjs b/archify/test/architecture-delta.test.mjs
index 5c6a333b..7f35bca3 100644
--- a/archify/test/architecture-delta.test.mjs
+++ b/archify/test/architecture-delta.test.mjs
@@ -106,6 +106,49 @@ test('canonical architecture ignores formatting, entity order, and set-like orde
assert.equal(canonicalArchitectureJson(reordered), canonicalArchitectureJson(original));
});
+test('compare reports brand-only changes in the receipt and exact review target', () => {
+ const base = {
+ schema_version: 1,
+ diagram_type: 'architecture',
+ meta: { title: 'Cache' },
+ components: [{ id: 'cache', type: 'database', label: 'Cache', pos: [100, 100], size: [160, 80] }],
+ };
+ const basePath = path.join(tmp, 'brand-base.json');
+ const headPath = path.join(tmp, 'brand-head.json');
+ const output = path.join(tmp, 'brand-delta.html');
+ for (const [before, after] of [[undefined, 'redis'], ['redis', 'postgresql'], ['redis', undefined]]) {
+ const head = structuredClone(base);
+ base.components[0].brand = before;
+ head.components[0].brand = after;
+ fs.writeFileSync(basePath, JSON.stringify(base));
+ fs.writeFileSync(headPath, JSON.stringify(head));
+
+ const result = run(['compare', 'architecture', basePath, headPath, output, '--json']);
+ assert.equal(result.status, 0, result.stderr);
+ const receipt = JSON.parse(result.stdout);
+ assert.equal(receipt.summary.components.changed, 1);
+ assert.deepEqual(receipt.changes.components[0].classifications, ['semantic']);
+ assert.deepEqual(receipt.changes.components[0].changedFields, ['/brand']);
+ const html = fs.readFileSync(output, 'utf8');
+ assert.match(html, /data-change-key="component:cache"/);
+ assert.deepEqual(validateArchitectureDeltaHtml(html, receipt), { ok: true, checksPassed: 10, checkCount: 10 });
+ }
+});
+
+test('compare reports locale-only changes as presentation changes', () => {
+ const head = read(baseFixture);
+ head.meta.locale = 'zh-CN';
+ const headPath = path.join(tmp, 'locale-head.json');
+ const output = path.join(tmp, 'locale-delta.html');
+ fs.writeFileSync(headPath, JSON.stringify(head));
+
+ const result = run(['compare', 'architecture', baseFixture, headPath, output, '--json']);
+ assert.equal(result.status, 0, result.stderr);
+ const receipt = JSON.parse(result.stdout);
+ assert.equal(receipt.summary.presentationChanged, true);
+ assert.deepEqual(receipt.changes, { components: [], connections: [], boundaries: [] });
+});
+
test('change navigator order is exact-ID based, complete, unique, and stable', () => {
const receipt = compareArchitecture(read(baseFixture), read(headFixture));
const rows = architectureDeltaChangeRows(receipt);