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
fix: complete every series-linked character
[._.]/ Adam Eivy9ec27eaba0d0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 07542f9668..e55e1b1c60 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -11,6 +11,7 @@- **Foundation structure repair retains shrinking corrective progress.** A broad structure rewrite whose specialized arc verification improved from many blockers to a smaller residual used to get one correction attempt and then roll the entire improvement back. The repair now continues a bounded correction sequence while the blocker count stays monotonic, still restoring the original checkpoint if the set grows or cannot clear within the cap.- **A late structure-repair regression no longer erases an independently verified improvement.** The bounded correction sequence could shrink nine arc blockers to one, then let its final attempt trade that residual for five and restore the entire pre-repair plan—discarding the proven one-blocker checkpoint. It now restores the best verified intermediate state, sends that partial improvement through the harsh foundation re-judge, and leaves the full arc gate dirty so the residual must still clear before beats. Model evidence follows the same transaction boundary: the retained repair runs remain provisional, while the regressive run is immediately scored as rejected; a fully reverted repair is also a rejection rather than a schema-invalid response.- **Character-first planning now includes the cast's visual foundation.** The pre-arc character architect used to complete psychology and relationships while its response contract omitted physical description, silhouette, visual identity, and palette, so a graphic-novel series could settle its plot around characters the image pipeline still had to invent. Those identity-bearing fields now participate in completeness, prompt hashing, harsh foundation scoring, and repair; optional sheets such as props, expressions, gestures, and wardrobes are authored when the character's form supports them.+- **Character-first planning now finishes supporting cast bible cards too.** A character minted by series extraction could be omitted from foundation repair until their name appeared in the synopsis, and the repair allowlist dropped otherwise-useful profile fields such as pronouns, age, accent, likes/dislikes, mannerisms, and skills. Explicit `sourceSeriesId` ownership now keeps every series-linked character in exhaustive batches, and full narrative/visual profiles participate in completeness, hashing, repair, and harsh judging instead of stopping when only the lead framework is ready.- **Foundation judges now inspect the character designs they score.** Completed render fields were previously collapsed to the word `ready` in the judge context, so a harsh judge could only see that a value existed and then reasonably report that no anatomy, silhouette, palette, or visual grammar was available for comparison. The bounded context now carries the actual distinguishing details while still excluding unrelated universe assets.- **Series Autopilot can pause without killing productive work.** The live control used to offer only Stop, which terminates the active provider run even when a long foundation judgment is doing useful work. **Pause safely** now records a graceful request, lets the active step and any provisional repair-verification transaction settle, then persists a resumable manual pause; **Stop now** remains available as the immediate emergency control.- **Canon readiness now repairs manuscript-supported blanks before blocking art.** Autopilot's pre-render gate could identify a drawn character, place, or object with no description, but it immediately paused even though the Nouns workflow already had a safe fill-blanks-only service. The gate now runs that strict prose-grounded backfill for each affected issue, rechecks shared canon, and pauses only for locked nouns or visual facts the manuscript genuinely never established—never inventing unsupported design to force a pass.diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.jsonindex 8206c8b094..7358e8449e 100644--- a/data.reference/prompts/stage-config.json+++ b/data.reference/prompts/stage-config.json@@ -361,7 +361,7 @@},"pipeline-character-foundation": {"name": "Pipeline — Character Foundation",- "description": "Character-first planning pass used before the macro arc and again for post-arc reconciliation. It completes causal Ghost/Wound/Lie/Want/Need engines, distinct voices, relationships, secrets, and provisional whole-series transitions before plot generation; afterward it preserves that foundation while permitting only necessary refinements and a small additive set of story-required characters.",+ "description": "Character-first planning pass used before the macro arc and again for post-arc reconciliation. It fully authors every series-linked character's narrative profile and render identity, completes causal Ghost/Wound/Lie/Want/Need engines, distinct voices, relationships, secrets, and provisional whole-series transitions before plot generation; afterward it preserves that foundation while permitting only necessary refinements and a small additive set of story-required characters.","model": "heavy","returnsJson": true,"variables": ["phase", "foundationFindingJson", "seriesJson", "outline", "charactersJson"]diff --git a/data.reference/prompts/stages/pipeline-character-foundation.md b/data.reference/prompts/stages/pipeline-character-foundation.mdindex 62efd3f8f1..b59757ce84 100644--- a/data.reference/prompts/stages/pipeline-character-foundation.md+++ b/data.reference/prompts/stages/pipeline-character-foundation.md@@ -40,7 +40,7 @@ You are the senior character architect for a long-form series. Build the human e- Preserve the `id`, name, physical identity, and established history of every supplied character. Existing canon is a constraint, not raw material to replace.- Make Ghost → Wound → Lie → Want → Need causal and specific. The Want must create external action; the Need must demand a costly contradiction of the Lie.-- Give each target character distinct values, contradictions, motivation, speech rhythm, secrets, and relationships that exert pressure in both directions.+- Give each target character distinct values, contradictions, motivation, speech rhythm, secrets, and relationships that exert pressure in both directions. Fully author the bible profile: explicit pronouns; apparent age or age-status; speech accent or vocal quality; personality; relevant background; likes; dislikes; mannerisms; reciprocal relationships; and practical skills. "Unknown" may be a deliberate in-world age-status, but a blank is not a design choice.- Treat visual identity as canon, not decoration. `physicalDescription` must be 50–100 words of concrete, image-generation-ready detail; never use the character's name inside it. Specify apparent age range, scale/build or non-human form, surface/skin, hair and eyes when applicable, distinguishing marks, and signature attire/materials. Make `visualNotes`, `silhouetteNotes`, `postureNotes`, `visualIdentity`, and `colorPalette` mutually reinforcing and visibly distinct from every peer.- For the core cast, provide practical recurring `props`; provide `expressions`, `handGestures`, and `wardrobes` when the character's form supports them. Do not force human anatomy or clothing onto a non-human entity—use form-appropriate stats, poses, signal states, surface changes, or carried interfaces instead.- Return every supplied target whose framework is incomplete or whose existing engine needs the requested editorial repair. Never silently omit a target merely because the batch is large; later batches handle the rest of the roster.@@ -59,9 +59,16 @@ Return ONLY one valid JSON object. Omit `newCharacters` when no new role is nece"characters": [{"id": "existing character id","name": "existing character name",+ "pronouns": "explicit pronouns",+ "age": "apparent age range, exact age, ancient, or deliberately unknown",+ "speechAccent": "accent, vocal quality, or nonverbal signal quality","personality": "specific contradictions under pressure","background": "only the history relevant to present choices",+ "likes": "specific pleasures, comforts, or affinities",+ "dislikes": "specific aversions and irritants",+ "mannerisms": "observable repeated behaviors","relationships": "reciprocal tensions, obligations, love, leverage, and mistrust",+ "skills": "practical capabilities and limits","ghost": "specific formative past event","wound": "lasting emotional consequence","lie": "false belief caused by the wound",@@ -88,9 +95,16 @@ Return ONLY one valid JSON object. Omit `newCharacters` when no new role is nece"newCharacters": [{"name": "new non-duplicate character name","role": "precise story and relationship function",+ "pronouns": "explicit pronouns",+ "age": "apparent age range, exact age, ancient, or deliberately unknown",+ "speechAccent": "accent, vocal quality, or nonverbal signal quality","personality": "specific contradictions under pressure","background": "relevant history",+ "likes": "specific pleasures, comforts, or affinities",+ "dislikes": "specific aversions and irritants",+ "mannerisms": "observable repeated behaviors","relationships": "ties into the existing ensemble",+ "skills": "practical capabilities and limits","ghost": "specific formative past event","wound": "lasting emotional consequence","lie": "false belief caused by the wound",diff --git a/data.reference/prompts/stages/pipeline-judge-foundation.md b/data.reference/prompts/stages/pipeline-judge-foundation.mdindex 0144d5972a..ec6787bbfb 100644--- a/data.reference/prompts/stages/pipeline-judge-foundation.md+++ b/data.reference/prompts/stages/pipeline-judge-foundation.md@@ -43,7 +43,7 @@ the concrete fix restore the derived bible or plan to the protected intent.## Score these 4 weighted dimensions (each 1–10 per the calibration ladder)1. **worldbuilding** *(weight 40%)* — Does the derived universe preserve the protected author intent exactly in substance, without replacing its ontology, protagonists, or core story engine? Do the world's powers have clear LIMITATIONS (not just capabilities)? Is there iceberg depth (implied history/systems beneath the named surface)? Are the pieces interconnected (magic ↔ politics ↔ geography), or a disconnected props list? Is canon coverage broad enough to draft against without inventing on the fly?-2. **character** *(weight 30%)* — Are the leads' Wound → Lie → Want → Need chains complete and specific (not blank, not generic)? Are the characters distinct from one another? Do they carry secrets and a clear arc type? For a graphic-novel target, does every core character also have a concrete, mutually distinct visual foundation—physical description, silhouette, visual identity, and palette—so image generation will not invent them afresh from page to page? A psychologically rich cast with blank render identity is still an incomplete character foundation and cannot score above 5.+2. **character** *(weight 30%)* — Is every character linked to this series fully authored, not only the leads: explicit pronouns and age-status, personality and relevant history, motivations, likes/dislikes, mannerisms, reciprocal relationships, practical skills, distinct speech, secrets, and a clear arc type? Are the leads' Wound → Lie → Want → Need chains complete and specific (not blank, not generic)? For a graphic-novel target, does every series-linked character also have a concrete, mutually distinct visual foundation—physical description, silhouette, visual identity, and palette—so image generation will not invent them afresh from page to page? A psychologically rich lead or supporting character with blank profile/render identity is still an incomplete character foundation and cannot score above 5.3. **structure** *(weight 20%)* — Is the arc outline complete (logline, summary, protagonist arc, per-volume loglines + ending hooks)? Is foreshadowing balanced (setups that will pay off, not everything front-loaded or nothing planted)? Do the volume threads nest coherently toward the finale?4. **craft** *(weight 10%)* — Is the declared voice/style clear and specific enough to write to (tense, POV, tone, register), or vague boilerplate a drafter would ignore?diff --git a/scripts/migrations/256-series-linked-character-profiles.js b/scripts/migrations/256-series-linked-character-profiles.jsnew file mode 100644index 0000000000..f73bb5ea3c--- /dev/null+++ b/scripts/migrations/256-series-linked-character-profiles.js@@ -0,0 +1,33 @@+/**+ * Fully author every character minted by a series, including supporting cast.+ *+ * The previous character foundation selected only names visible in the current+ * synopsis/arc and did not own profile fields such as pronouns, age, likes,+ * mannerisms, or skills. A series-extracted supporting character could therefore+ * have a complete dramatic framework while their Universe Bible card remained+ * visibly unfinished. Hash replacement preserves customized prompts.+ */++import { makePromptReplaceMigration } from './_lib.js';++export const ACCEPTED_OLD_MD5 = {+ 'pipeline-character-foundation.md': ['04419e382f3b46ed92bfaaa1d4f39e13'],+ 'pipeline-judge-foundation.md': ['02a8e9215ba534b333f3a29f11f3ac4f'],+};++export const NEW_SHIPPED_MD5 = {+ 'pipeline-character-foundation.md': 'b7d2bac347e11171606f4c6acfcd32e1',+ 'pipeline-judge-foundation.md': 'e44b6c50d741bbd21fc86f481684c410',+};++const { applyMigration, up } = makePromptReplaceMigration({+ accepted: ACCEPTED_OLD_MD5,+ current: NEW_SHIPPED_MD5,+ label: 'series-linked character profiles',+ customizedHint: (filename) =>+ ` To upgrade it manually, diff data.reference/prompts/stages/${filename}\n` ++ ` against data/prompts/stages/${filename} and adopt the complete series-linked profile contract.`,+});++export { applyMigration };+export default { up };diff --git a/scripts/migrations/256-series-linked-character-profiles.test.js b/scripts/migrations/256-series-linked-character-profiles.test.jsnew file mode 100644index 0000000000..8f4d8bee6a--- /dev/null+++ b/scripts/migrations/256-series-linked-character-profiles.test.js@@ -0,0 +1,35 @@+import { readFileSync } from 'fs';+import { describe, expect, it } from 'vitest';++import { repoRoot, runPromptMigrationTests } from './_testHelpers.js';+import migration, {+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ applyMigration,+} from './256-series-linked-character-profiles.js';++describe('migration 256 — series-linked character profiles', () => {+ runPromptMigrationTests({+ migration,+ applyMigration,+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ prefix: 'migration-256-series-linked-character-profiles-',+ });++ it('requires complete supporting-cast profiles in both architect and judge', () => {+ const architect = readFileSync(+ `${repoRoot}/data.reference/prompts/stages/pipeline-character-foundation.md`,+ 'utf8',+ );+ const judge = readFileSync(+ `${repoRoot}/data.reference/prompts/stages/pipeline-judge-foundation.md`,+ 'utf8',+ );+ expect(architect).toContain('Fully author the bible profile');+ expect(architect).toContain('"pronouns"');+ expect(architect).toContain('"skills"');+ expect(judge).toContain('every character linked to this series');+ expect(judge).toContain('supporting character');+ });+});diff --git a/server/services/pipeline/foundationJudge.js b/server/services/pipeline/foundationJudge.jsindex 06130578f3..fa6641bfde 100644--- a/server/services/pipeline/foundationJudge.js+++ b/server/services/pipeline/foundationJudge.js@@ -163,6 +163,7 @@ export function foundationInputs(series, universe, issues = []) {name: c.name,role: c.role || '',...pickFrameworkFields(c),+ ...pickProfileFields(c),...pickVisualFoundationFields(c),})),arc: series?.arc || null,@@ -189,6 +190,13 @@ export function foundationInputs(series, universe, issues = []) {// Lie → Want → Need chain + secrets + arc fields). Shared by the hash projection// and the "thinnest character" fix target so both read the SAME field set.const FRAMEWORK_STRING_FIELDS = Object.freeze(['ghost', 'wound', 'lie', 'want', 'need', 'coreTheme', 'motivations', 'speechPattern']);+// A dramatic engine alone does not make a complete bible card. These fields+// prevent a later drafter or renderer from having to invent a supporting+// character's identity, behavior, and capabilities after the plot is settled.+const PROFILE_STRING_FIELDS = Object.freeze([+ 'pronouns', 'age', 'speechAccent', 'personality', 'background',+ 'likes', 'dislikes', 'mannerisms', 'relationships', 'skills',+]);// Identity-bearing visual axes a graphic-novel lead needs before the plot is// allowed to grow around them. This intentionally stops short of requiring a// human facial-expression or wardrobe sheet from non-human characters.@@ -204,6 +212,10 @@ function pickFrameworkFields(c) {return out;}+function pickProfileFields(c) {+ return Object.fromEntries(PROFILE_STRING_FIELDS.map((field) => [field, c?.[field] || '']));+}+function pickVisualFoundationFields(c) {const out = {};for (const field of VISUAL_FOUNDATION_STRING_FIELDS) out[field] = c?.[field] || '';@@ -397,6 +409,9 @@ function renderCharacterLine(c, { core = false } = {}) {const framework = FRAMEWORK_STRING_FIELDS.map((field) => `${field}: ${concise(c?.[field])}`).join(' | ');+ const profile = PROFILE_STRING_FIELDS+ .map((field) => `${field}: ${concise(c?.[field])}`)+ .join(' | ');const secrets = (Array.isArray(c?.secrets) ? c.secrets : []).map(concise).slice(0, 3)@@ -416,7 +431,7 @@ function renderCharacterLine(c, { core = false } = {}) {...VISUAL_FOUNDATION_STRING_FIELDS.map((field) => `${field}: ${visualString(field)}`),...VISUAL_FOUNDATION_LIST_FIELDS.map((field) => `${field}: ${visualList(field)}`),].join(' | ');- return `- ${core ? '[CORE] ' : ''}**${c?.name || 'Unnamed'}**${role} — ${framework} | arcType: ${c?.arcType || '—'} | secrets: ${secrets || '—'} | visual foundation: ${visual}`;+ return `- ${core ? '[CORE] ' : ''}**${c?.name || 'Unnamed'}**${role} — dramatic framework: ${framework} | profile: ${profile} | arcType: ${c?.arcType || '—'} | secrets: ${secrets || '—'} | visual foundation: ${visual}`;}function countOccurrences(text, value) {@@ -455,6 +470,7 @@ export function rankFoundationCharacters(characters, series, issues = [], { incl.filter((character) => character && (includeLocked || character.locked !== true)).map((character, index) => {const blanks = FRAMEWORK_STRING_FIELDS.filter((field) => isBlankString(character[field])).length+ + PROFILE_STRING_FIELDS.filter((field) => isBlankString(character[field])).length+ (isBlankArray(character.secrets) ? 1 : 0)+ VISUAL_FOUNDATION_STRING_FIELDS.filter((field) => isBlankString(character[field])).length+ VISUAL_FOUNDATION_LIST_FIELDS.filter((field) => isBlankArray(character[field])).length;@@ -462,9 +478,11 @@ export function rankFoundationCharacters(characters, series, issues = [], { inclconst authoredArc = authoredArcKeys.has(character.id)|| authoredArcKeys.has(`name:${String(character.name || '').trim().toLowerCase()}`);const coreRole = /protagonist|lead|hero|antagonist|villain|deuteragonist|mentor/i.test(character.role || '');- return { character, index, mentions, authoredArc, coreRole, blanks };+ const seriesOwned = !!series?.id && character.sourceSeriesId === series.id;+ return { character, index, mentions, authoredArc, coreRole, seriesOwned, blanks };}).sort((a, b) => Number(b.authoredArc) - Number(a.authoredArc)+ || Number(b.seriesOwned) - Number(a.seriesOwned)|| Number(b.coreRole) - Number(a.coreRole)|| b.mentions - a.mentions|| b.blanks - a.blanks@@ -484,7 +502,7 @@ export function rankFoundationCharacters(characters, series, issues = [], { incl*/export function seriesFoundationCharacters(characters, series, issues = []) {const ranked = rankFoundationCharacters(characters, series, issues, { includeLocked: true });- const referenced = ranked.filter(({ authoredArc, mentions }) => authoredArc || mentions > 0);+ const referenced = ranked.filter(({ authoredArc, mentions, seriesOwned }) => authoredArc || mentions > 0 || seriesOwned);const selected = referenced.length > 0 ? referenced : ranked.slice(0, 6);return selected.map(({ character }) => character);}@@ -496,8 +514,8 @@ function repairableSeriesFoundationCharacters(characters, series, issues = []) {/*** Blank foundation fields across the cast a `character` repair is allowed to- * write — the series roster minus locked members, over the SAME framework +- * visual field sets the character dimension is scored on.+ * write — the series roster minus locked members, over the SAME framework,+ * profile, and visual field sets the character dimension is scored on.** This is the gate's objective, LLM-free second opinion on a repair the judge* scored as a tie. A judge can misread the cast — a presence-marker render once@@ -865,6 +883,7 @@ export function thinnestCharacter(characters) {for (const c of list) {if (!c || c.locked === true) continue;const blanks = FRAMEWORK_STRING_FIELDS.filter((f) => isBlankString(c[f])).length+ + PROFILE_STRING_FIELDS.filter((field) => isBlankString(c[field])).length+ (isBlankArray(c.secrets) ? 1 : 0)+ VISUAL_FOUNDATION_STRING_FIELDS.filter((field) => isBlankString(c[field])).length+ VISUAL_FOUNDATION_LIST_FIELDS.filter((field) => isBlankArray(c[field])).length;@@ -876,6 +895,7 @@ export function thinnestCharacter(characters) {const REPAIRABLE_CHARACTER_FIELDS = Object.freeze([...FRAMEWORK_STRING_FIELDS,+ ...PROFILE_STRING_FIELDS,...VISUAL_FOUNDATION_STRING_FIELDS,...VISUAL_FOUNDATION_LIST_FIELDS,'arcType',@@ -1386,6 +1406,7 @@ async function repairCharacters(series, issues, universe, finding, options) {function hasCompleteFramework(character) {return FRAMEWORK_STRING_FIELDS.every((field) => !isBlankString(character?.[field]))+ && PROFILE_STRING_FIELDS.every((field) => !isBlankString(character?.[field]))&& !isBlankArray(character?.secrets)&& !isBlankString(character?.arcType)&& VISUAL_FOUNDATION_STRING_FIELDS.every((field) => !isBlankString(character?.[field]))@@ -1910,6 +1931,7 @@ export const __testing = {CHARACTER_FOUNDATION_TIMEOUT_MS,CHARACTER_FOUNDATION_BATCH_SIZE,FRAMEWORK_STRING_FIELDS,+ PROFILE_STRING_FIELDS,mismatchedFoundationFields,comparableUniverseFields,CANON_WRITE_PATH_OWNED_FIELDS,diff --git a/server/services/pipeline/foundationJudge.test.js b/server/services/pipeline/foundationJudge.test.jsindex 1b303a2a73..c71e765319 100644--- a/server/services/pipeline/foundationJudge.test.js+++ b/server/services/pipeline/foundationJudge.test.js@@ -293,6 +293,12 @@ describe('foundationInputsHash + staleness — fast-pass pinning', () => {};expect(foundationInputsHash(series, base)).not.toBe(foundationInputsHash(series, designed));});+ it('changes when a series-linked character profile field changes', () => {+ const series = { id: 'ser-1', premise: 'Lead crosses the flooded city.' };+ const base = { characters: [{ id: 'c1', name: 'Support', sourceSeriesId: 'ser-1', pronouns: '' }] };+ const designed = { characters: [{ ...base.characters[0], pronouns: 'they/them', skills: 'pressure-system maintenance' }] };+ expect(foundationInputsHash(series, base)).not.toBe(foundationInputsHash(series, designed));+ });it('changes when the protected author intent changes', () => {const base = { starterPrompt: 'A clockmaker discovers that dragons control the weather.' };const drifted = { starterPrompt: 'Train conductors regulate an intercity signal network.' };@@ -394,6 +400,19 @@ describe('rankFoundationCharacters — core-cast repair targets', () => {expect(seriesFoundationCharacters(characters, series)).toHaveLength(9);});+ it('keeps every character explicitly minted by this series even before the synopsis names them', () => {+ const characters = [+ { id: 'lead', name: 'Lead' },+ { id: 'support', name: 'Support', sourceSeriesId: 'ser-1' },+ { id: 'other', name: 'Other', sourceSeriesId: 'ser-2' },+ ];+ const series = { id: 'ser-1', characterArcs: [{ characterId: 'lead' }] };+ const ids = seriesFoundationCharacters(characters, series).map((character) => character.id);++ expect(ids).toEqual(expect.arrayContaining(['lead', 'support']));+ expect(ids).not.toContain('other');+ });+it('uses a six-character fallback only before story references exist', () => {const characters = Array.from({ length: 9 }, (_, index) => ({id: `chr-${index + 1}`,@@ -409,13 +428,16 @@ describe('countFoundationCharacterBlanks — objective repair evidence', () => {const authoredLead = {...blankLead,ghost: 'g', wound: 'w', lie: 'l', want: 'wa', need: 'n', coreTheme: 'c', motivations: 'm', speechPattern: 's',+ pronouns: 'they/them', age: 'thirty', speechAccent: 'low measured register',+ personality: 'careful', background: 'trained on the docks', likes: 'tea', dislikes: 'waste',+ mannerisms: 'counts breaths', relationships: 'protective of the crew', skills: 'pressure repair',secrets: ['one'],physicalDescription: 'p', visualNotes: 'v', silhouetteNotes: 'si', visualIdentity: 'vi',colorPalette: [{ name: 'Rope Tan', hex: '#B89A6A' }],};- it('drops to zero once every framework and visual field is authored', () => {- expect(countFoundationCharacterBlanks([blankLead], series)).toBe(14);+ it('drops to zero once every framework, profile, and visual field is authored', () => {+ expect(countFoundationCharacterBlanks([blankLead], series)).toBe(24);expect(countFoundationCharacterBlanks([authoredLead], series)).toBe(0);});@@ -431,8 +453,8 @@ describe('countFoundationCharacterBlanks — objective repair evidence', () => {{ characterId: 'chr-locked', characterName: 'Locked' },],};- // Only the unlocked, story-referenced lead contributes its 14 blanks.- expect(countFoundationCharacterBlanks(cast, lockedSeries)).toBe(14);+ // Only the unlocked, story-referenced lead contributes its 24 blanks.+ expect(countFoundationCharacterBlanks(cast, lockedSeries)).toBe(24);});it('treats a missing cast as nothing to measure rather than throwing', () => {@@ -865,6 +887,22 @@ describe('foundation judge context — complete planning altitude', () => {expect(ctx.characterRoster).not.toContain('physicalDescription: ready');});+ it('shows profile blanks for a series-linked supporting character', () => {+ const ctx = __testing.buildFoundationContext({+ series: { id: 'ser-1', name: 'Example Series', seasons: [] },+ universe: {},+ canon: { characters: [{+ id: 'chr-support', name: 'Support', sourceSeriesId: 'ser-1',+ personality: 'Methodical under pressure', pronouns: '', age: '', skills: '',+ }] },+ issues: [],+ contentMax: 30_000,+ });+ expect(ctx.characterRoster).toContain('personality: Methodical under pressure');+ expect(ctx.characterRoster).toContain('pronouns: —');+ expect(ctx.characterRoster).toContain('skills: —');+ });+it('judges the complete story-referenced cast and excludes unrelated universe assets', () => {const storyCast = Array.from({ length: 8 }, (_, index) => ({id: `chr-${index + 1}`,