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
feat: link canon entity references in editorial findings to the universe canon (#1631)
[._.]/ Adam Eivy124f8818ef0b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex cd899ee1b2..b4956b7c1b 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -24,6 +24,7 @@## Editorial checks+- **[issue-1631] Findings that name canon entities now link straight to the universe's canon section.** A continuity or character finding ("Aria's eye colour drifts between issues") named a canon entity in plain prose with no way to jump to that entity's record — you'd manually cross-reference. When the selected series has a linked universe, each finding now carries a **Canon** chip row: every character, place, or object whose name appears in the finding's problem/location text becomes a one-click link into the universe's canon section, with the entity's descriptor shown as a hovercard (and a per-kind icon). Matching is whole-word and case-insensitive, prefers the longest name so "Jon Snow" wins over "Jon", and collapses repeated mentions to one chip. The chips render outside the finding's manuscript deep-link (no nested links) and appear on resolved findings too, so a continuity review can cross-reference in place. A series with no linked universe, or a finding that names no canon entity, shows no chips — existing behavior is unchanged. (`client/src/lib/editorialChecks.js`, `client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx`, `client/src/pages/PipelineEditorialChecks.jsx`)- **[issue-1630] Click a point on the editorial health-trend sparkline to drill into that revision — what was open then, and what changed since the prior run.** The score sparkline in the Editorial Health panel was read-only: you could watch the line dip after an edit pass but not see *why*. Every recorded revision is now a clickable point. Selecting one opens a drill-down showing that snapshot's score (with its delta vs the previous revision) and its open-finding breakdown by severity and category, plus a per-dimension diff against the prior revision — which severities, categories, and checks rose (regressed, in red) or fell (improved, in green), biggest change first. The first recorded revision says there's nothing to compare yet; a revision recorded before per-check tracking shipped omits the per-check diff rather than inventing an all-new baseline. (`client/src/components/pipeline/editorial/EditorialHealthPanel.jsx`, `client/src/lib/editorialHealth.js`, `server/services/pipeline/editorialScore.js`)- **[issue-1625] The reading-level check now reports per-scene variance, not just a single whole-corpus number.** `style.reading-level` measured one Flesch–Kincaid grade for the entire series and flagged drift from the style-guide target — but a single average hides the modulation a skilled writer uses (a quiet introspective scene reads lower, an action scene higher) and conceals a lone scene that swings far outside the intended band. The check now also splits the manuscript into scenes (reusing the shared `splitScenes` divider parser — markdown headings including the stitcher's `# Issue N`, and centered rules like `***`), measures each, and flags any scene whose grade falls outside the target **band** (`target ± sceneTolerance`), reporting the widest swings first. Three new per-series knobs join the existing whole-corpus tolerance: **per-scene band tolerance** (default 4 — wider than the corpus tolerance since scenes legitimately modulate), **minimum scene words to measure** (default 120 — short fragments are too noisy for a reliable FK estimate), and **max per-scene findings** (default 5 — so a long manuscript can't flood the review). The original whole-corpus finding is unchanged, and a single-scene manuscript reports only that — so existing series behavior is preserved. (`server/lib/editorial/checkRegistry.js`)- **[issue-1622] The adverb, passive-voice, and repeated-gesture copy-edit checks are now series-tunable like their word-list siblings.** Clichés, said-bookisms, filter words, crutch words, hedge words, and gestures already accepted a house-style allowlist and an extra-words list, but `prose.adverbs` and `prose.passive-voice` didn't expose theirs (repeated-gestures already did). Now all three carry the same config: `prose.adverbs` gains an **extra-adverbs** list so a series can flag the real adverbs the `-ly` heuristic misses ("fast", "well", "hard"); `prose.passive-voice` gains a **house-style allowlist** (participles to never flag — archaic/adjectival "-ed" forms like "blessed", "beloved") and an **extra-participles** list (series-specific irregular participles the heuristic misses, e.g. "begun", "hewn"). A historical-fiction series can now whitelist archaic forms and a comedic series can mute gesture repetition without code changes. Additive config with empty-string defaults — existing series are unaffected. (`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.jsxindex 0b164c937f..7b2cfd0e35 100644--- a/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx+++ b/client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx@@ -15,7 +15,7 @@* bulk-dismisses the selection — each result reactively updates local state.*/import { Link, useSearchParams } from 'react-router-dom';-import { ChevronDown, ChevronRight, ExternalLink, History, Check, X, Loader2, GitCompareArrows, Search, Ban, Undo2, Info, Play, ArrowRight, CheckCircle2, RefreshCw } from 'lucide-react';+import { ChevronDown, ChevronRight, ExternalLink, History, Check, X, Loader2, GitCompareArrows, Search, Ban, Undo2, Info, Play, ArrowRight, CheckCircle2, RefreshCw, Users, MapPin, Package } from 'lucide-react';import { useEffect, useMemo, useRef, useState } from 'react';import CheckKindBadge from './CheckKindBadge';import {@@ -30,6 +30,9 @@ import {FINDING_FILTER_PARAMS as FILTER_PARAMS,ALL_FINDING_FILTER_PARAMS as ALL_FILTER_PARAMS,FINDINGS_TRIAGE_ANCHOR_ID,+ canonReferencesInText,+ canonEntityLink,+ CANON_KIND_LABELS,} from '../../../lib/editorialChecks';import { fixEditsOf, selectedEditsFor } from '../manuscript/ManuscriptCommentCard';import InlineDiff from '../../ui/InlineDiff';@@ -66,6 +69,46 @@ const EMPTY_HIDDEN = new Set();// selectable / bulk-actionable. Named once so the predicate lives in one place.const isOpenFinding = (c) => !!c.checkId && c.status === 'open';+// Stable empty default for the `canonEntities` prop so callers that don't pass it+// (tests, embeds without a linked universe) skip the canon scan entirely.+const EMPTY_CANON = [];++// Per-trunk icon for a canon-reference chip (#1631).+const CANON_KIND_ICON = { characters: Users, places: MapPin, objects: Package };++// The canon entities a finding names (#1631), rendered as links into the+// universe's canon section so continuity/character findings cross-reference in one+// click. Lives outside the manuscript deep-link `<Link>` (no nested anchors) and+// only renders when the series has a linked universe whose canon the text mentions.+function CanonReferences({ universeId, comment, canonEntities }) {+ const refs = useMemo(+ () => canonReferencesInText(`${comment.problem || ''}\n${comment.location || ''}`, canonEntities),+ [comment.problem, comment.location, canonEntities],+ );+ if (!universeId || refs.length === 0) return null;+ return (+ <div className="flex flex-wrap items-center gap-1.5">+ <span className="text-[10px] uppercase tracking-wide text-gray-600">Canon</span>+ {refs.map((entity) => {+ const Icon = CANON_KIND_ICON[entity.kind] || Users;+ return (+ <Link+ key={entity.id}+ to={canonEntityLink(universeId)}+ title={entity.descriptor+ ? `${entity.name} — ${entity.descriptor}`+ : `${entity.name} (${CANON_KIND_LABELS[entity.kind] || 'canon entry'})`}+ className="inline-flex items-center gap-1 rounded-full border border-port-border px-1.5 py-0.5 text-[10px] text-gray-300 hover:border-port-accent/40 hover:text-port-accent"+ >+ <Icon size={10} className="shrink-0" />+ {entity.name}+ </Link>+ );+ })}+ </div>+ );+}+// A fix is acceptable only when it carries usable replacement text — mirror the// manuscript card so the inline/bulk Accept stays disabled for edge edits the// editor must handle. Shared by the per-finding row and the bulk action bar.@@ -128,7 +171,7 @@ function SelectCheckbox({ checked, indeterminate = false, onChange, label, class// 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, selected, onToggleSelect }) {+function FindingRow({ seriesId, comment, onCommentChange, selected, onToggleSelect, universeId, canonEntities }) {const [showFix, setShowFix] = useState(false);const hasFix = !!comment.fix;const isOpen = comment.status === 'open';@@ -215,6 +258,8 @@ function FindingRow({ seriesId, comment, onCommentChange, selected, onToggleSele</Link></div>+ <CanonReferences universeId={universeId} comment={comment} canonEntities={canonEntities} />+{isOpen ? (<div className="space-y-1.5"><div className="flex flex-wrap items-center gap-1.5">@@ -300,7 +345,7 @@ function FindingRow({ seriesId, comment, onCommentChange, selected, onToggleSele// default collapse derives from `group.open > 0`, so a status/search filter that// matches only resolved findings (open === 0) would otherwise hide its matches// behind a collapsed header and make the filtered view look empty.-function CheckGroup({ seriesId, group, onCommentChange, selectedIds, onToggleSelect, onSelectMany, forceOpen = false, canDisable = false, onDisableCheck }) {+function CheckGroup({ seriesId, group, onCommentChange, selectedIds, onToggleSelect, onSelectMany, forceOpen = false, canDisable = false, onDisableCheck, universeId, canonEntities }) {const [open, setOpen] = useState(group.open > 0);// The check's documented purpose/kind, surfaced inline so the user can tell a// hard rule from a heuristic while triaging (#1604). Collapsed by default to@@ -402,6 +447,8 @@ function CheckGroup({ seriesId, group, onCommentChange, selectedIds, onToggleSelonCommentChange={onCommentChange}selected={selectedIds.has(c.id)}onToggleSelect={onToggleSelect}+ universeId={universeId}+ canonEntities={canonEntities}/>))}</ul>@@ -683,7 +730,7 @@ function NextStepsCTA({ seriesId, allCleared, onRunChecks, runDisabled = false });}-export default function EditorialFindingsTriage({ seriesId, comments = [], checksById = {}, onCommentChange, hiddenCheckIds = EMPTY_HIDDEN, onDisableCheck, onRunChecks, runDisabled = false }) {+export default function EditorialFindingsTriage({ seriesId, comments = [], checksById = {}, onCommentChange, hiddenCheckIds = EMPTY_HIDDEN, onDisableCheck, onRunChecks, runDisabled = false, universeId = '', canonEntities = EMPTY_CANON }) {const groups = useMemo(() => groupFindingsByCheck(comments, checksById), [comments, checksById]);const [selectedIds, setSelectedIds] = useState(() => new Set());@@ -837,6 +884,8 @@ export default function EditorialFindingsTriage({ seriesId, comments = [], checkonToggleSelect={toggleSelect}onSelectMany={selectMany}forceOpen={activeFilterCount > 0}+ universeId={universeId}+ canonEntities={canonEntities}/>))}</div>diff --git a/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx b/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsxindex debfa4cb18..3a529c1968 100644--- a/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx+++ b/client/src/components/pipeline/editorial/EditorialFindingsTriage.test.jsx@@ -450,4 +450,51 @@ describe('EditorialFindingsTriage — per-finding undo of an accepted fix (#1609renderTriage({ comments });expect(screen.queryByRole('button', { name: /Undo fix/i })).toBeNull();});++ describe('canon entity references (#1631)', () => {+ const canonEntities = [+ { id: 'ch1', name: 'Aria', kind: 'characters', descriptor: 'silver-haired pilot' },+ { id: 'pl1', name: 'The Atrium', kind: 'places', descriptor: 'glass dome' },+ ];++ it('links canon entities named in a finding to the universe canon section, with a descriptor hovercard', () => {+ const comments = [+ { id: 'c1', checkId: 'naming.dissimilar-names', status: 'open', severity: 'high', problem: "Aria's arc stalls in The Atrium" },+ ];+ renderTriage({ comments, universeId: 'uni-7', canonEntities });+ // Exact names so the chip (name "Aria") doesn't also match the manuscript+ // deep-link (name = the full problem text).+ const ariaLink = screen.getByRole('link', { name: 'Aria' });+ expect(ariaLink.getAttribute('href')).toBe('/universes/uni-7#canon');+ expect(ariaLink.getAttribute('title')).toBe('Aria — silver-haired pilot');+ expect(screen.getByRole('link', { name: 'The Atrium' }).getAttribute('href')).toBe('/universes/uni-7#canon');+ });++ it('renders no canon chips when the series has no linked universe', () => {+ const comments = [+ { id: 'c1', checkId: 'naming.dissimilar-names', status: 'open', severity: 'high', problem: 'Aria drifts' },+ ];+ renderTriage({ comments, universeId: '', canonEntities });+ expect(screen.queryByRole('link', { name: 'Aria' })).toBeNull();+ });++ it('renders no canon chips when the finding text names no canon entity', () => {+ const comments = [+ { id: 'c1', checkId: 'naming.dissimilar-names', status: 'open', severity: 'high', problem: 'Pacing sags in act two' },+ ];+ renderTriage({ comments, universeId: 'uni-7', canonEntities });+ expect(screen.queryByText('Canon')).toBeNull();+ });++ it('also linkifies entities named in resolved findings (continuity review)', () => {+ // An open sibling keeps the group expanded so the dismissed finding's row+ // (and its canon chip) renders.+ const comments = [+ { id: 'c0', checkId: 'naming.dissimilar-names', status: 'open', severity: 'high', problem: 'Pacing sags' },+ { id: 'c1', checkId: 'naming.dissimilar-names', status: 'dismissed', severity: 'low', problem: 'Aria appears off-model' },+ ];+ renderTriage({ comments, universeId: 'uni-7', canonEntities });+ expect(screen.getByRole('link', { name: 'Aria' }).getAttribute('href')).toBe('/universes/uni-7#canon');+ });+ });});diff --git a/client/src/lib/editorialChecks.js b/client/src/lib/editorialChecks.jsindex def80e5367..5ab21d9e67 100644--- a/client/src/lib/editorialChecks.js+++ b/client/src/lib/editorialChecks.js@@ -1,6 +1,7 @@// Pure helpers for the Editorial Checks page (#1285) — catalog grouping,// findings triage grouping, and manuscript deep-link building. No React, no// window: the page component and its unit tests both consume these.+import { descriptorForCanonEntry } from './canonPrompt.js';// Scope display order + labels (mirrors server CHECK_SCOPES). A check whose// scope isn't one of these still renders, bucketed under its raw scope last.@@ -360,3 +361,111 @@ export function applyFindingsView(groups = [], filters = {}, sort = 'scope') {}return sortGroups(out, view);}++// ---- Canon entity references in findings (#1631) ----------------------------+// A continuity/character finding ("Aria's eye colour drifts") names canon+// entities in free text but doesn't link them. These helpers detect a universe's+// canon names inside finding text so the triage can render them as links into the+// canon section, with the entity's descriptor as a hovercard. Pure (no React/DOM)+// so the page, the triage row, and the unit tests all share one implementation.++// The plural canon-trunk array keys on a universe record (universe.characters, …).+const CANON_TRUNK_KEYS = Object.freeze(['characters', 'places', 'objects']);++// Singular human label per trunk — used in the chip hovercard when an entry has+// no descriptor yet.+export const CANON_KIND_LABELS = Object.freeze({ characters: 'character', places: 'place', objects: 'object' });++/**+ * Flatten a universe record's canon arrays into a lookup list for linkifying+ * findings. Each entry: `{ id, name, kind, descriptor }` — `kind` is the plural+ * trunk key, `descriptor` the short bio used for the link hovercard. Entries with+ * a too-short name (1 char would match noise) are dropped; the first entry to+ * claim a name (case-insensitive) wins, so one name never links to two entities.+ */+export function canonEntitiesFromUniverse(universe) {+ if (!universe || typeof universe !== 'object') return [];+ const out = [];+ const seen = new Set();+ for (const key of CANON_TRUNK_KEYS) {+ const list = Array.isArray(universe[key]) ? universe[key] : [];+ for (const entry of list) {+ const name = String(entry?.name || '').trim();+ if (name.length < 2) continue;+ const norm = name.toLowerCase();+ if (seen.has(norm)) continue;+ seen.add(norm);+ out.push({+ id: entry.ingredientId || entry.id || norm,+ name,+ kind: key,+ descriptor: descriptorForCanonEntry(key, entry) || '',+ });+ }+ }+ return out;+}++const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');++// Build a single case-insensitive, word-boundary-anchored matcher over every+// canon name (longest first so "Jon Snow" wins over "Jon"), plus a lowercase+// name→entity map. Returns `null` when there are no usable names.+function buildCanonMatcher(entities = []) {+ const byName = new Map();+ const alts = [];+ for (const e of [...entities].filter((e) => e?.name).sort((a, b) => b.name.length - a.name.length)) {+ const key = e.name.toLowerCase();+ if (byName.has(key)) continue;+ byName.set(key, e);+ alts.push(escapeRegExp(e.name));+ }+ if (!alts.length) return null;+ return { byName, re: new RegExp(`\\b(${alts.join('|')})\\b`, 'gi') };+}++/**+ * Split `text` into segments, tagging runs that match a canon entity name so the+ * caller can render them as links. Returns an array of `{ text }` (plain) and+ * `{ text, entity }` (matched) segments that, concatenated, reproduce `text`+ * exactly. Matching is whole-word and case-insensitive.+ */+export function linkifyCanonEntities(text, entities = []) {+ const str = typeof text === 'string' ? text : '';+ if (!str) return [];+ const matcher = buildCanonMatcher(entities);+ if (!matcher) return [{ text: str }];+ const { byName, re } = matcher;+ re.lastIndex = 0;+ const segments = [];+ let last = 0;+ let m;+ while ((m = re.exec(str)) !== null) {+ if (m.index > last) segments.push({ text: str.slice(last, m.index) });+ segments.push({ text: m[0], entity: byName.get(m[0].toLowerCase()) });+ last = m.index + m[0].length;+ }+ if (last < str.length) segments.push({ text: str.slice(last) });+ return segments;+}++/**+ * Unique canon entities referenced anywhere in `text`, in first-appearance order.+ * Drives the per-finding "Canon" chip row — collapses repeated mentions of the+ * same entity to one chip.+ */+export function canonReferencesInText(text, entities = []) {+ const out = [];+ const seen = new Set();+ for (const seg of linkifyCanonEntities(text, entities)) {+ if (seg.entity && !seen.has(seg.entity.id)) {+ seen.add(seg.entity.id);+ out.push(seg.entity);+ }+ }+ return out;+}++/** Deep-link to a universe's canon section — the canon "page" for its entities. */+export const canonEntityLink = (universeId) =>+ universeId ? `/universes/${encodeURIComponent(universeId)}#canon` : null;diff --git a/client/src/lib/editorialChecks.test.js b/client/src/lib/editorialChecks.test.jsindex 647f252950..df2be56c7f 100644--- a/client/src/lib/editorialChecks.test.js+++ b/client/src/lib/editorialChecks.test.js@@ -12,6 +12,10 @@ import {applyFindingsView,normalizeFindingSort,findingIssueKey,+ canonEntitiesFromUniverse,+ linkifyCanonEntities,+ canonReferencesInText,+ canonEntityLink,} from './editorialChecks.js';const checks = [@@ -345,3 +349,66 @@ describe('applyFindingsView', () => {expect(view.flatMap((g) => g.comments.map((c) => c.id))).toEqual(['b2']);});});++describe('canon entity references in findings (#1631)', () => {+ const universe = {+ characters: [+ { id: 'ch1', name: 'Aria', physicalDescription: 'silver-haired pilot' },+ { id: 'ch2', name: 'Jon', physicalDescription: '' },+ { id: 'ch3', name: 'Jon Snow', physicalDescription: 'brooding ranger' },+ { name: 'X' }, // too short — dropped+ ],+ places: [{ ingredientId: 'pl1', id: 'local-1', name: 'The Atrium', description: 'glass dome' }],+ objects: [{ id: 'ob1', name: 'Aria' }], // duplicate name — first (character) wins+ };++ it('flattens canon arrays, drops 1-char names, dedupes by name, prefers ingredientId', () => {+ const entities = canonEntitiesFromUniverse(universe);+ expect(entities.map((e) => e.name)).toEqual(['Aria', 'Jon', 'Jon Snow', 'The Atrium']);+ const aria = entities.find((e) => e.name === 'Aria');+ expect(aria.kind).toBe('characters');+ expect(aria.descriptor).toContain('silver-haired pilot');+ expect(entities.find((e) => e.name === 'The Atrium').id).toBe('pl1');+ });++ it('returns [] for a missing/invalid universe', () => {+ expect(canonEntitiesFromUniverse(null)).toEqual([]);+ expect(canonEntitiesFromUniverse('nope')).toEqual([]);+ expect(canonEntitiesFromUniverse({})).toEqual([]);+ });++ it('linkifies whole-word, case-insensitive matches and reproduces the text exactly', () => {+ const entities = canonEntitiesFromUniverse(universe);+ const segs = linkifyCanonEntities("aria visits The Atrium with Mariana", entities);+ expect(segs.map((s) => s.text).join('')).toBe("aria visits The Atrium with Mariana");+ const linked = segs.filter((s) => s.entity).map((s) => [s.text, s.entity.name]);+ // "aria" matches (case-insensitive); "Mariana" does NOT (word-boundary, not substring "Aria").+ expect(linked).toEqual([['aria', 'Aria'], ['The Atrium', 'The Atrium']]);+ });++ it('prefers the longest name so a multi-word entity wins over its substring', () => {+ const entities = canonEntitiesFromUniverse(universe);+ const segs = linkifyCanonEntities('Jon Snow returns', entities);+ const linked = segs.filter((s) => s.entity);+ expect(linked).toHaveLength(1);+ expect(linked[0].entity.name).toBe('Jon Snow');+ });++ it('collapses repeated mentions to unique references in first-appearance order', () => {+ const entities = canonEntitiesFromUniverse(universe);+ const refs = canonReferencesInText('Aria and Aria meet Jon at The Atrium', entities);+ expect(refs.map((e) => e.name)).toEqual(['Aria', 'Jon', 'The Atrium']);+ });++ it('handles empty/no-entity inputs without throwing', () => {+ expect(linkifyCanonEntities('', [])).toEqual([]);+ expect(linkifyCanonEntities('plain text', [])).toEqual([{ text: 'plain text' }]);+ expect(canonReferencesInText('', canonEntitiesFromUniverse(universe))).toEqual([]);+ });++ it('builds a canon-section deep link (or null without a universe)', () => {+ expect(canonEntityLink('u-1')).toBe('/universes/u-1#canon');+ expect(canonEntityLink('')).toBeNull();+ expect(canonEntityLink(null)).toBeNull();+ });+});diff --git a/client/src/pages/PipelineEditorialChecks.jsx b/client/src/pages/PipelineEditorialChecks.jsxindex 36d683cbe3..737829df2c 100644--- a/client/src/pages/PipelineEditorialChecks.jsx+++ b/client/src/pages/PipelineEditorialChecks.jsx@@ -21,7 +21,7 @@ import EditorialFindingsTriage from '../components/pipeline/editorial/EditorialFimport EditorialHealthPanel from '../components/pipeline/editorial/EditorialHealthPanel';import ProviderModelSelector from '../components/ProviderModelSelector';import TabPills from '../components/ui/TabPills';-import { groupChecksByScope, normCategory } from '../lib/editorialChecks';+import { groupChecksByScope, normCategory, canonEntitiesFromUniverse } from '../lib/editorialChecks';import { usePipelineProgress } from '../hooks/usePipelineProgress';import useProviderModels from '../hooks/useProviderModels';import {@@ -38,6 +38,7 @@ import {getEditorialChecksRunStatus,editorialChecksRunSseUrl,getPipelineManuscriptReview,+ getUniverse,} from '../services/api';export default function PipelineEditorialChecks() {@@ -69,6 +70,11 @@ export default function PipelineEditorialChecks() {const [seriesResetNonces, setSeriesResetNonces] = useState(() => ({}));const seriesId = searchParams.get('series') || '';const [comments, setComments] = useState([]);+ // Canon entities (#1631) for the selected series' linked universe, flattened to+ // a name→entity lookup so the triage can linkify entity references in findings.+ // Empty until a series with a universe is selected; load failures degrade to no+ // links (the findings still render).+ const [canonEntities, setCanonEntities] = useState([]);const [loadingFindings, setLoadingFindings] = useState(false);// Bumped whenever the findings are (re)loaded so the health panel refetches// its score/trend in lockstep — a run that seeds new findings also moves the@@ -355,6 +361,18 @@ export default function PipelineEditorialChecks() {// what stops a B-reseed from poisoning A's queued PATCH). `patch === null`// clears the whole check. ----const selectedSeries = useMemo(() => series.find((s) => s.id === seriesId) || null, [series, seriesId]);+ // Load the linked universe's canon once the series resolves (#1631). Guarded by a+ // mounted flag keyed on universeId so a slow fetch for a series the user has since+ // switched away from can't linkify the new series' findings with stale canon.+ const universeId = selectedSeries?.universeId || '';+ useEffect(() => {+ if (!universeId) { setCanonEntities([]); return undefined; }+ let active = true;+ getUniverse(universeId, { silent: true })+ .then((universe) => { if (active) setCanonEntities(canonEntitiesFromUniverse(universe)); })+ .catch(() => { if (active) setCanonEntities([]); });+ return () => { active = false; };+ }, [universeId]);const seriesOverrides = selectedSeries?.editorialCheckConfig && typeof selectedSeries.editorialCheckConfig === 'object'? selectedSeries.editorialCheckConfig: null;@@ -703,7 +721,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} onCommentChange={handleCommentChange} hiddenCheckIds={hiddenCheckIds} onDisableCheck={disableCheck} onRunChecks={() => runChecks(null)} runDisabled={runDisabled || enabledCount === 0} />+ <EditorialFindingsTriage seriesId={seriesId} comments={comments} checksById={checksById} onCommentChange={handleCommentChange} hiddenCheckIds={hiddenCheckIds} onDisableCheck={disableCheck} onRunChecks={() => runChecks(null)} runDisabled={runDisabled || enabledCount === 0} universeId={universeId} canonEntities={canonEntities} />)}</>)}