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 P2): re-grade existing open findings on override change (#1596)
[._.]/ Adam Eivye14a2e6b4d4b
diff --git a/server/services/pipeline/manuscriptReview.js b/server/services/pipeline/manuscriptReview.jsindex 2f40689ac3..15d0068435 100644--- a/server/services/pipeline/manuscriptReview.js+++ b/server/services/pipeline/manuscriptReview.js@@ -270,6 +270,16 @@ export async function seedReviewFromFindings(seriesId, findings, { runId = null,patch.sourceContentHash = match.sourceContentHash;refreshedCount += 1;}+ // Refresh the persisted severity to the current run's level (#1596): the+ // findingKey ignores severity, so a re-surfaced finding whose check now+ // carries a different per-check severity override would otherwise keep its+ // stale level — leaving the health score + severity gating reading the old+ // value. Mirrors the sourceContentHash refresh: the latest run's view of an+ // open finding wins.+ if (match.severity && match.severity !== c.severity) {+ patch.severity = match.severity;+ 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.jsindex 00b8e58a80..4109f7b729 100644--- a/server/services/pipeline/manuscriptReview.test.js+++ b/server/services/pipeline/manuscriptReview.test.js@@ -348,3 +348,31 @@ describe('manuscriptReview — sourceContentHash staleness fingerprint (#1345)',expect(second.comments[0].updatedAt).toBe(stamp); // unchanged — no rewrite});});++describe('manuscriptReview — severity refresh on re-surface (#1596)', () => {+ beforeEach(() => { fileStore.clear(); });++ it('re-grades an existing open comment when a re-surfaced finding carries a new severity', async () => {+ await seedReviewFromFindings('ser-sev', [+ { problem: 'adverb density', anchorQuote: 'quickly', checkId: 'prose.adverb-density', severity: 'low' },+ ]);+ // Same finding key (severity is NOT part of the key) re-surfaces from a run+ // whose check now carries a `high` per-check severity override.+ const second = await seedReviewFromFindings('ser-sev', [+ { problem: 'adverb density', anchorQuote: 'quickly', checkId: 'prose.adverb-density', severity: 'high' },+ ]);+ expect(second.comments).toHaveLength(1); // deduped, not appended+ expect(second.comments[0].severity).toBe('high'); // re-graded to the override level+ });++ it('does NOT churn updatedAt when the re-surfaced finding has the same severity', async () => {+ const first = await seedReviewFromFindings('ser-sev-nochurn', [+ { problem: 'adverb density', anchorQuote: 'quickly', checkId: 'prose.adverb-density', severity: 'high' },+ ]);+ const stamp = first.comments[0].updatedAt;+ const second = await seedReviewFromFindings('ser-sev-nochurn', [+ { problem: 'adverb density', anchorQuote: 'quickly', checkId: 'prose.adverb-density', severity: 'high' },+ ]);+ expect(second.comments[0].updatedAt).toBe(stamp); // unchanged — no rewrite+ });+});