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 exact normalized name collisions + honor edit-distance always-flag
[._.]/ Adam Eivybcf47ad7e521
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex b1f79eff08..3756184017 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -738,18 +738,41 @@ export const EDITORIAL_CHECKS = [const a = tokens[i];const b = tokens[j];if (a.owner === b.owner) continue;+ // Exact normalized collision — two DIFFERENT characters whose names+ // (or an alias) reduce to the same letters once case/punctuation are+ // stripped ("Anne-Marie" / "Anne Marie", or an alias matching another's+ // name). This is the strongest confusion case, so flag it at top severity+ // regardless of the shared-signal threshold (analyzeNamePair treats equal+ // forms as inert, so it's handled here where owner identity is known).+ const na = normalizeName(a.token);+ if (na && na === normalizeName(b.token)) {+ findings.push({+ severity: escalateSeverity(ctx.severityDefault, 2),+ category: 'naming',+ location: `Characters: ${a.ownerName} / ${b.ownerName}`,+ problem: `Character names "${tokenLabel(a)}" and "${tokenLabel(b)}" are identical once case and punctuation are ignored — readers cannot tell them apart.`,+ suggestion: renameSuggestion(a, b),+ anchorQuote: a.token,+ issueNumber: null,+ });+ continue;+ }// Single pass yields the signals AND the severity metrics (edit distance,// phonetic match) so neither is recomputed below.const { signals, distance, phoneticMatch } = analyzeNamePair(a.token, b.token, signalOpts);- // The user-controlled shared-signal count is the single gate (edit- // distance and phonetic match are already among the counted signals).- if (signals.length < min) continue;+ // A near-typo (within the enabled edit-distance threshold) ALWAYS flags —+ // the minEditDistance knob is documented as "Always flag", so it bypasses+ // the shared-signal gate. Otherwise the user-controlled shared-signal+ // count is the gate (phonetic match is a counted signal, not a bypass —+ // Soundex is coarse, so always-flagging it would be noisy).+ const withinEdit = signalOpts.minEditDistance > 0 && distance <= signalOpts.minEditDistance;+ if (!withinEdit && signals.length < min) continue;// Severity scales with how confusable the pair really is, above the- // check's low floor: a near-typo (edit distance ≤1, only when the- // edit-distance signal is enabled) escalates 2, a phonetic match or 4+- // signals is strong (escalate 1).- const nearTypo = signalOpts.minEditDistance > 0 && distance <= 1;- const steps = nearTypo ? 2 : (phoneticMatch || signals.length >= 4 ? 1 : 0);+ // check's low floor: a near-identical pair (edit distance ≤1, edit-distance+ // enabled) escalates 2; a wider near-typo, a phonetic match, or 4+ signals+ // is strong (escalate 1).+ const nearIdentical = signalOpts.minEditDistance > 0 && distance <= 1;+ const steps = nearIdentical ? 2 : (withinEdit || phoneticMatch || signals.length >= 4 ? 1 : 0);findings.push({severity: escalateSeverity(ctx.severityDefault, steps),category: 'naming',diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex 222904e4f7..7c7c34b03a 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -359,6 +359,36 @@ describe('naming.dissimilar-names — deterministic check', () => {expect(sparse.find((f) => f.location.startsWith('Characters starting with'))).toBeFalsy();});+ it('flags exact normalized collisions between different characters at top severity', () => {+ const findings = run([+ { id: 'a', name: 'Anne-Marie' },+ { id: 'b', name: 'Anne Marie' },+ ]);+ expect(findings.length).toBeGreaterThan(0);+ expect(findings[0].problem).toMatch(/identical once case and punctuation/);+ expect(findings[0].severity).toBe('high');+ });++ it('flags an alias that collides with another character\'s name', () => {+ const findings = run([+ { id: 'a', name: 'Robert', aliases: ['Bob'] },+ { id: 'b', name: 'Bob' },+ ]);+ const collision = findings.find((f) => f.problem.includes('identical once case and punctuation'));+ expect(collision).toBeTruthy();+ expect(collision.problem).toMatch(/alias of Robert/);+ });++ it('always flags a near-typo within minEditDistance even when minSharedSignals is high', () => {+ // Alina/Alana share ~5 signals; with minSharedSignals 7 the shared-signal gate+ // would drop them, but minEditDistance=1 is documented as "always flag".+ const findings = run([{ name: 'Alina' }, { name: 'Alana' }], { minSharedSignals: 7, minEditDistance: 1 });+ expect(findings.length).toBe(1);+ expect(findings[0].severity).toBe('high');+ // Turning the edit-distance signal off (0) restores the pure shared-signal gate.+ expect(run([{ name: 'Alina' }, { name: 'Alana' }], { minSharedSignals: 7, minEditDistance: 0 })).toEqual([]);+ });+it('disables first-letter crowding when the ratio is set to 0', () => {const findings = run([{ name: 'Sam' }, { name: 'Sid' }, { name: 'Sky' }],