Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): flag objects whose only attachment dangles at a deleted character
[._.]/ Adam Eivy525f9360c2d4
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex 8c1b62f514..cea1c6d859 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -382,12 +382,17 @@ export const EDITORIAL_CHECKS = [defaultEnabled: true,configSchema: z.object({}),run: (ctx) => {- const { objects } = attachmentCanon(ctx);+ const { objects, nameById } = attachmentCanon(ctx);const findings = [];for (const o of objects) {- const hasAttachment = Array.isArray(o.attachments) && o.attachments.length > 0;+ // Only a LIVE attachment (one whose characterId still resolves to a+ // cast member) counts as "someone cares" — an object whose sole+ // attachment dangles at a deleted character is effectively unattached+ // (the UI shows it as "(missing)"), so it should still be flagged.+ const attachments = Array.isArray(o.attachments) ? o.attachments : [];+ const hasLiveAttachment = attachments.some((a) => a?.characterId && nameById.has(a.characterId));const significance = (o.significance || '').trim();- if (hasAttachment || !significance) continue;+ if (hasLiveAttachment || !significance) continue;const name = o.name || o.id;findings.push({severity: ctx.severityDefault,diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex 5a0ae13189..6e6049bc01 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -322,8 +322,8 @@ describe('relationships.opposition-reversal — deterministic advisory', () => {});describe('objects.unattached-significant — deterministic check (#1288)', () => {- const run = (objects) =>- getCheck('objects.unattached-significant').run({ canon: { objects }, config: {}, severityDefault: 'low' });+ const run = (objects, characters = []) =>+ getCheck('objects.unattached-significant').run({ canon: { objects, characters }, config: {}, severityDefault: 'low' });it('flags an object with significance but no attachments', () => {const findings = run([@@ -335,13 +335,25 @@ describe('objects.unattached-significant — deterministic check (#1288)', () =>expect(findings[0].problem).toMatch(/mean to anyone/i);});- it('does not flag an object that has at least one attachment', () => {- const findings = run([- { id: 'o1', name: 'Pocket Watch', significance: 'matters', attachments: [{ characterId: 'c1' }] },- ]);+ it('does not flag an object whose attachment resolves to a live character', () => {+ const findings = run(+ [{ id: 'o1', name: 'Pocket Watch', significance: 'matters', attachments: [{ characterId: 'c1' }] }],+ [{ id: 'c1', name: 'Mara' }],+ );expect(findings).toEqual([]);});+ it('flags an object whose only attachment dangles at a deleted character', () => {+ // The character was deleted, leaving a "(missing)" attachment — the object+ // is effectively unattached, so it must still surface.+ const findings = run(+ [{ id: 'o1', name: 'Pocket Watch', significance: 'matters', attachments: [{ characterId: 'gone' }] }],+ [{ id: 'c1', name: 'Mara' }],+ );+ expect(findings).toHaveLength(1);+ expect(findings[0].location).toContain('Pocket Watch');+ });+it('does not flag an object with no significance (pure set dressing)', () => {const findings = run([{ id: 'o1', name: 'A Chair' }]);expect(findings).toEqual([]);