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: render comic dialogue speaker from `character` (parser shape), add runner integration tests (#1589)

Adam Eivyafd3940a0d34
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index ff320323c5..07ba5b765a 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -2041,7 +2041,11 @@ export function renderComicForProseSync(pages) {
const desc = typeof panel?.description === 'string' ? panel.description.trim() : '';
if (desc) block.push(` Shows: ${desc}`);
for (const d of (Array.isArray(panel?.dialogue) ? panel.dialogue : [])) {
- const speaker = typeof d?.speaker === 'string' ? d.speaker.trim() : '';
+ // The comic-script parser keys the speaker as `character` ({ character, line }),
+ // the same field balloonAttribution/letteringDensity read — NOT `speaker`.
+ // Tolerate a `speaker` alias for robustness, but `character` is the real shape.
+ const rawSpeaker = typeof d?.character === 'string' ? d.character : (typeof d?.speaker === 'string' ? d.speaker : '');
+ const speaker = rawSpeaker.trim();
const line = typeof d?.line === 'string' ? d.line.trim() : '';
if (line) block.push(` ${speaker ? `${speaker}: ` : ''}${line}`);
}
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index 8c6c7cbc69..4b0ecd6f00 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -3497,7 +3497,8 @@ describe('comic.prose-sync — LLM cross-media check (#1589)', () => {
it('renderComicForProseSync emits page/panel headers + shows/dialogue/caption/sfx, skipping empty panels', () => {
const out = renderComicForProseSync([
{ panels: [
- { description: 'Anna draws the knife', dialogue: [{ speaker: 'ANNA', line: 'Stay back.' }], caption: 'Later', sfx: 'SHNK' },
+ // Production parsed dialogue shape is { character, line } (NOT { speaker }).
+ { description: 'Anna draws the knife', dialogue: [{ character: 'ANNA', line: 'Stay back.' }], caption: 'Later', sfx: 'SHNK' },
{ description: '', dialogue: [], caption: '', sfx: '' }, // empty → skipped
] },
]);
diff --git a/server/services/pipeline/editorial/checkRunner.test.js b/server/services/pipeline/editorial/checkRunner.test.js
index b48f9dc4cb..3413852b52 100644
--- a/server/services/pipeline/editorial/checkRunner.test.js
+++ b/server/services/pipeline/editorial/checkRunner.test.js
@@ -711,6 +711,50 @@ describe('getReviewWithStaleness (#1345)', () => {
expect(review.comments.find((c) => c.checkId === 'comic.panel-rhythm').stale).toBe(true);
});
+ it('runs comic.prose-sync through the runner, fetching issues and feeding the model the PROSE STAGE text (#1589)', async () => {
+ // A hybrid issue: prose stage + comic content, PLUS a comicScript stage whose
+ // text differs — the stitched manuscript would pick comicScript over prose, so
+ // this pins that the check reads the prose STAGE, not the manuscript precedence.
+ issuesState = [{
+ id: 'i1', seriesId: 's1', number: 1,
+ stages: {
+ prose: { output: 'Anna is stabbed and falls.' },
+ comicScript: { output: 'PAGE 1\nPANEL 1\nAnna stands, unharmed.' },
+ comicPages: { pages: [{ panels: [{ description: 'Anna stands, unharmed', caption: '', dialogue: [{ character: 'ANNA', line: 'Fine.' }], sfx: '' }] }] },
+ },
+ }];
+ const { findings } = await runEditorialChecks('s1', { checkIds: ['comic.prose-sync'] });
+ // needsIssues/needsProse made the runner load issues for this check.
+ expect(listIssuesForSeries).toHaveBeenCalledWith('s1');
+ expect(findings.some((f) => f.checkId === 'comic.prose-sync')).toBe(true);
+ // The model got the PROSE stage text (NOT the comicScript-precedence manuscript),
+ // and the comic block carries the panel description + the { character, line } speaker.
+ const call = runStagedLLM.mock.calls.find((c) => c[0] === 'pipeline-editorial-comic-prose-sync');
+ expect(call).toBeTruthy();
+ expect(call[1].prose).toBe('Anna is stabbed and falls.');
+ expect(call[1].comic).toContain('Shows: Anna stands, unharmed');
+ expect(call[1].comic).toContain('ANNA: Fine.');
+ });
+
+ it('stales a comic.prose-sync finding when the PROSE STAGE text drifts, even though the comic is unchanged (#1589)', async () => {
+ const hybrid = (prose) => [{
+ id: 'i1', seriesId: 's1', number: 1,
+ stages: {
+ prose: { output: prose },
+ comicPages: { pages: [{ panels: [{ description: 'a panel', caption: '', dialogue: [], sfx: '' }] }] },
+ },
+ }];
+ issuesState = hybrid('Anna is stabbed and falls.');
+ const { findings } = await runEditorialChecks('s1', { checkIds: ['comic.prose-sync'] });
+ reviewState = { comments: findings.map((f) => ({ ...f, status: 'open' })) };
+ expect(reviewState.comments.find((c) => c.checkId === 'comic.prose-sync')).toBeTruthy();
+ // Edit ONLY the prose stage — the comic content is byte-identical. The `prose`
+ // source must fingerprint the prose so the finding goes stale.
+ issuesState = hybrid('Anna walks away, unharmed.');
+ const review = await getReviewWithStaleness('s1');
+ expect(review.comments.find((c) => c.checkId === 'comic.prose-sync').stale).toBe(true);
+ });
+
it('keeps a scene finding fresh when the manuscript changes (reverseOutline-only source)', async () => {
outlineState = { scenes: [{ id: 'scene-001', issueNumber: 1, heading: 'Talking heads', anchorQuote: 'q', components: { narrative: false, action: false, dialogue: true } }] };
await seedReviewFromRun();