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
Reject incomplete legacy manuscript accepts
[._.]/ Adam Eivy37b9a3b7914d
diff --git a/server/routes/pipeline.js b/server/routes/pipeline.jsindex b3060c86d8..06062e7c82 100644--- a/server/routes/pipeline.js+++ b/server/routes/pipeline.js@@ -608,6 +608,9 @@ const manuscriptFixAcceptSchema = z.object({edits: z.array(manuscriptFixEditSchema).max(20).optional(),}).refine((v) => (Array.isArray(v.edits) && v.edits.length > 0) || !!v.find, {message: 'Provide find/replace or at least one edit',+}).refine((v) => !v.find || typeof v.replace === 'string', {+ path: ['replace'],+ message: 'replace is required when find is provided',});// Comment PATCH: status flip and/or attach/clear a fix. `.strict()` rejects// stray keys; `fix` nullable so an explicit clear is distinguishable from absent.diff --git a/server/routes/pipeline.test.js b/server/routes/pipeline.test.jsindex 439a67e314..c4b8b777c3 100644--- a/server/routes/pipeline.test.js+++ b/server/routes/pipeline.test.js@@ -2108,6 +2108,11 @@ describe('pipeline routes', () => {.post(`/api/pipeline/series/${ser.body.id}/manuscript/review/comments/mrc-nope/accept`).send({ replace: 'x' }); // missing required `find`expect(accept.status).toBe(400);++ const acceptMissingReplace = await request(app)+ .post(`/api/pipeline/series/${ser.body.id}/manuscript/review/comments/mrc-nope/accept`)+ .send({ find: 'x' }); // legacy accept must still include `replace`+ expect(acceptMissingReplace.status).toBe(400);});});diff --git a/server/services/pipeline/manuscriptEditor.test.js b/server/services/pipeline/manuscriptEditor.test.jsindex 6c0f4e1837..1b7a898868 100644--- a/server/services/pipeline/manuscriptEditor.test.js+++ b/server/services/pipeline/manuscriptEditor.test.js@@ -152,6 +152,18 @@ describe('manuscriptFix', () => {expect(after.stages.prose.output).toBe('The hero walked in. She left, but paused.');});+ it('acceptManuscriptFix rejects legacy find-only accepts instead of deleting text', async () => {+ const { s, issue } = await setupSeriesWithDraft();+ const seeded = await review.seedReviewFromFindings(s.id, [finding()]);++ await expect(+ fixer.acceptManuscriptFix(s.id, { commentId: seeded.comments[0].id, find: 'She left.' }),+ ).rejects.toMatchObject({ code: 'PIPELINE_MANUSCRIPT_FIX_VALIDATION' });++ const after = await issuesSvc.getIssue(issue.id);+ expect(after.stages.prose.output).toBe('The hero walked in. She left.');+ });+it('acceptManuscriptFix targets the occurrence nearest the anchorQuote when find is ambiguous', async () => {// "the door" appears twice; the comment anchors the SECOND one.const { s, issue } = await setupSeriesWithDraft('She opened the door. Later, she slammed the door shut.');diff --git a/server/services/pipeline/manuscriptFix.js b/server/services/pipeline/manuscriptFix.jsindex 99001dd1fa..f01a83da6a 100644--- a/server/services/pipeline/manuscriptFix.js+++ b/server/services/pipeline/manuscriptFix.js@@ -151,12 +151,15 @@ function editsFromAcceptRequest({ comment, find, replace, edits }) {})).filter((e) => e.find);}if (find) {+ if (typeof replace !== 'string') {+ throw makeErr('replace is required when find is provided', ERR_VALIDATION);+ }return [{issueId: comment.issueId,stageId: comment.stageId,issueNumber: comment.issueNumber,find,- replace: typeof replace === 'string' ? replace : '',+ replace,}];}return [];