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

fix: refresh subtype on re-surfaced on-the-nose findings, not just appended ones (#1626)

[._.]/ Adam Eivyb99c21c629b4
diff --git a/server/services/pipeline/manuscriptReview.js b/server/services/pipeline/manuscriptReview.js
index e9ee535aed..36b6d59cab 100644
--- a/server/services/pipeline/manuscriptReview.js
+++ b/server/services/pipeline/manuscriptReview.js
@@ -379,6 +379,14 @@ export async function seedReviewFromFindings(seriesId, findings, { runId = null,
patch.sourceContentHash = match.sourceContentHash;
refreshedCount += 1;
}
+ // Adopt the run's subtype (#1626) so a finding first raised before the
+ // on-the-nose check sub-classified its output gains the label on the next
+ // run without the user having to clear it — the finding key is unchanged,
+ // so the merge path (not the append path) is the only place it can land.
+ if ((match.subtype ?? null) !== (c.subtype ?? null)) {
+ patch.subtype = match.subtype ?? null;
+ refreshedCount += 1;
+ }
}
if (Object.keys(patch).length === 0) return c;
return sanitizeComment({ ...c, ...patch, updatedAt: now });
diff --git a/server/services/pipeline/manuscriptReview.test.js b/server/services/pipeline/manuscriptReview.test.js
index fe3497bb57..3397b5d0a4 100644
--- a/server/services/pipeline/manuscriptReview.test.js
+++ b/server/services/pipeline/manuscriptReview.test.js
@@ -123,6 +123,25 @@ describe('manuscriptReview — record-event emission on write', () => {
expect(merged.comments.find((c) => c.id === 'mrc-st').subtype).toBeNull();
});
+ it('re-surfacing a finding adopts the run subtype on the existing comment (#1626)', async () => {
+ // A finding first raised BEFORE the on-the-nose check sub-classified its
+ // output — no subtype yet.
+ const seeded = await seedReviewFromFindings('ser-subtype-refresh', [
+ { checkId: 'dialogue.on-the-nose', category: 'dialogue', issueNumber: 3, problem: 'names the feeling', anchorQuote: 'I am angry' },
+ ]);
+ expect(seeded.comments[0].subtype).toBeNull();
+ const id = seeded.comments[0].id;
+
+ // The upgraded check re-reports the SAME finding (same key) now carrying a
+ // subtype — the merge path must adopt it onto the existing comment.
+ const next = await seedReviewFromFindings('ser-subtype-refresh', [
+ { checkId: 'dialogue.on-the-nose', category: 'dialogue', issueNumber: 3, subtype: 'emotion-tell', problem: 'names the feeling', anchorQuote: 'I am angry' },
+ ]);
+ const same = next.comments.find((c) => c.id === id);
+ expect(same).toBeDefined();
+ expect(same.subtype).toBe('emotion-tell');
+ });
+
it('persists replacementStrategy (explicit value, derived from category, and legacy fallback)', async () => {
const seeded = await seedReviewFromFindings('ser-4', [
{ category: 'comic-structure', problem: 'page is prose', suggestion: 'Panel 1 …', anchorQuote: 'PAGE 5' },