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: reconcile timeline-contradiction check against the continuity-bible ledger (#1581)

Adam Eivy92eea1903eba
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 8e86321f3e..81586a6473 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -49,7 +49,7 @@
## Editorial checks
-- **[issue-1581] A new editorial check catches timeline and canon contradictions — a dead character who reappears alive, an age that contradicts the bible, an impossible chronology.** PortOS had no editorial check for internal contradictions against canon and the story's own timeline, so a character killed in issue 3 who walks back in alive in issue 6, an age the prose contradicts (the bible says 16, the page says "in her 30s"), or a journey that takes eight days but is dated to day two could slip through to the reader — the kind of mistake that's nearly impossible to catch by eye once an arc spans months of drafting. The new **Timeline / canon contradiction** check (`continuity.timeline-contradiction`) reconciles the stitched manuscript against the established canon character facts (age, role, status, description), the reverse-outline scene ordering (for chronology), and the authored per-character arcs, flagging each contradiction with the two facts that conflict and a verbatim anchor. It runs across the whole manuscript — carrying each character's last-known state (alive/dead, age, location) forward between chunks so a death-then-resurrection that spans chapters is actually visible — and degrades to a prose-only scan when no canon or outline exists. It's a default-on series check that surfaces in the existing editorial-review UI and Series Autopilot like every other check, marking plot-breaking contradictions high-severity per finding. (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-timeline-contradiction.md`, `scripts/migrations/129-editorial-timeline-contradiction-stage.js`)
+- **[issue-1581] A new editorial check catches timeline and canon contradictions — a dead character who reappears alive, an age that contradicts the bible, an impossible chronology.** PortOS had no editorial check for internal contradictions against canon and the story's own timeline, so a character killed in issue 3 who walks back in alive in issue 6, an age the prose contradicts (the bible says 16, the page says "in her 30s"), or a journey that takes eight days but is dated to day two could slip through to the reader — the kind of mistake that's nearly impossible to catch by eye once an arc spans months of drafting. The new **Timeline / canon contradiction** check (`continuity.timeline-contradiction`) reconciles the stitched manuscript against the **continuity-bible facts ledger** (the ground-truth ages, dates & elapsed time, locations, and world rules already extracted by the continuity bible), the canon character facts (age, role, status, description), the reverse-outline scene ordering (for chronology), and the authored per-character arcs — flagging each contradiction with the two facts that conflict and a verbatim anchor. It runs across the whole manuscript — carrying each character's last-known state (alive/dead, age, location) forward between chunks so a death-then-resurrection that spans chapters is actually visible — and degrades to a prose-only scan when no canon or outline exists. It's a default-on series check that surfaces in the existing editorial-review UI and Series Autopilot like every other check, marking plot-breaking contradictions high-severity per finding. Its findings go stale (and re-run) when any source it reads drifts — including the continuity-bible ledger — via the new `continuityBible` editorial source. (`server/lib/editorial/checkRegistry.js`, `server/services/pipeline/editorial/checkRunner.js`, `data.reference/prompts/stages/pipeline-editorial-timeline-contradiction.md`, `scripts/migrations/129-editorial-timeline-contradiction-stage.js`)
## Series Autopilot
diff --git a/data.reference/prompts/stages/pipeline-editorial-timeline-contradiction.md b/data.reference/prompts/stages/pipeline-editorial-timeline-contradiction.md
index 7036677903..0c2982cbcc 100644
--- a/data.reference/prompts/stages/pipeline-editorial-timeline-contradiction.md
+++ b/data.reference/prompts/stages/pipeline-editorial-timeline-contradiction.md
@@ -24,6 +24,20 @@ accounts for, a flashback clearly marked as such, an unreliable narrator the
story signals); ordinary changes a character is allowed to undergo; a fact the
prose never actually contradicts.
+{{#continuityLedger}}
+## Continuity bible — established facts
+
+The continuity bible has extracted these ground-truth facts from the canon and
+prior issues (ages & birthdays, dates & elapsed time, locations, world rules,
+who-knows-what). These are the authoritative record — flag a passage that
+contradicts one, and use the dated/elapsed-time facts to judge whether the
+chronology holds.
+
+```
+{{continuityLedger}}
+```
+{{/continuityLedger}}
+
{{#canonStates}}
## Established canon facts
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 675373f4a3..2896c92e4b 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -70,6 +70,14 @@ const SEVERITIES = CHECK_SEVERITIES;
// runner's `SOURCE_RESOLVERS` (a load-time guard there fails fast if they drift).
// - 'manuscript' — the stitched manuscript corpus (implies needsManuscript)
// - 'canon' — the universe/series canon (characters, relationships, objects)
+// - 'continuityBible' — the series CONTINUITY-BIBLE facts ledger (#1305): the
+// extracted ground-truth facts the timeline/canon-contradiction
+// check (#1581) reconciles the prose against — `[{ category,
+// subject, statement, issueNumber }]` across the bible's
+// categories (physical, age, dates/elapsed time, location,
+// possession, world rules, who-knows-what). The runner fetches
+// it via `getFactsLedger` (gated on this source) and injects
+// `ctx.continuityBible` (the facts array).
// - 'series.styleGuide' — the series style guide (tense/POV/rating/reading level)
// - 'series.arc.tickingClock' — the series arc's ticking clock
// - 'reverseOutline' — the cached reverse-outline scene segmentation (#1286);
@@ -133,6 +141,7 @@ const SEVERITIES = CHECK_SEVERITIES;
export const EDITORIAL_SOURCES = Object.freeze([
'manuscript',
'canon',
+ 'continuityBible',
'series.styleGuide',
'series.arc.tickingClock',
'series.arc.readerMap',
@@ -357,6 +366,63 @@ export function canonCharacterStatesSummary(canon) {
return `Canon character facts (the established bible — reconcile the prose against these):\n${rows.join('\n')}`;
}
+// Human-readable labels for the continuity-bible fact categories (#1305). Inlined
+// (not imported from server/services/pipeline/continuityBible.js) to keep this
+// registry PURE — that module pulls in I/O + an SSE runner. Mirrors its
+// `FACT_CATEGORIES`; a category absent from this map falls back to its raw id, so
+// a new bible category still renders (just without a prettied label) until it's
+// added here.
+const CONTINUITY_CATEGORY_LABELS = Object.freeze({
+ physical: 'Physical traits',
+ age: 'Ages & birthdays',
+ timeline: 'Dates & elapsed time',
+ location: 'Locations & geography',
+ possession: 'Possessions & wardrobe',
+ 'world-rule': 'World rules',
+ knowledge: 'Who knows what, when',
+});
+
+// Render the continuity-bible facts ledger (#1305) into a compact text block the
+// timeline / canon-contradiction check (#1581) passes alongside the manuscript, so
+// the model reconciles the prose against the established ground-truth facts the
+// bible already extracted — ages/birthdays, dates & elapsed time, locations, world
+// rules, who-knows-what — which the shallow per-character canon fields don't carry.
+// Facts are grouped by category (in the stable category order) and tagged with the
+// issue they were established in, when known, so the model can reason about WHEN a
+// fact held. Pure + deterministic so it's unit-testable and its token cost can be
+// counted into the per-chunk overhead. Type-guarded throughout (the ledger rides
+// peer sync, so a hand-edited / older-peer fact could carry a non-string field).
+// Returns '' when there are no usable facts (the prompt's `{{#continuityLedger}}`
+// section then renders nothing and the check falls back to the canon fields + prose).
+export function continuityLedgerSummary(facts) {
+ const list = Array.isArray(facts) ? facts : [];
+ const byCategory = new Map();
+ for (const f of list) {
+ if (!f || typeof f !== 'object') continue;
+ const category = typeof f.category === 'string' ? f.category.trim() : '';
+ const subject = typeof f.subject === 'string' ? f.subject.trim() : '';
+ const statement = typeof f.statement === 'string' ? f.statement.trim() : '';
+ if (!category || !statement) continue;
+ const where = Number.isInteger(f.issueNumber) ? ` (Issue ${f.issueNumber})` : '';
+ const line = subject ? `- ${subject}: ${statement}${where}` : `- ${statement}${where}`;
+ if (!byCategory.has(category)) byCategory.set(category, []);
+ byCategory.get(category).push(line);
+ }
+ if (!byCategory.size) return '';
+ // Render known categories in their canonical order first, then any unknown
+ // category (a newer-peer addition) after, so the block is stable + complete.
+ const order = [...Object.keys(CONTINUITY_CATEGORY_LABELS), ...byCategory.keys()];
+ const seen = new Set();
+ const blocks = [];
+ for (const category of order) {
+ if (seen.has(category) || !byCategory.has(category)) continue;
+ seen.add(category);
+ const label = CONTINUITY_CATEGORY_LABELS[category] || category;
+ blocks.push(`${label}:\n${byCategory.get(category).join('\n')}`);
+ }
+ return `Continuity bible facts (established ground truth — reconcile the prose against these):\n\n${blocks.join('\n\n')}`;
+}
+
// Stage name for the plot-structure & momentum LLM check (#1310). Ships in
// data.reference/prompts/stages/ + stage-config.json (fresh installs via
// setup-data.js) and migrates to existing installs via migration 111 (boot runs
@@ -2885,10 +2951,10 @@ export const EDITORIAL_CHECKS = [
},
{
id: 'continuity.timeline-contradiction',
- sources: ['manuscript', 'canon', 'reverseOutline', 'series.characterArcs'],
+ sources: ['manuscript', 'canon', 'continuityBible', 'reverseOutline', 'series.characterArcs'],
label: 'Timeline / canon contradiction',
description:
- 'LLM scan for internal contradictions against canon and chronology: a character who dies and later reappears alive without explanation, an age contradiction (the bible says 16, the prose says "in her 30s"), or an impossible timeline (an event dated day 2 that characters needed 8 days to reach). Reconciles the prose against the established canon character facts, the reverse-outline scene ordering, and the authored per-character arc start/end states; degrades to a prose-only scan when no canon or outline exists.',
+ 'LLM scan for internal contradictions against canon and chronology: a character who dies and later reappears alive without explanation, an age contradiction (the bible says 16, the prose says "in her 30s"), or an impossible timeline (an event dated day 2 that characters needed 8 days to reach). Reconciles the prose against the continuity-bible facts ledger (ages, dates & elapsed time, locations, world rules), the canon character facts, the reverse-outline scene ordering, and the authored per-character arc start/end states; degrades to a prose-only scan when none of those exist.',
scope: 'series',
kind: 'llm',
category: 'continuity',
@@ -2918,25 +2984,29 @@ export const EDITORIAL_CHECKS = [
],
gate: (ctx) => (ctx.manuscript || '').trim().length > 0,
run: (ctx) => {
- // All three blocks are fixed per-call overhead (re-sent on each chunk) and
- // pure context: the canon facts let the model catch age/status/identity
- // contradictions, the scene map gives the chronology to catch impossible
- // timelines and resurrection-without-explanation, and the authored arcs give
- // each character's intended start → end state. The check degrades
- // gracefully — no canon ⇒ {{#canonStates}} renders nothing; no outline ⇒
- // {{#sceneMap}} renders nothing; no authored arcs ⇒ {{#characterArcs}}
- // renders nothing and the model reasons from the prose alone.
+ // All four blocks are fixed per-call overhead (re-sent on each chunk) and
+ // pure context: the continuity-bible ledger is the authoritative fact set
+ // (ages, dates/elapsed time, locations, world rules) the contradiction is
+ // judged against, the canon facts add per-character age/status/identity, the
+ // scene map gives the chronology to catch impossible timelines and
+ // resurrection-without-explanation, and the authored arcs give each
+ // character's intended start → end state. The check degrades gracefully — an
+ // absent input renders nothing (`{{#continuityLedger}}`/`{{#canonStates}}`/
+ // `{{#sceneMap}}`/`{{#characterArcs}}`) and the model reasons from the prose.
+ const continuityLedger = continuityLedgerSummary(ctx.continuityBible);
const canonStates = canonCharacterStatesSummary(ctx.canon);
const sceneMap = sceneGroundingSummary(ctx.reverseOutline);
const characterArcs = renderCharacterArcsForPrompt(ctx.series?.characterArcs) || '';
return runManuscriptLlmCheck(ctx, {
stage: TIMELINE_CONTRADICTION_STAGE,
category: 'continuity',
- // canonStates + sceneMap grow with cast/scene count; characterArcs is
- // bounded — so largest-first trimming absorbs the cut into those.
- context: { canonStates, sceneMap, characterArcs },
+ // continuityLedger + canonStates + sceneMap grow with fact/cast/scene
+ // count; characterArcs is bounded — so largest-first trimming absorbs the
+ // cut into those.
+ context: { continuityLedger, canonStates, sceneMap, characterArcs },
buildVars: (manuscript, _meta, c) => ({
manuscript,
+ continuityLedger: c.continuityLedger,
canonStates: c.canonStates,
sceneMap: c.sceneMap,
characterArcs: c.characterArcs,
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index 5ed4551765..99610209bb 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -36,6 +36,7 @@ import {
declaredThemesSummary,
canonRosterNamesSummary,
canonCharacterStatesSummary,
+ continuityLedgerSummary,
} from './checkRegistry.js';
const NAMING = 'naming.dissimilar-names';
@@ -831,6 +832,7 @@ describe('continuity.timeline-contradiction — LLM check (#1581)', () => {
severityDefault: 'medium',
series: {},
canon: { characters: [{ name: 'Mara', age: 16, status: 'deceased after Issue 3' }] },
+ continuityBible: [{ category: 'age', subject: 'Mara', statement: 'is 16', issueNumber: 1 }],
reverseOutline: [{ sequence: 0, issueNumber: 1, heading: 'The bridge', setting: 'a bridge', charactersPresent: ['Mara'] }],
planManuscriptChunks: async () => ['# Issue 1\n\nMara died on the bridge.'],
callStagedLLM: async () => ({ content: { findings: [] } }),
@@ -843,7 +845,7 @@ describe('continuity.timeline-contradiction — LLM check (#1581)', () => {
expect(check.scope).toBe('series');
expect(check.category).toBe('continuity');
expect(check.severityDefault).toBe('medium');
- expect(check.sources).toEqual(['manuscript', 'canon', 'reverseOutline', 'series.characterArcs']);
+ expect(check.sources).toEqual(['manuscript', 'canon', 'continuityBible', 'reverseOutline', 'series.characterArcs']);
expect(check.needsManuscript).toBe(true);
});
@@ -853,11 +855,12 @@ describe('continuity.timeline-contradiction — LLM check (#1581)', () => {
expect(check.gate({ manuscript: '# Issue 1\n\nprose' })).toBeTruthy();
});
- it('passes the manuscript, canon facts, and scene map to the model and forces the continuity category', async () => {
+ it('passes the manuscript, continuity ledger, canon facts, and scene map to the model and forces the continuity category', async () => {
let seenVars = null;
const ctx = wholeCtx({
planManuscriptChunks: async (_stage, opts) => {
- // Canon states + scene map + character arcs all ride as trimmable context.
+ // Continuity ledger + canon states + scene map + character arcs all ride as trimmable context.
+ expect(opts.context).toHaveProperty('continuityLedger');
expect(opts.context).toHaveProperty('canonStates');
expect(opts.context).toHaveProperty('sceneMap');
expect(opts.context).toHaveProperty('characterArcs');
@@ -871,6 +874,7 @@ describe('continuity.timeline-contradiction — LLM check (#1581)', () => {
});
const findings = await getCheck(TIMELINE_CONTRADICTION).run(ctx);
expect(seenVars.manuscript).toBe('# Issue 6\n\nMara walked back into the room, very much alive.');
+ expect(seenVars.continuityLedger).toContain('Mara: is 16');
expect(seenVars.canonStates).toContain('Mara');
expect(seenVars.canonStates).toContain('age 16');
expect(seenVars.sceneMap).toContain('Issue 1: The bridge');
@@ -879,20 +883,50 @@ describe('continuity.timeline-contradiction — LLM check (#1581)', () => {
expect(findings[0].location).toBe('Mara — resurrection');
});
- it('passes empty context vars when the series has no canon or outline', async () => {
+ it('passes empty context vars when the series has no ledger, canon, or outline', async () => {
let seenVars = null;
const ctx = wholeCtx({
canon: undefined,
+ continuityBible: undefined,
reverseOutline: undefined,
callStagedLLM: async (_stage, vars) => { seenVars = vars; return { content: { findings: [] } }; },
});
await getCheck(TIMELINE_CONTRADICTION).run(ctx);
+ expect(seenVars.continuityLedger).toBe('');
expect(seenVars.canonStates).toBe('');
expect(seenVars.sceneMap).toBe('');
expect(seenVars.characterArcs).toBe('');
});
});
+describe('continuityLedgerSummary (#1581)', () => {
+ it('returns an empty string when there are no usable facts', () => {
+ expect(continuityLedgerSummary(null)).toBe('');
+ expect(continuityLedgerSummary(undefined)).toBe('');
+ expect(continuityLedgerSummary([])).toBe('');
+ // A fact missing a category or statement is dropped.
+ expect(continuityLedgerSummary([{ subject: 'Mara' }, { category: 'age' }])).toBe('');
+ });
+
+ it('groups facts by category in canonical order, with prettied labels and issue tags', () => {
+ const out = continuityLedgerSummary([
+ { category: 'timeline', subject: 'The crossing', statement: 'takes eight days', issueNumber: 2 },
+ { category: 'age', subject: 'Mara', statement: 'is 16' },
+ ]);
+ expect(out).toContain('Continuity bible facts');
+ // Age (canonical order) renders before Dates & elapsed time.
+ expect(out.indexOf('Ages & birthdays')).toBeLessThan(out.indexOf('Dates & elapsed time'));
+ expect(out).toContain('- Mara: is 16');
+ expect(out).toContain('- The crossing: takes eight days (Issue 2)');
+ });
+
+ it('falls back to the raw category id for an unknown (newer-peer) category and is type-guarded', () => {
+ expect(() => continuityLedgerSummary([null, 'nope', { category: 5, statement: 'x' }])).not.toThrow();
+ const out = continuityLedgerSummary([{ category: 'mood', statement: 'the tone is grim' }]);
+ expect(out).toContain('mood:\n- the tone is grim');
+ });
+});
+
describe('canonCharacterStatesSummary (#1581)', () => {
it('returns an empty string when there are no characters or no renderable facts', () => {
expect(canonCharacterStatesSummary(null)).toBe('');
diff --git a/server/services/pipeline/editorial/checkRunner.js b/server/services/pipeline/editorial/checkRunner.js
index 40654e850d..3170b0b538 100644
--- a/server/services/pipeline/editorial/checkRunner.js
+++ b/server/services/pipeline/editorial/checkRunner.js
@@ -26,6 +26,7 @@ import { listIssuesForSeries } from '../issues.js';
import { getSeriesCanon } from '../seriesCanon.js';
import { collectManuscriptSections, sectionsCorpus, manuscriptSectionHeader } from '../arcPlanner.js';
import { getReverseOutline } from '../reverseOutline.js';
+import { getFactsLedger } from '../continuityBible.js';
import { getSeriesEditorial } from '../editorialAnalysis.js';
import { seedReviewFromFindings, getReview } from '../manuscriptReview.js';
import { recordTrendSnapshot } from '../editorialScore.js';
@@ -70,6 +71,10 @@ const sha256 = (text) => createHash('sha256').update(text || '').digest('hex');
const SOURCE_RESOLVERS = {
manuscript: ({ manuscript }) => manuscript || '',
canon: ({ canon }) => canonicalStringify(canon ?? null),
+ // The continuity-bible facts ledger the timeline / canon-contradiction check
+ // reconciles the prose against (#1581). Fingerprint the whole facts array so a
+ // re-extraction or a hand-edit to any established fact stales its findings.
+ continuityBible: ({ continuityBible }) => canonicalStringify(continuityBible ?? null),
'series.styleGuide': ({ series }) => canonicalStringify(series?.styleGuide ?? null),
'series.arc.tickingClock': ({ series }) => canonicalStringify(series?.arc?.tickingClock ?? null),
// The authored reader-map hooks/payoffs the Chekhov check reconciles against (#1299).
@@ -348,6 +353,9 @@ export async function runEditorialChecks(seriesId, options = {}) {
// Editorial-arc fetch is gated on the declared source (#1295) so a run with no
// POV/arc check pays no extra snapshot I/O — mirrors the needsReverseOutline gate.
const needsEditorialArcs = enabled.some(({ check }) => checkSources(check).includes('editorialArcs'));
+ // Continuity-bible ledger fetch is gated on the declared source (#1581) so a run
+ // with no contradiction check pays no extra ledger I/O — mirrors the other gates.
+ const needsContinuityBible = enabled.some(({ check }) => checkSources(check).includes('continuityBible'));
// Issues are fetched only when an enabled check declares an issue-derived source
// — storyboard.shots (#1315), comicScript (#1313, served via the comic.lettering
// check's ctx.issues), or the comic-pacing tokens comicScript.pacing /
@@ -363,7 +371,7 @@ export async function runEditorialChecks(seriesId, options = {}) {
|| sources.includes('comicScript.pacing')
|| sources.includes('comicScript.layout');
});
- const [sections, canon, issues, outline, editorial] = await Promise.all([
+ const [sections, canon, issues, outline, editorial, bible] = await Promise.all([
needsManuscript ? collectManuscriptSections(seriesId) : Promise.resolve([]),
getSeriesCanon(series),
needsIssues ? listIssuesForSeries(seriesId).catch(() => []) : Promise.resolve([]),
@@ -372,8 +380,12 @@ export async function runEditorialChecks(seriesId, options = {}) {
// (issues is fetched in this same Promise.all, so it can't be passed here —
// it's still in the temporal dead zone — and stays an internal fetch.)
needsEditorialArcs ? getSeriesEditorial(seriesId, { series }).catch(() => null) : Promise.resolve(null),
+ needsContinuityBible ? getFactsLedger(seriesId).catch(() => null) : Promise.resolve(null),
]);
const manuscript = sectionsCorpus(sections);
+ // The continuity-bible facts ledger (#1581) — the facts array, injected for the
+ // timeline / canon-contradiction check and fingerprinted for its staleness.
+ const continuityBible = Array.isArray(bible?.facts) ? bible.facts : [];
// Storyboard shots for the visual.shot-continuity check (#1315) — projected off
// the gated `issues` fetch (empty unless a storyboard.shots/comicScript check is on).
const storyboardScenes = collectStoryboardScenes(issues);
@@ -401,7 +413,7 @@ export async function runEditorialChecks(seriesId, options = {}) {
// Resolve every source token once — each finding's fingerprint reads from this
// so the editor flags it `stale` when the content that check actually read (its
// declared `sources`) drifts (#1345, #1387).
- const resolvedSources = resolveSources({ manuscript, canon, series, reverseOutline, reverseOutlinePlotlines, editorialArcs, editorialArcsComplete, storyboardScenes, comicScripts, comicPacingContent, comicLayoutContent });
+ const resolvedSources = resolveSources({ manuscript, canon, continuityBible, series, reverseOutline, reverseOutlinePlotlines, editorialArcs, editorialArcsComplete, storyboardScenes, comicScripts, comicPacingContent, comicLayoutContent });
const baseCtx = {
seriesId,
series,
@@ -414,6 +426,7 @@ export async function runEditorialChecks(seriesId, options = {}) {
editorialArcsComplete,
storyboardScenes,
canon,
+ continuityBible,
providerOverride,
providerDefault,
modelOverride,
@@ -664,6 +677,10 @@ export async function getReviewWithStaleness(seriesId) {
return sources.includes('reverseOutline') || sources.includes('reverseOutline.plotlines');
});
const needsEditorialArcs = evaluable.some((c) => checkSources(checkFor(c.checkId)).includes('editorialArcs'));
+ // Continuity-bible ledger re-fingerprint, gated like the others (#1581) — must
+ // mirror the run path's fetch so a timeline/canon finding's hash is computed
+ // against the SAME ledger content on read as on seed (else it always reads stale).
+ const needsContinuityBible = evaluable.some((c) => checkSources(checkFor(c.checkId)).includes('continuityBible'));
// Issues are fetched here only when a storyboard-shots (#1315) OR comic-script
// (#1313 lettering / #1314 pacing) finding needs re-fingerprinting — all derive
// from the issue records, so a single gated fetch serves them. Mirrors the other
@@ -675,14 +692,16 @@ export async function getReviewWithStaleness(seriesId) {
});
const needsIssues = needsStoryboards || needsComicScript;
const series = await getSeries(seriesId);
- const [sections, canon, outline, editorial, issues] = await Promise.all([
+ const [sections, canon, outline, editorial, issues, bible] = await Promise.all([
needsManuscript ? collectManuscriptSections(seriesId) : Promise.resolve([]),
getSeriesCanon(series),
needsReverseOutline ? getReverseOutline(seriesId).catch(() => null) : Promise.resolve(null),
// Reuse the already-loaded series.
needsEditorialArcs ? getSeriesEditorial(seriesId, { series }).catch(() => null) : Promise.resolve(null),
needsIssues ? listIssuesForSeries(seriesId).catch(() => []) : Promise.resolve([]),
+ needsContinuityBible ? getFactsLedger(seriesId).catch(() => null) : Promise.resolve(null),
]);
+ const continuityBible = Array.isArray(bible?.facts) ? bible.facts : [];
const reverseOutline = Array.isArray(outline?.scenes) ? outline.scenes : [];
const reverseOutlinePlotlines = Array.isArray(outline?.plotlines) ? outline.plotlines : [];
const editorialArcs = projectEditorialArcs(editorial);
@@ -692,7 +711,7 @@ export async function getReviewWithStaleness(seriesId) {
const comicScripts = projectComicLetteringContent(comicIssues);
const comicPacingContent = projectComicPacingContent(comicIssues);
const comicLayoutContent = projectComicLayoutContent(comicIssues);
- const resolvedSources = resolveSources({ manuscript: sectionsCorpus(sections), canon, series, reverseOutline, reverseOutlinePlotlines, editorialArcs, editorialArcsComplete, storyboardScenes, comicScripts, comicPacingContent, comicLayoutContent });
+ const resolvedSources = resolveSources({ manuscript: sectionsCorpus(sections), canon, continuityBible, series, reverseOutline, reverseOutlinePlotlines, editorialArcs, editorialArcsComplete, storyboardScenes, comicScripts, comicPacingContent, comicLayoutContent });
return {
...review,
comments: review.comments.map((c) => {