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: keep triage mute in sync with catalog re-enable and serialize toggle PATCHes (#1602)

[._.]/ Adam Eivy5a7300d194d7
diff --git a/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx b/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx
index ed290c38dd..6ea237c16a 100644
--- a/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx
+++ b/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx
@@ -548,6 +548,21 @@ export default function EditorialFindingsTriage({ seriesId, comments = [], check
if (ok === false) { unhideCheck(checkId); toast.dismiss(toastId); }
});
};
+ // Keep the muted set honest against the live enabled-state: if a muted check is
+ // re-enabled elsewhere (the catalog toggle on this same page, or a findings
+ // reload carrying fresh catalog rows), un-hide its group so visibility always
+ // follows the check's actual enabled state — never stranding a group the empty
+ // state tells the user to restore from the catalog. Re-enabling through the
+ // undo path goes here too (its onToggleCheckEnabled flips enabled back to true).
+ useEffect(() => {
+ setHiddenCheckIds((s) => {
+ if (!s.size) return s;
+ let changed = false;
+ const next = new Set();
+ s.forEach((id) => { if (checksById[id]?.enabled === false) next.add(id); else changed = true; });
+ return changed ? next : s;
+ });
+ }, [checksById]);
// ---- Filter / search / sort, persisted in the URL so a view is deep-linkable
// (#1600). Facets are derived from the full (unfiltered) groups so options never
diff --git a/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx b/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx
index f057b2ca64..5e4968e402 100644
--- a/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx
+++ b/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx
@@ -323,6 +323,32 @@ describe('EditorialFindingsTriage', () => {
expect(screen.getByText('Noisy finding')).toBeTruthy();
});
+ it('un-hides a muted group once its check is re-enabled elsewhere, e.g. the catalog toggle (#1602)', () => {
+ const onToggleCheckEnabled = vi.fn().mockResolvedValue(true);
+ const comments = [{ id: 'c1', checkId: 'naming.dissimilar-names', status: 'open', severity: 'high', problem: 'Noisy finding' }];
+ const enabledRow = { label: 'Character name dissimilarity', scope: 'series', enabled: true };
+ const disabledRow = { ...enabledRow, enabled: false };
+ const tree = (checksById) => (
+ <MemoryRouter>
+ <EditorialFindingsTriage seriesId="ser-1" checksById={checksById} comments={comments} onToggleCheckEnabled={onToggleCheckEnabled} />
+ <Toaster />
+ </MemoryRouter>
+ );
+ const { rerender } = render(tree({ 'naming.dissimilar-names': enabledRow }));
+
+ fireEvent.click(screen.getByRole('button', { name: /Disable check: Character name dissimilarity/i }));
+ expect(screen.queryByText('Noisy finding')).toBeNull();
+
+ // The page's optimistic disable flips the catalog row off — group stays hidden.
+ rerender(tree({ 'naming.dissimilar-names': disabledRow }));
+ expect(screen.queryByText('Noisy finding')).toBeNull();
+
+ // Re-enabling from the catalog (a fresh enabled row) restores the group even
+ // though the undo toast was never clicked.
+ rerender(tree({ 'naming.dissimilar-names': enabledRow }));
+ expect(screen.getByText('Noisy finding')).toBeTruthy();
+ });
+
it('un-hides the group when the disable PATCH fails (#1602)', async () => {
// onToggleCheckEnabled resolves false on failure (the page reverts + toasts).
const onToggleCheckEnabled = vi.fn().mockResolvedValue(false);
diff --git a/client/src/pages/PipelineEditorialChecks.jsx b/client/src/pages/PipelineEditorialChecks.jsx
index a2609a01b3..ba1a5b0641 100644
--- a/client/src/pages/PipelineEditorialChecks.jsx
+++ b/client/src/pages/PipelineEditorialChecks.jsx
@@ -191,6 +191,9 @@ export default function PipelineEditorialChecks() {
// their own row changes — not on every unrelated run/selection state tick.
// Rollback flips only the one check (functional update) so a concurrent
// toggle of a different check can't be clobbered. ----
+ // Per-check tail promise so rapid toggles of the SAME check apply in click
+ // order (last-click-wins) — see the serialization note in handleToggle (#1602).
+ const toggleTailsRef = useRef(new Map());
const handleToggle = useCallback((checkId, nextEnabled) => {
const apply = (val) => setChecks((rows) => rows.map((r) => (r.id === checkId ? { ...r, enabled: val } : r)));
apply(nextEnabled);
@@ -201,13 +204,21 @@ export default function PipelineEditorialChecks() {
// settings, so the run buttons must gate on this PATCH landing (and the card
// shows its saving spinner for the toggle too).
setSavingIds((s) => new Set(s).add(checkId));
- // Returns a success boolean so callers that mirror a UI side effect on this
- // toggle (e.g. the triage view hiding a just-disabled check's group, #1602)
- // can reconcile when the PATCH fails — the catch has already reverted here.
- return patchEditorialCheck(checkId, { enabled: nextEnabled }, { silent: true })
+ // Serialize the PATCHes for a SINGLE check onto a per-check tail so the LAST
+ // click wins regardless of response timing (#1602): a quick disable-then-undo
+ // (or rapid double-toggle) could otherwise have the stale disable response
+ // land after the re-enable response and leave the check persisted disabled,
+ // since each response applies its own row. The tail makes the second PATCH run
+ // (and apply) only after the first settles. Returns a success boolean so the
+ // triage view can reconcile its optimistic group-hide when the PATCH fails —
+ // the catch has already reverted the optimistic enabled flip here.
+ const prev = toggleTailsRef.current.get(checkId) || Promise.resolve();
+ const result = prev.then(() => patchEditorialCheck(checkId, { enabled: nextEnabled }, { silent: true })
.then((row) => { if (row) setChecks((rows) => rows.map((r) => (r.id === checkId ? row : r))); return true; })
- .catch((err) => { apply(!nextEnabled); toast.error(err.message || 'Failed to update check'); return false; })
+ .catch((err) => { apply(!nextEnabled); toast.error(err.message || 'Failed to update check'); return false; }))
.finally(() => setSavingIds((s) => { const n = new Set(s); n.delete(checkId); return n; }));
+ toggleTailsRef.current.set(checkId, result.catch(() => {}));
+ return result;
}, []);
const handleConfigSave = useCallback((checkId, nextConfig) => {