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): make the reformat integrity skeleton case-sensitive
[._.]/ Adam Eivy280dc9ec2da3
diff --git a/server/services/pipeline/manuscriptFix.js b/server/services/pipeline/manuscriptFix.jsindex 183361a6ca..8470e1b42d 100644--- a/server/services/pipeline/manuscriptFix.js+++ b/server/services/pipeline/manuscriptFix.js@@ -348,11 +348,12 @@ export async function saveManuscriptSection(seriesId, { issueId, stageId, outputconst MANUSCRIPT_FORMAT_LABEL = { prose: 'Prose', comicScript: 'Comic script', teleplay: 'Teleplay' };-// Letters + digits only, lowercased — the "skeleton" a pure reformat preserves.-// Reformatting only moves whitespace and re-attaches quotation marks, so the-// letter/digit sequence is (near) identical before and after; comparing-// skeletons is how we prove the model didn't rewrite the prose.-const wordSkeleton = (s) => (typeof s === 'string' ? s.replace(/[^\p{L}\p{N}]+/gu, '').toLowerCase() : '');+// Letters + digits only, CASE-PRESERVING — the "skeleton" a pure reformat+// leaves identical. No reformat operation (reflow, de-hyphenation, drop-cap+// rejoin, quote re-attachment) changes letter case, so we compare+// case-sensitively: a case-only rewrite ("US" → "us", a de-capitalized name) is+// a wording change and must be rejected too.+const wordSkeleton = (s) => (typeof s === 'string' ? s.replace(/[^\p{L}\p{N}]+/gu, '') : '');// Reject any reformat that altered the actual wording. A pure reformat only// moves whitespace and quotation-mark/punctuation glyphs (all non-alphanumeric)diff --git a/server/services/pipeline/manuscriptReformat.test.js b/server/services/pipeline/manuscriptReformat.test.jsindex 625386bcf4..988b35f8bb 100644--- a/server/services/pipeline/manuscriptReformat.test.js+++ b/server/services/pipeline/manuscriptReformat.test.js@@ -60,6 +60,12 @@ describe('reformatManuscriptText — integrity guard', () => {.rejects.toThrow(/changed the wording/i);});+ it('rejects a case-only rewrite (the skeleton is case-sensitive)', async () => {+ runStagedLLM.mockResolvedValue({ content: 'the us economy.', runId: 'r1' });+ await expect(reformatManuscriptText('the US\neconomy.', { stageId: 'prose' }))+ .rejects.toThrow(/changed the wording/i);+ });+it('rejects a dropped clause', async () => {const input = 'The pool hums softly. The nebula churns in slow motion outside the wide viewport.';runStagedLLM.mockResolvedValue({ content: 'The pool hums softly.', runId: 'r1' });