Skip to content

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

Keep stale manuscript comments scoped

[._.]/ Adam Eivy923b5344eda2
diff --git a/server/services/pipeline/manuscriptEditor.test.js b/server/services/pipeline/manuscriptEditor.test.js
index 2132c8b729..4349f9bb46 100644
--- a/server/services/pipeline/manuscriptEditor.test.js
+++ b/server/services/pipeline/manuscriptEditor.test.js
@@ -236,6 +236,27 @@ describe('manuscriptFix', () => {
expect(afterOther.stages.prose.output).toBe('Other series text.');
});
+ it('does not broaden a stale issue-numbered comment to the full manuscript', async () => {
+ const { s, issue } = await setupSeriesWithDraft();
+ const issue2 = await issuesSvc.createIssue({
+ seriesId: s.id, number: 2, title: 'Two', arcPosition: 2,
+ stages: { prose: { output: 'Issue two text.', status: 'ready' } },
+ });
+ const seeded = await review.seedReviewFromFindings(s.id, [finding()]);
+ await issuesSvc.updateIssue(issue.id, { stages: { prose: { output: '', status: 'empty' } } });
+
+ await expect(
+ fixer.acceptManuscriptFix(s.id, {
+ commentId: seeded.comments[0].id,
+ find: 'Issue two text.',
+ replace: 'Wrongly changed.',
+ }),
+ ).rejects.toMatchObject({ code: 'PIPELINE_MANUSCRIPT_FIX_VALIDATION' });
+
+ const after2 = await issuesSvc.getIssue(issue2.id);
+ expect(after2.stages.prose.output).toBe('Issue two text.');
+ });
+
it('validates every multi-section anchor before writing any section', async () => {
const { s, issue } = await setupSeriesWithDraft('First anchor.');
const issue2 = await issuesSvc.createIssue({
diff --git a/server/services/pipeline/manuscriptFix.js b/server/services/pipeline/manuscriptFix.js
index b23620d6d8..0e994a73fb 100644
--- a/server/services/pipeline/manuscriptFix.js
+++ b/server/services/pipeline/manuscriptFix.js
@@ -64,6 +64,10 @@ async function resolveTargets(seriesId, comment) {
if (comment.issueNumber != null) {
const section = sections.find((s) => s.number === comment.issueNumber);
if (section) return [section];
+ throw makeErr(
+ 'This comment points to an issue that no longer has drafted manuscript text — regenerate the editorial review',
+ ERR_VALIDATION,
+ );
}
if (sections.length) return sections;
throw makeErr('No drafted manuscript text is available to edit', ERR_VALIDATION);