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

feat: inline fix preview + accept/dismiss in editorial findings triage (#1598)

[._.]/ Adam Eivyacca9c0b7c5c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 94fbdc5ccc..d433f6475c 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -57,6 +57,8 @@
## Editorial checks
+- **[issue-1598] The findings triage list now previews, accepts, and dismisses a check finding inline — no deep-link into the manuscript editor per finding.** The Editorial Checks findings list only ever showed a finding's problem statement; to see (let alone apply) its suggested fix you had to open the manuscript editor one finding at a time, which made batch review impractical — 50 findings meant 50 context switches. Each open finding with a suggested fix now expands a **collapsed before/after diff** right in the triage row (reusing the manuscript card's `InlineDiff` and edit helpers, so the preview matches exactly what the editor would apply), with inline **Accept** and **Dismiss** buttons that apply or resolve the finding without leaving the page and update the list + health panel reactively. Heavier edits — rewriting the replacement text, cherry-picking individual edits within a multi-edit fix — still deep-link into the editor via an "Open in the editor" link. (`client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx`, `client/src/pages/PipelineEditorialChecks.jsx`)
+
- **[issue-1597] The editorial health panel now tracks each *check* over time, not just the overall score — a per-check finding-count sparkline that shows whether a given check is improving or regressing run-over-run.** The revision-trend ledger already snapshotted the open-finding counts by severity and category after every editorial-checks / completeness run, so the panel could draw an overall score sparkline and flag categories that regressed — but there was no way to see, say, whether the filter-word count is dropping draft-over-draft or whether name-similarity findings are creeping up as you add characters. Each trend snapshot now also records the open-finding count **per check**, and the Editorial Health panel renders an **Open by check** breakdown: every check with open findings, its current count, a magnitude sparkline of that check's count across the recorded revisions (normalized to its own peak), and a regression flag (`1→4`) when a check got worse since the previous revision. Check ids resolve to their human catalog labels (falling back to the raw id for a since-deleted custom check), and the list caps at the eight worst checks with a "+N more" note so a noisy run can't blow out the panel. Per-check counts are additive, install-local telemetry — snapshots recorded before this shipped simply start accumulating per-check history from the first run after upgrade. (`server/services/pipeline/editorialScore.js`, `client/src/lib/editorialHealth.js`, `client/src/components/pipeline/editorial/EditorialHealthPanel.jsx`, `client/src/pages/PipelineEditorialChecks.jsx`)
- **[issue-1593] The passive-voice check now ignores intentional passive — predicate-adjective states and weather/setting mood images — so it flags far fewer false positives.** `prose.passive-voice` is a cheap be-verb + past-participle heuristic, and the heuristic alone can't tell weak agentive passive ("the door was opened") from passive constructions writers use on purpose: a predicate-adjective state of being ("she was exhausted", "he was determined") isn't an action done to the subject at all, and a setting/weather mood image ("the sky was streaked with red", "the room was bathed in light") is deliberate atmosphere, not flabby prose. Both used to inflate the per-1000-word passive rate and push otherwise-clean sections over the threshold. A context-tuning pass now classifies each candidate `weak` / `stative` / `mood` and, by default, counts only genuine weak passive toward the density score — an explicit "by <agent>" ("she was exhausted *by the climb*") still always counts as weak. The cheap heuristic stays the base tier: a new **Suppress intentional passive** toggle (on by default) can be turned off per series to fall back to counting every be-verb + participle. (`server/lib/editorial/proseTics.js`, `server/lib/editorial/checkRegistry.js`)
diff --git a/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx b/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx
index 66c17b87e0..185e49fd3d 100644
--- a/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx
+++ b/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx
@@ -2,14 +2,22 @@
* Findings triage for the Editorial Checks page (#1285): the check-sourced
* comments seeded into the manuscript review store, grouped by check with
* severity counts. Each finding deep-links into the manuscript editor (which
- * opens its comment card via the `?comment=` param) where the existing
- * Accept / Dismiss / Generate-fix flow lives — this view is read + navigate
- * only, so triage logic stays in one place.
+ * opens its comment card via the `?comment=` param) where the full edit flow
+ * lives — but the common preview/accept/dismiss path is also available inline
+ * here (#1598): an open finding with a suggested fix expands a collapsed
+ * before/after diff (reusing the manuscript card's `InlineDiff` + edit helpers)
+ * and applies or dismisses it without leaving the page. Heavier edits (editing
+ * the replacement text, per-edit selection) still deep-link into the editor.
*/
import { Link } from 'react-router-dom';
-import { ChevronDown, ChevronRight, ExternalLink, History } from 'lucide-react';
+import { ChevronDown, ChevronRight, ExternalLink, History, Check, X, Loader2, GitCompareArrows } from 'lucide-react';
import { useMemo, useState } from 'react';
import { groupFindingsByCheck, findingManuscriptLink, openFindingsTotal } from '../../../lib/editorialChecks';
+import { fixEditsOf, selectedEditsFor } from '../manuscript/ManuscriptCommentCard';
+import InlineDiff from '../../ui/InlineDiff';
+import toast from '../../ui/Toast';
+import { useAsyncAction } from '../../../hooks/useAsyncAction';
+import { acceptPipelineManuscriptFix, patchPipelineManuscriptComment } from '../../../services/api';
const SEVERITY_DOT = {
high: 'bg-rose-400',
@@ -51,7 +59,117 @@ function StaleBadge({ count }) {
);
}
-function CheckGroup({ seriesId, group }) {
+// One finding: deep-link header + (for open findings) an inline preview/accept/
+// dismiss bar (#1598). The collapsed diff reuses the manuscript card's edit
+// helpers + `InlineDiff` so the preview here matches what the editor applies.
+function FindingRow({ seriesId, comment, onCommentChange }) {
+ const [showFix, setShowFix] = useState(false);
+ const hasFix = !!comment.fix;
+ const isOpen = comment.status === 'open';
+ const edits = useMemo(() => fixEditsOf(comment), [comment]);
+ // Mirror the manuscript card: a fix with no usable replacement text can't be
+ // applied, so the inline Accept stays disabled (the editor handles edge edits).
+ const acceptable = hasFix && edits.some((e) => (e.replace || '').trim());
+
+ const [runAccept, accepting] = useAsyncAction(
+ () => acceptPipelineManuscriptFix(
+ seriesId,
+ comment.id,
+ { edits: selectedEditsFor(comment, null).map(({ selected: _s, ...edit }) => edit) },
+ { silent: true },
+ ),
+ { errorMessage: 'Failed to apply fix' },
+ );
+ const [runDismiss, dismissing] = useAsyncAction(
+ () => patchPipelineManuscriptComment(seriesId, comment.id, { status: 'dismissed' }, { silent: true }),
+ { errorMessage: 'Failed to dismiss' },
+ );
+
+ const accept = async () => {
+ const result = await runAccept();
+ if (!result?.comment) return;
+ onCommentChange?.(result.comment);
+ toast.success('Fix applied to the manuscript');
+ };
+ const dismiss = async () => {
+ const result = await runDismiss();
+ if (result?.comment) onCommentChange?.(result.comment);
+ };
+
+ return (
+ <li className="p-2.5 space-y-2">
+ <Link
+ to={findingManuscriptLink(seriesId, comment)}
+ className="group flex items-start justify-between gap-2"
+ >
+ <span className="min-w-0 space-y-0.5">
+ <span className={`block text-xs ${STATUS_TONE[comment.status] || STATUS_TONE.open}`}>
+ <span className={`mr-1.5 inline-block h-2 w-2 rounded-full align-middle ${SEVERITY_DOT[comment.severity] || SEVERITY_DOT.low}`} />
+ {comment.problem}
+ </span>
+ <span className="flex items-center gap-2">
+ {comment.location ? <span className="block text-[11px] text-gray-500">{comment.location}</span> : null}
+ {isOpen && comment.stale ? <StaleBadge /> : null}
+ </span>
+ </span>
+ <ExternalLink size={13} className="mt-0.5 shrink-0 text-gray-600 group-hover:text-port-accent" />
+ </Link>
+
+ {isOpen ? (
+ <div className="space-y-1.5">
+ <div className="flex flex-wrap items-center gap-1.5">
+ {hasFix ? (
+ <>
+ <button
+ type="button"
+ onClick={() => setShowFix((v) => !v)}
+ aria-expanded={showFix}
+ className="inline-flex items-center gap-1 rounded border border-port-border px-1.5 py-0.5 text-[10px] text-gray-400 hover:text-white hover:border-port-accent/40"
+ >
+ <GitCompareArrows size={11} />
+ {showFix ? 'Hide fix' : 'Preview fix'}
+ {showFix ? <ChevronDown size={11} /> : <ChevronRight size={11} />}
+ </button>
+ <button
+ type="button"
+ onClick={accept}
+ disabled={accepting || dismissing || !acceptable}
+ className="inline-flex items-center gap-1 rounded border border-port-success/40 bg-port-success/20 px-1.5 py-0.5 text-[10px] text-port-success hover:bg-port-success/30 disabled:opacity-40"
+ >
+ {accepting ? <Loader2 size={11} className="animate-spin" /> : <Check size={11} />}
+ Accept
+ </button>
+ </>
+ ) : null}
+ <button
+ type="button"
+ onClick={dismiss}
+ disabled={accepting || dismissing}
+ className="inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-gray-500 hover:text-white disabled:opacity-40"
+ >
+ {dismissing ? <Loader2 size={11} className="animate-spin" /> : <X size={11} />}
+ Dismiss
+ </button>
+ </div>
+ {hasFix && showFix ? (
+ <div className="space-y-1.5 rounded border border-port-border/60 bg-port-card/40">
+ {edits.map((edit, i) => (
+ <div key={`${i}-${edit.issueId || ''}-${edit.find}`} className="overflow-hidden rounded border border-port-border/60">
+ <InlineDiff oldText={edit.find || ''} newText={edit.replace || ''} emptyLabel="No replacement changes." />
+ </div>
+ ))}
+ <p className="px-2 pb-1.5 text-[10px] text-gray-500">
+ Need to edit the replacement or pick individual edits? <Link to={findingManuscriptLink(seriesId, comment)} className="text-port-accent hover:underline">Open in the editor</Link>.
+ </p>
+ </div>
+ ) : null}
+ </div>
+ ) : null}
+ </li>
+ );
+}
+
+function CheckGroup({ seriesId, group, onCommentChange }) {
const [open, setOpen] = useState(group.open > 0);
return (
<div className="rounded-lg border border-port-border bg-port-card">
@@ -74,24 +192,7 @@ function CheckGroup({ seriesId, group }) {
{open ? (
<ul className="divide-y divide-port-border/60 border-t border-port-border/60">
{group.comments.map((c) => (
- <li key={c.id} className="p-2.5">
- <Link
- to={findingManuscriptLink(seriesId, c)}
- className="group flex items-start justify-between gap-2"
- >
- <span className="min-w-0 space-y-0.5">
- <span className={`block text-xs ${STATUS_TONE[c.status] || STATUS_TONE.open}`}>
- <span className={`mr-1.5 inline-block h-2 w-2 rounded-full align-middle ${SEVERITY_DOT[c.severity] || SEVERITY_DOT.low}`} />
- {c.problem}
- </span>
- <span className="flex items-center gap-2">
- {c.location ? <span className="block text-[11px] text-gray-500">{c.location}</span> : null}
- {c.status === 'open' && c.stale ? <StaleBadge /> : null}
- </span>
- </span>
- <ExternalLink size={13} className="mt-0.5 shrink-0 text-gray-600 group-hover:text-port-accent" />
- </Link>
- </li>
+ <FindingRow key={c.id} seriesId={seriesId} comment={c} onCommentChange={onCommentChange} />
))}
</ul>
) : null}
@@ -99,7 +200,7 @@ function CheckGroup({ seriesId, group }) {
);
}
-export default function EditorialFindingsTriage({ seriesId, comments = [], checksById = {} }) {
+export default function EditorialFindingsTriage({ seriesId, comments = [], checksById = {}, onCommentChange }) {
const groups = useMemo(() => groupFindingsByCheck(comments, checksById), [comments, checksById]);
if (!groups.length) {
return (
@@ -112,7 +213,7 @@ export default function EditorialFindingsTriage({ seriesId, comments = [], check
return (
<div className="space-y-2">
<p className="text-[11px] text-gray-500">{totalOpen} open finding{totalOpen === 1 ? '' : 's'} across {groups.length} check{groups.length === 1 ? '' : 's'}</p>
- {groups.map((g) => <CheckGroup key={g.checkId} seriesId={seriesId} group={g} />)}
+ {groups.map((g) => <CheckGroup key={g.checkId} seriesId={seriesId} group={g} onCommentChange={onCommentChange} />)}
</div>
);
}
diff --git a/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx b/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx
index 8e6c966a23..1d3dee3677 100644
--- a/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx
+++ b/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx
@@ -1,8 +1,14 @@
-import { describe, it, expect } from 'vitest';
-import { render, screen } from '@testing-library/react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import EditorialFindingsTriage from './EditorialFindingsTriage';
import { findingManuscriptLink } from '../../../lib/editorialChecks';
+import { acceptPipelineManuscriptFix, patchPipelineManuscriptComment } from '../../../services/api';
+
+vi.mock('../../../services/api', () => ({
+ acceptPipelineManuscriptFix: vi.fn(),
+ patchPipelineManuscriptComment: vi.fn(),
+}));
const checksById = {
'naming.dissimilar-names': { label: 'Character name dissimilarity', scope: 'series', kind: 'deterministic' },
@@ -13,6 +19,11 @@ const renderTriage = (props) => render(
);
describe('EditorialFindingsTriage', () => {
+ beforeEach(() => {
+ acceptPipelineManuscriptFix.mockReset();
+ patchPipelineManuscriptComment.mockReset();
+ });
+
it('shows the empty state when there are no check-sourced findings', () => {
renderTriage({ comments: [{ id: 'x', problem: 'no checkId', status: 'open' }] });
expect(screen.getByText(/No editorial-check findings yet/i)).toBeTruthy();
@@ -51,4 +62,55 @@ describe('EditorialFindingsTriage', () => {
expect(screen.queryByText('Stale')).toBeNull();
expect(screen.queryByText(/stale/i)).toBeNull();
});
+
+ it('previews a suggested fix inline and accepts it without leaving the page (#1598)', async () => {
+ const onCommentChange = vi.fn();
+ acceptPipelineManuscriptFix.mockResolvedValue({
+ comment: { id: 'c1', checkId: 'naming.dissimilar-names', status: 'accepted', severity: 'high', problem: 'Confusable names' },
+ });
+ const comments = [{
+ id: 'c1', checkId: 'naming.dissimilar-names', status: 'open', severity: 'high', problem: 'Confusable names',
+ fix: { edits: [{ find: 'Adam', replace: 'Aaron' }] },
+ }];
+ renderTriage({ comments, onCommentChange });
+
+ // The diff is collapsed until "Preview fix" is clicked.
+ expect(screen.queryByText('Aaron')).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: /preview fix/i }));
+ expect(screen.getByText('Aaron')).toBeTruthy();
+
+ fireEvent.click(screen.getByRole('button', { name: /accept/i }));
+ await waitFor(() => expect(acceptPipelineManuscriptFix).toHaveBeenCalledTimes(1));
+ const [, commentId, payload, options] = acceptPipelineManuscriptFix.mock.calls[0];
+ expect(commentId).toBe('c1');
+ expect(payload.edits).toEqual([{ find: 'Adam', replace: 'Aaron' }]);
+ expect(options).toEqual({ silent: true });
+ await waitFor(() => expect(onCommentChange).toHaveBeenCalledWith(expect.objectContaining({ id: 'c1', status: 'accepted' })));
+ });
+
+ it('dismisses an open finding inline (#1598)', async () => {
+ const onCommentChange = vi.fn();
+ patchPipelineManuscriptComment.mockResolvedValue({
+ comment: { id: 'c1', checkId: 'naming.dissimilar-names', status: 'dismissed', severity: 'low', problem: 'Minor' },
+ });
+ const comments = [{ id: 'c1', checkId: 'naming.dissimilar-names', status: 'open', severity: 'low', problem: 'Minor' }];
+ renderTriage({ comments, onCommentChange });
+
+ // No fix → no Accept/Preview, but Dismiss is still offered inline.
+ expect(screen.queryByRole('button', { name: /accept/i })).toBeNull();
+ expect(screen.queryByRole('button', { name: /preview fix/i })).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: /dismiss/i }));
+ await waitFor(() => expect(patchPipelineManuscriptComment).toHaveBeenCalledWith(
+ 'ser-1', 'c1', { status: 'dismissed' }, { silent: true },
+ ));
+ await waitFor(() => expect(onCommentChange).toHaveBeenCalledWith(expect.objectContaining({ id: 'c1', status: 'dismissed' })));
+ });
+
+ it('does not offer inline actions on a resolved finding (#1598)', () => {
+ const comments = [{ id: 'c1', checkId: 'naming.dissimilar-names', status: 'accepted', severity: 'high', problem: 'Done', fix: { edits: [{ find: 'a', replace: 'b' }] } }];
+ renderTriage({ comments });
+ expect(screen.queryByRole('button', { name: /accept/i })).toBeNull();
+ expect(screen.queryByRole('button', { name: /dismiss/i })).toBeNull();
+ expect(screen.queryByRole('button', { name: /preview fix/i })).toBeNull();
+ });
});
diff --git a/client/src/pages/PipelineEditorialChecks.jsx b/client/src/pages/PipelineEditorialChecks.jsx
index 9293103b99..c700ef1104 100644
--- a/client/src/pages/PipelineEditorialChecks.jsx
+++ b/client/src/pages/PipelineEditorialChecks.jsx
@@ -127,6 +127,15 @@ export default function PipelineEditorialChecks() {
});
}, []);
+ // Inline accept/dismiss from the triage list (#1598) — replace the changed
+ // comment in place (reactive update) and re-pull the health score/trend so the
+ // panel reflects the resolved finding without a full refetch.
+ const handleCommentChange = useCallback((updated) => {
+ if (!updated?.id) return;
+ setComments((prev) => prev.map((c) => (c.id === updated.id ? updated : c)));
+ setHealthRefresh((n) => n + 1);
+ }, []);
+
useEffect(() => {
setRunActive(false);
if (!seriesId) { setComments([]); return; }
@@ -528,7 +537,7 @@ export default function PipelineEditorialChecks() {
{loadingFindings ? (
<p className="flex items-center gap-2 text-sm text-gray-400"><Loader2 size={16} className="animate-spin" /> Loading findings…</p>
) : (
- <EditorialFindingsTriage seriesId={seriesId} comments={comments} checksById={checksById} />
+ <EditorialFindingsTriage seriesId={seriesId} comments={comments} checksById={checksById} onCommentChange={handleCommentChange} />
)}
</>
)}