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 (claude): strengthen representation-balance test coverage
Adam Eivy1d06ae4cd018
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex 91cdd0af64..f7d01d0a9d 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -3201,6 +3201,26 @@ describe('cast.representation-balance — deterministic check (#1312)', () => {expect(screenTime(findings)).toBeUndefined();});+ it('treats a primary+secondary set (she/they) as the primary gender, not ambiguous', () => {+ // inferGender resolves "she/they" to female (a definite identity with a+ // secondary set), unlike "she/he" which is genuinely ambiguous → unknown.+ // Pin that contract via the screen-time signal: two she/they characters+ // count as 2 known-female, so an all-female roster trips the skew.+ const canon = {+ characters: [+ { name: 'Aria', pronouns: 'she/they' },+ { name: 'Mara', pronouns: 'she/her' },+ ],+ };+ const findings = runRep(canon, {+ sections: [sec(1, 'Aria and Mara spoke at dawn.')],+ config: only({ maxGenderShare: 0.7 }),+ });+ const f = screenTime(findings);+ expect(f).toBeTruthy();+ expect(f.problem).toMatch(/100% are female/);+ });+it('gate requires at least one named canon character', () => {const c = getCheck(REP);expect(c.gate({ canon: { characters: [] } })).toBeFalsy();diff --git a/server/lib/editorial/dialogue.test.js b/server/lib/editorial/dialogue.test.jsindex 81dfc1406b..edfda7b7de 100644--- a/server/lib/editorial/dialogue.test.js+++ b/server/lib/editorial/dialogue.test.js@@ -205,20 +205,21 @@ describe('attributeDialogueByOwner', () => {});it('credits a dialogue line to the owner named in the beat, not inside the quote', () => {- const text = [- '"I saw Bram at the gate," said Aria.',- '"Then we move tonight," Bram replied.',- ].join('\n');+ // Discriminating: the quote names "Aria" but the BEAT names "Bram", and the+ // owner list is ordered [aria, bram] so first-match-wins favors the in-quote+ // name. Correct (beat-only) attribution credits Bram; a regression that+ // matched the whole paragraph (quote not stripped) would credit Aria — so+ // this assertion actually fails if the quote-strip is removed.+ const text = '"I saw Aria at the gate," said Bram.';const { byOwner, total, attributed, unattributed } = attributeDialogueByOwner(text, [owner('aria', 'Aria'),owner('bram', 'Bram'),]);- expect(total).toBe(2);- expect(attributed).toBe(2);+ expect(total).toBe(1);+ expect(attributed).toBe(1);expect(unattributed).toBe(0);- // Line 1 names "Bram" inside the quote but "Aria" in the beat → credited to Aria.- expect(byOwner.get('aria')).toBe(1);expect(byOwner.get('bram')).toBe(1);+ expect(byOwner.has('aria')).toBe(false);});it('counts a dialogue line with no resolvable speaker as unattributed', () => {