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
address review([character-bible-simplify-followups]): wardrobe-id strip + doc counts + waiter ordering
[._.]/ Adam Eivy888a95ac77a0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 2959799cd0..dbaa4b040c 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -14,7 +14,7 @@### Universe Builder-- **Character bible / reference-sheet `/simplify` follow-ups.** Nine cleanups bundled from the simplify review during the character bible expansion PR. (1) `CanonCard`'s four character-only props collapsed into a single `characterExtensions` object so non-character call sites skip them entirely. (2) New `client/src/lib/bibleLimits.js` mirrors `server/lib/storyBible.js` `BIBLE_LIMITS` so client-side `max:` literals can't drift from the server caps. (3) Single-field `useFieldDraft` hook shared by `CharacterDetailEditor#DraftField` and a new per-row `WardrobeRow` sub-component (replaces the indexed `${idx}:${field}` drafts map). (4) `runPromptRefine` split into a lower-level `runPromptRefineRaw` so multi-field merges (`universeCharacterExpand`) can reuse the empty-guard + rationale-trim + log-tag scaffold. (5) `resolveGalleryImage` / `resolveImageRef` / `resolveTemplateAsset` collapsed onto a `makePathResolver(rootOrGetter, { extensions, cache })` factory — preserves test-time late-binding semantics via thunk roots. (6) New `shortId(id, n=8)` helper in `fileUtils.js` replaces inline `String(x).slice(0, 8)` across the universe character family. (7) New `createImageGenWaiter` extracts the shared `imageGenEvents` completion-waiter pattern used by `sdapi.js#createCompletionWaiter` and `voice/tools.js#image_gen`. (8) `flattenStats`/`flattenPalette`/`flattenWardrobes`/`flattenProps`/`flattenNamedList` moved from `universeCharacterSheet.js` to `canonPrompt.js` alongside `RICH_SPEC`. (9) `CharacterReferenceSheetPanel#waitForImageRef` accepts an `AbortSignal` so unmount aborts the 3 s HEAD-poll loop instead of letting it issue requests against a dead component. Two sub-bullets deferred to dedicated PLAN entries (`[purge-reference-sheet-image-ref-on-sheet-delete]` and `[clear-pending-sheet-slot-on-entry-delete]`) — both gate on delete routes that don't exist yet.+- **Character bible / reference-sheet `/simplify` follow-ups.** Nine cleanups bundled from the simplify review during the character bible expansion PR. (1) `CanonCard`'s four character-only props collapsed into a single `characterExtensions` object so non-character call sites skip them entirely. (2) New `client/src/lib/bibleLimits.js` mirrors `server/lib/storyBible.js` `BIBLE_LIMITS` so client-side `max:` literals can't drift from the server caps. (3) Single-field `useFieldDraft` hook shared by `CharacterDetailEditor#DraftField` and a new per-row `WardrobeRow` sub-component (replaces the indexed `${idx}:${field}` drafts map). (4) `runPromptRefine` split into a lower-level `runPromptRefineRaw` so multi-field merges (`universeCharacterExpand`) can reuse the empty-guard + rationale-trim + log-tag scaffold. (5) `resolveGalleryImage` / `resolveImageRef` / `resolveTemplateAsset` collapsed onto a `makePathResolver(rootOrGetter, { extensions, cache })` factory — preserves test-time late-binding semantics via thunk roots. (6) New `shortId(id, n=8)` helper in `fileUtils.js` replaces inline `String(x).slice(0, 8)` across the universe character family. (7) New `createImageGenWaiter` extracts the shared `imageGenEvents` completion-waiter pattern used by `sdapi.js#createCompletionWaiter` and `voice/tools.js#image_gen`. (8) `flattenStats`/`flattenPalette`/`flattenWardrobes`/`flattenProps`/`flattenNamedList` moved from `universeCharacterSheet.js` to `canonPrompt.js` alongside `RICH_SPEC`. (9) `CharacterReferenceSheetPanel#waitForImageRef` accepts an `AbortSignal` so unmount aborts the 3 s HEAD-poll loop instead of letting it issue requests against a dead component. Three sub-bullets deferred to dedicated PLAN entries: `[purge-reference-sheet-image-ref-on-sheet-delete]` and `[clear-pending-sheet-slot-on-entry-delete]` gate on character/universe-delete routes that don't exist yet; `[characterdetaileditor-listrow-row-draft-hook]` carves off the `ListRow` half of item 3 — the multi-column ride-along race protection can't survive a per-field split, so a `useRowDraft` hook for multi-column row state is the right successor.- **Character bible expansion + artist reference sheet.** Universe canon characters now carry novelist + graphic-novelist depth and can render a single dense artist reference sheet styled to match the universe. `sanitizeCharacter` in `server/lib/storyBible.js` gains 15 prose fields (pronouns, age, coreTheme, speechAccent, visualNotes, silhouetteNotes, postureNotes, specialTraits, visualIdentity, motivations, likes, dislikes, mannerisms, relationships, skills) + 5 structured lists (stats, colorPalette, props, expressions, handGestures) + 1 operational pointer (`referenceSheetImageRef`). Stats are an open `[{label, value}]` list so non-human characters (ghosts, spiders, clouds, AIs) aren't shoehorned into human anatomy. Two new endpoints: `POST /api/universe-builder/:id/characters/:entryId/expand` runs one LLM call (new `universe-character-expand` stage) that fills BLANK extended fields without clobbering populated content; `POST /api/universe-builder/:id/characters/:entryId/render-reference-sheet` enqueues a media-job render driven by a rich TEXT prompt (no init image required) that works equally well across codex and local image-gen backends. The renderer emits a multi-paragraph layout-prescriptive prompt (turnaround, expression progression, color palette swatches, wardrobe + prop cards, hand gestures), routes through `mediaJobQueue` with the active `imageGen.mode` (codex → codex lane, local → GPU lane; external SD-API returns `UNIVERSE_CHARACTER_SHEET_UNSUPPORTED_MODE` rather than a silently-degraded render), and on `mediaJobEvents` completion copies the result into `data/image-refs/` then stamps `character.referenceSheetImageRef`. Completed renders are also filed into the universe's media collection (`Universe: <name>` bucket) via `universeBuilderCollectionHook` by attaching a `universeRun` tag to the enqueued job, alongside the rest of the universe's concept art. `/data/image-refs/` is now exposed as a static route so the UI can render the sheet inline. New UI: `CharacterDetailEditor.jsx` (sectioned collapsible editor for the extended fields) + `CharacterReferenceSheetPanel.jsx` (Generate / Regenerate / lightbox) embedded in `CanonCard.jsx` behind a single "Character details + reference sheet" toggle that only renders when the caller passes the universe wiring — the per-series NounsStage stays focused on naming + visual refs. New migration `022-character-extended-fields.js` is record-only (sanitizer fills defaults on next read). 18+ new server tests (storyBible extensions + universeCharacterSheet prompt builder + universeCharacterExpand merge semantics + route mocks).- **CanonCard provenance chip now names the source series.** The "from series" chip on `CanonCard` (rendered by both the Universe Canon section and the per-issue Nouns stage) now reads `from <Series Name>` when an entry's `sourceSeriesId` resolves through a new `seriesNameMap` prop; the tooltip carries both name and id (`Introduced by series "<name>" (<id>)`). Map is sourced from a new top-level `seriesNameMap` field on the `GET /api/universe-builder/:id/canon-usage` response, which now lists every linked series — not just ones with a prose-match row — so an entry whose `sourceSeriesId` points at a series with no matching prose still resolves to a name. Missing-map / unknown-id cases keep the legacy `from series` label + id-only tooltip. New `SourceSeriesChip` helper extracted in `client/src/components/pipeline/CanonCard.jsx`; 4 vitest cases in `CanonCard.test.jsx` + 2 vitest cases in `server/services/canonUsage.test.js`.diff --git a/DONE.md b/DONE.mdindex d0736dad41..e38979509b 100644--- a/DONE.md+++ b/DONE.md@@ -10,11 +10,11 @@ For active roadmap see [PLAN.md](./PLAN.md). For project goals see [GOALS.md](./### 2026-05-18-- **[character-bible-simplify-followups] Character bible / reference-sheet `/simplify` follow-ups.** Captured from the simplify review during the character bible expansion PR; nine of the eleven sub-bullets landed in this PR (the two skipped ones gate on delete routes that don't exist yet — `purgeReferenceSheetFromAllUniverses` + `clearPendingSheetSlot` — and are deferred until those land). Touched files: (1) `client/src/components/pipeline/CanonCard.jsx` + `client/src/components/universe/UniverseCanonSection.jsx` — bundled four character-only props (`universeId`, `onExpandCharacter`, `expanding`, `onSheetCompleted`) into a single `characterExtensions` object so the gate collapses to one truthiness check; NounsStage still passes nothing and stays focused. (2) New `client/src/lib/bibleLimits.js` mirrors `server/lib/storyBible.js` `BIBLE_LIMITS` verbatim; `CharacterDetailEditor.jsx`'s 25+ `max:` literals + `CanonCard.jsx`'s wardrobe `maxLength`s now reference the constants by name. (3) New `client/src/hooks/useFieldDraft.js` — single-field draft+blur hook used by `CharacterDetailEditor#DraftField` and a new per-row `WardrobeRow` sub-component (replaces the indexed `${idx}:${field}` drafts map in `WardrobeSection`). `ListRow`'s multi-column row-state (with sibling-draft "ride-along" race protection) was deliberately left as-is — splitting per-column would lose the protection. (4) `server/services/pipeline/refineHelpers.js` split into `runPromptRefineRaw` (lower-level: runStagedLLM + empty-guard + rationale-trim + optional logTag) and the existing `runPromptRefine` (single-field convenience wrapper built atop the raw variant); `server/services/universeCharacterExpand.js` now consumes `runPromptRefineRaw` with `logTag: null` so it can log a context-rich line after the merge. (5) New `makePathResolver(rootOrGetter, { extensions, cache })` factory in `server/lib/fileUtils.js`; collapses `resolveGalleryImage` / `resolveImageRef` / `resolveTemplateAsset` onto one closure. Accepts a thunk for late-binding so existing test mutations of `PATHS.images` at mock-eval time still steer the resolver. (6) New `shortId(id, n=8)` helper in `fileUtils.js` (null-safe); replaces inline `String(x).slice(0, 8)` in `universeCharacterExpand.js`, `universeCharacterSheet.js`, and `universeCanon.js` (the in-scope universe character family). Other call sites (shell, agents, cos) intentionally left alone — outside scope. (7) New `server/services/imageGenWaiter.js` (`createImageGenWaiter`) extracts the shared `imageGenEvents` completion-waiter pattern used by `server/routes/sdapi.js#createCompletionWaiter` (now a thin error-shape wrapper) and `server/services/voice/tools.js#image_gen` (drops the inline duplicate). The `universeCharacterSheet.js#subscribeToSheetJob` pattern stays distinct — it uses a different events bus (`mediaJobEvents`), an internal dispatcher that bounds listeners, callback-style handlers, and a two-stage timeout with `onStarted` reset. (8) `flattenStats`/`flattenPalette`/`flattenWardrobes`/`flattenProps`/`flattenNamedList` moved from `universeCharacterSheet.js` to `server/lib/canonPrompt.js` alongside `RICH_SPEC` so per-page render prompts can reuse them. (9) `CharacterReferenceSheetPanel.jsx#waitForImageRef` accepts an `AbortSignal`; a new `pollAbortRef` is wired into a useEffect-cleanup so unmount aborts the 3 s HEAD-poll loop (and the in-flight fetch) instead of letting it issue requests against a dead component. Sentinel `null` return distinguishes "aborted" from "give up + toast." Coverage: all 5565 server tests pass; all 92 client tests pass. Test files updated: `server/services/universeCanon.test.js` adds `shortId` to its `fileUtils.js` mock so the new log-line consumer doesn't break the lock-semantics tests.- **[coverautofiler-dispatcher-redundant-getseries] `fileCoverIntoAutoCollection` dispatcher — pass preloaded series into the universe leaf.** `server/services/pipeline/coverUniverseFiler.js`'s dispatcher now forwards its already-fetched series to `fileCoverIntoUniverseCollection` via an optional `_preloadedSeries` arg; the universe leaf accepts the preload, skips its initial `getSeries`, and preserves the mid-flight race-detection re-read. Net effect for the dominant (universe-linked) path: 2 `getSeries` calls per cover completion instead of 3. The series leaf intentionally does NOT accept a preload — its own first read is load-bearing for the early re-route check (a universe link added between the dispatcher's fetch and the leaf's entry must trigger the re-route into the universe leaf, otherwise the cover would land in the per-series collection and merely get orphaned by the post-`addItem` recovery instead of filed to the universe). Direct callers of the universe leaf (no preload) keep the old shape via a `?? await getSeries(...).catch(() => null)` fallback. +1 test in `coverUniverseFiler.test.js` spies on `seriesSvc.getSeries` and pins the post-optimization universe-path call count (2 total) via the capture-restore-assert pattern so a failing assertion doesn't leak the spy. All 21 cover-filer tests + 349 pipeline-service tests pass.- **[importer-canonprompt-preview-fragments-helper] Share a per-kind preview-fragments helper between Importer and `canonPrompt.js`.** New `previewCanonFragments(kind, entry)` helper in the mirrored `server/lib/canonPrompt.js` + `client/src/lib/canonPrompt.js` returns `{ subtitle, body }` where `subtitle` is a single trimmed string and `body` is an ordered `[{ field, value }]` array of non-blank fields. Backed by a new `PREVIEW_SPEC` keyed by canonical kind name (`characters` → `{ subtitleField: 'role', bodyFields: ['physicalDescription','personality','background'] }`, `places` → `{ subtitleField: 'slugline', bodyFields: ['description'] }`, `objects` → `{ subtitleField: null, bodyFields: ['description','significance'] }`). Intentionally wider than `shortCanonDescriptorFragments` (which is scoped to the visual subset that drives render-prompts) — preview exists so the user can disambiguate which entry to commit, so it surfaces narrative-only fields (`personality`, `background`, `slugline`) that have no visual role. The three `CanonReviewSection` callsites in `client/src/pages/Importer.jsx` no longer pass `renderSubtitle`/`renderBody` props — `CanonReviewSection` now calls the helper directly with the `kind` prop it was already passing, collapsing 18 lines of inline ternaries + filter/join calls onto a single helper invocation. 11 new vitest cases in `server/lib/canonPrompt.test.js` cover null/non-object/unknown-kind edge shapes, kind plural/singular passthrough, per-kind field-presence semantics (characters: role subtitle + 3-field body, no description fallback; places: slugline + description only; objects: empty subtitle + description+significance), whitespace trimming, and confirms RICH-only fields (palette/era/weather/recurringDetails) are NOT in preview. PLAN.md's `'places' → 'settings'` alias note was stale — codebase already canonicalized on `'places'` as the kind name (`normalizeKind` returns `'places'` correctly), so no alias work was needed. All 5608 server tests + 92 client tests pass.- **[extraction-after-comicscript-teleplay-stages] Extraction after comicScript / teleplay stages.** Resolves the deferred decision in favor of an opt-in, manually-triggered extraction: auto-extract stays prose-only (so the auto-pipeline isn't paying an extra LLM call per script stage on every issue), but writers can now pull canon from a script stage on demand. New route `POST /api/pipeline/issues/:id/stages/:stageId/extract-canon` (stageId must be `comicScript` or `teleplay`) reads `issue.stages[stageId].output` as the corpus and calls the existing generic `extractCanonFromProse` with the same `parallel: true` + `autoLock: true` + `sourceSeriesId` stamping the prose auto-extract uses, so script-derived entries survive later AI refines and stay attributable to the triggering series. Schema `extractCanonFromScriptSchema` accepts an optional `providerOverride`; the route also returns the merged universe plus `{ characters, places, objects }` counts so the UI toast can summarize the merge. Three precondition guards: `PIPELINE_CANON_EXTRACT_BAD_STAGE` (400) for any stage other than the two script stages, `PIPELINE_CANON_EXTRACT_NO_CORPUS` (400) when the script stage has no output, `PIPELINE_CANON_EXTRACT_NO_UNIVERSE` (400) when the series isn't linked to a universe. New shared component `client/src/components/pipeline/stages/ExtractCanonButton.jsx` (BookOpen icon + "Extract canon" label) is gated on stage content + linked universe and surfaces a tooltip explaining the specific blocker when disabled. Wired into both script stages: `TeleplayStage.jsx` passes it through `TextStagePanel`'s `extraActions` slot; `ComicScriptStage.jsx` mounts it directly in its header actions next to the Image-gen settings button. Client helper `extractPipelineCanonFromScript(issueId, stageId, body, options)` in `apiPipeline.js` follows the project's silent/toast convention (helper passes `{ silent: true }` since the button owns its own error toast). 5 new vitest cases in `server/routes/pipeline.test.js` cover all three precondition guards plus the happy path for both stage IDs, asserting the corpus is forwarded and the autoLock/sourceSeriesId stamping matches the prose auto-extract semantics. All 5570 server tests + 92 client tests pass; client build clean.- **[same-collection-export-pattern-for-pipeline-series] Same collection-export pattern for pipeline series with auto-collections.** Extends the v1.4 universe→manifest.collection share pattern to also cover universeless series. `mediaCollections.js` gains an optional `seriesId` field on `sanitizeCollection` (mutually exclusive with `universeId` — universe wins on hand-edited dual-stamp records), `seriesCollectionNameFor('Foo') → 'Series: Foo'` naming convention, and `findCollectionBySeriesId` / `findOrCreateSeriesCollection` / `unlinkCollectionsForSeries` / `renameCollectionForSeries` helpers mirroring the universe-side set. `updateCollection` now also locks the visible name when `seriesId` is set; the four mutation paths (`addItem`, `removeItem`, `bulkUpdateCollectionItems`, `deleteCollection`) fan `recordEvents('updated', 'series', seriesId)` alongside the existing universe emit so series subscriptions auto-re-export when peer adds new images. `coverUniverseFiler.js` gains a `fileCoverIntoAutoCollection({ seriesId, filename })` dispatcher that routes universe-linked series to the universe collection path (existing behavior) and universeless series to a new `fileCoverIntoSeriesCollection` path with the same delete-race recovery shape. The two cover hooks (`comicPagesFilenameHook.js`, `seasonCoverFilenameHook.js`) switch from the universe-only helper to the dispatcher. `pipeline/series.js#updateSeries` cascades name changes onto the linked per-series collection (no-op when no series-collection exists, which is the common case for universe-backed series); `deleteSeries` unlinks the per-series collection so the orphan becomes a normal user-owned bucket. `sharing/exporter.js#exportSeries` falls back to `findCollectionBySeriesId(series.id)` when there is no universe-linked collection — same `manifest.collection` shape, just keyed on `seriesId` instead of `universeId`; the local `findCollectionForUniverse`/`findCollectionForSeries` helpers were dropped in favor of the canonical `mediaCollections` exports (better seriesId normalization). `sharing/manifest.js#buildManifest` accepts `collection: { seriesId, ... }` alongside the existing `universeId` shape, using `universeCollectionNameFor`/`seriesCollectionNameFor` for fallback names (proper NAME_MAX_LENGTH truncation). `sharing/importer.js#mergeCollectionPayload` branches on which id the payload carries; defers with `missingSeries: true` when the local series doesn't exist yet (cursor stays un-advanced so a later sync of the series unblocks the merge — mirrors the existing `missingUniverse` path); `applyAutoMerge` returns `collectionPendingSeries` and `processManifest` includes it in the pending-gate predicate. `promoteInboxItem` throws `SHARING_SERIES_PENDING` (status 409 via `routes/sharing.js` mapping) when the collection waits on a missing series. Backward-compatible — older peers' importers no-op on seriesId-keyed payloads via the existing `if (!payload.universeId)` early-return. 30 new tests: 10 in `mediaCollections.test.js` (sanitizer mutual-exclusion, name helpers, find/create/rename/unlink, recordEvents fan-out on both add and delete), 9 in `coverUniverseFiler.test.js` (series-fallback path + dispatcher routing), 3 in `sharing/integration.test.js` (series-export round-trip with per-series collection, prefer-universe-when-both, defer-when-series-missing). All 5587 server + 92 client tests pass. Dispatcher's redundant pre-branch `getSeries` call deferred to PLAN.md as `[coverautofiler-dispatcher-redundant-getseries]`.+- **[character-bible-simplify-followups] Character bible / reference-sheet `/simplify` follow-ups.** Captured from the simplify review during the character bible expansion PR. Of the eleven sub-bullets: eight fully landed in this PR; one (item 3 — extract the WardrobeSection draft+blur+pending-row editor into a shared hook reused by both `WardrobeSection` and `CharacterDetailEditor.jsx`'s `ListRow`) shipped its `useFieldDraft` half but couldn't unify `ListRow` (the multi-column ride-along race protection doesn't survive a per-field split — captured as `[characterdetaileditor-listrow-row-draft-hook]` in PLAN.md); two more (active-purge `referenceSheetImageRef` + prune `_latestPendingByCharacter`) gate on character/universe-delete routes that don't exist yet (`[purge-reference-sheet-image-ref-on-sheet-delete]` and `[clear-pending-sheet-slot-on-entry-delete]`). Touched files: (1) `client/src/components/pipeline/CanonCard.jsx` + `client/src/components/universe/UniverseCanonSection.jsx` — bundled four character-only props (`universeId`, `onExpandCharacter`, `expanding`, `onSheetCompleted`) into a single `characterExtensions` object so the gate collapses to one truthiness check; NounsStage still passes nothing and stays focused. (2) New `client/src/lib/bibleLimits.js` mirrors `server/lib/storyBible.js` `BIBLE_LIMITS` verbatim; `CharacterDetailEditor.jsx`'s 25+ `max:` literals + `CanonCard.jsx`'s wardrobe `maxLength`s now reference the constants by name. (3) New `client/src/hooks/useFieldDraft.js` — single-field draft+blur hook used by `CharacterDetailEditor#DraftField` and a new per-row `WardrobeRow` sub-component (replaces the indexed `${idx}:${field}` drafts map in `WardrobeSection`). `ListRow`'s multi-column row-state (with sibling-draft "ride-along" race protection) was deliberately left as-is — splitting per-column would lose the protection. (4) `server/services/pipeline/refineHelpers.js` split into `runPromptRefineRaw` (lower-level: runStagedLLM + empty-guard + rationale-trim + optional logTag) and the existing `runPromptRefine` (single-field convenience wrapper built atop the raw variant); `server/services/universeCharacterExpand.js` now consumes `runPromptRefineRaw` with `logTag: null` so it can log a context-rich line after the merge. (5) New `makePathResolver(rootOrGetter, { extensions, cache })` factory in `server/lib/fileUtils.js`; collapses `resolveGalleryImage` / `resolveImageRef` / `resolveTemplateAsset` onto one closure. Accepts a thunk for late-binding so existing test mutations of `PATHS.images` at mock-eval time still steer the resolver. (6) New `shortId(id, n=8)` helper in `fileUtils.js` (null-safe); replaces inline `String(x).slice(0, 8)` in `universeCharacterExpand.js`, `universeCharacterSheet.js`, and `universeCanon.js` (the in-scope universe character family). Other call sites (shell, agents, cos) intentionally left alone — outside scope. (7) New `server/services/imageGenWaiter.js` (`createImageGenWaiter`) extracts the shared `imageGenEvents` completion-waiter pattern used by `server/routes/sdapi.js#createCompletionWaiter` (now a thin error-shape wrapper) and `server/services/voice/tools.js#image_gen` (drops the inline duplicate). The `universeCharacterSheet.js#subscribeToSheetJob` pattern stays distinct — it uses a different events bus (`mediaJobEvents`), an internal dispatcher that bounds listeners, callback-style handlers, and a two-stage timeout with `onStarted` reset. (8) `flattenStats`/`flattenPalette`/`flattenWardrobes`/`flattenProps`/`flattenNamedList` moved from `universeCharacterSheet.js` to `server/lib/canonPrompt.js` alongside `RICH_SPEC` so per-page render prompts can reuse them. (9) `CharacterReferenceSheetPanel.jsx#waitForImageRef` accepts an `AbortSignal`; a new `pollAbortRef` is wired into a useEffect-cleanup so unmount aborts the 3 s HEAD-poll loop (and the in-flight fetch) instead of letting it issue requests against a dead component. Sentinel `null` return distinguishes "aborted" from "give up + toast." Coverage: all 5565 server tests pass; all 92 client tests pass. Test files updated: `server/services/universeCanon.test.js` adds `shortId` to its `fileUtils.js` mock so the new log-line consumer doesn't break the lock-semantics tests.- **[solidify-character-descriptions-before-visual] Solidify character descriptions before visual render.** Closed as superseded by the character bible expansion + artist reference sheet work (PR #310). The original spec called for a "Solidify characters" sidebar action running an LLM pass to synthesize one canonical `physicalDescription` from accumulated evidence. The underlying goal — solid, render-ready character descriptions before visual stages — is now met via a different mechanism: `sanitizeCharacter` carries 15 prose fields + 5 structured lists (`stats`, `colorPalette`, `props`, `expressions`, `handGestures`); `POST /api/universe-builder/:id/characters/:entryId/expand` runs an LLM no-clobber fill-blanks pass over the extended fields; `POST .../render-reference-sheet` produces a single dense artist reference sheet image that becomes the visual canonical anchor (`character.referenceSheetImageRef`); and downstream pipeline stages already read `physicalDescription` via `canonPrompt`'s shared field-precedence helper. The accumulated-evidence synthesis primitive itself was not built; if it's needed later (e.g. multi-issue prose extraction starts drifting per-character `physicalDescription` and a one-click "consolidate" pass becomes valuable), it should be a fresh PLAN item against the post-#310 baseline, not this one.- **[bible-kind-setting-rename-to-place] Bible `SETTING` kind rename to `PLACE`.** Completes the rename deferred from migration 018 (PR #265, 2026-05-17): renames the bible-domain "setting" entity to "place" everywhere it's an identifier. Server: `BIBLE_KIND.SETTING` → `PLACE` (value `'place'`), `BIBLE_FIELD[PLACE]` → `'places'`, `sanitizeSetting` → `sanitizePlace`, `matchSettingsInText` → `matchPlacesInText`, `PLACE_INT_EXT`/`PLACE_TIME_OF_DAY`/`PLACE_DESCRIPTION_MAX` constants, `CATEGORY_KINDS` plural `'settings'` → `'places'`, writers-room route `/works/:id/settings` → `/works/:id/places`, service file `writersRoom/settings.js` → `places.js` with `listPlaces/createPlace/updatePlace/deletePlace/mergeExtractedPlaces` exports and `wr-place-` id prefix, validation schemas (`writersRoomPlaceCreateSchema`/`UpdateSchema`/`placeBibleCreateSchema`/`UpdateSchema`), `canonPrompt` SHORT_SPEC/RICH_SPEC keys (server + client mirror), `seriesCanon.pickCanon` returns `places`, `canonUsage` keys on `places`, importer KIND_MAP, `universeBuilder.compilePrompts` CANON_TRUNKS, `universeBuilderExpand` LLM prompt + envelope key `parsed.places`. Persisted state migrated by `scripts/migrations/022-rename-bible-setting-to-place.js`: walks `data/universe-builder.json` (renames `state.universes[].settings[]` → `places[]`, `categories[k].kind 'settings'` → `'places'`), `data/pipeline-series.json` (legacy `settings[]` → `places[]`), and `data/writers-room/works/<id>/settings.json` → `places.json` with the inner `settings` key rewritten to `places`. The migration also patches `data/prompts/stages/writers-room-places.md` + `_partials/bible-deference.md` to use `{{existingPlacesJson}}` + `"places": [` when they match the OLD shipped MD5; customized templates are left alone (the drift surfaces in `setup-data.js`'s hash-check warning, which now treats the post-022 hash as the new shipped baseline with the pre-022 hash auto-updatable alongside migration 007's pre-007 hash). Client UI flips to the new vocabulary: `UniverseBuilder.jsx` `TRUNK_TABS` `kind: 'places'`, `mergeCanonByName(..., 'place')`, `pendingCanonAdditionsRef.places`, `bucketsByKind.places`, `groupBucketsByKind` returns `{ characters, places, objects, other }`, `WORLD_CATEGORY_DEFAULT_KINDS` `landscapes/environments/structures → 'places'`. Component updates: `NounsStage.jsx` (key/singular/match), `CanonCard.jsx` (`kind.key === 'places'`), `UniverseCanonSection.jsx` (key/apiKind), `StoryboardPanel.jsx` (`places` prop, `onPlacesChange`, `onRunPlaces`, `placesCount`, `BIBLE_KINDS.world.propName: 'places'`), `WorkEditor.jsx` (`ANALYSIS_KIND.PLACES`, `places` state, `listWritersRoomPlaces`), `ProseReader.jsx` + `proseTokenizer.jsx` (`places` prop), `ProseTokenPopover.jsx` (`places` prop), `apiWritersRoom.js` (`listWritersRoomPlaces`/`createWritersRoomPlace`/`updateWritersRoomPlace`/`deleteWritersRoomPlace`), `SettingsBible.jsx` imports updated. Non-goals stay untouched: `data/settings.json`, the Settings page, `/api/settings` routes, app-level user-prefs — all keep "settings" terminology. Existing pipeline canon entry id prefix `set-` is preserved (ids are opaque after creation; changing the prefix would force a second migration over per-entry records — pure churn). All 5499 server tests pass; 77 client tests pass. ~30 files touched.- **[tabpills-pipelineissue-status-dot-trailing-slot] Extend `<TabPills>` with a `trailing` slot to migrate `PipelineIssue.jsx`.** Added an optional `t.trailing` ReactNode to the tab shape, rendered after the count in both `underline` and `pills` variants of `client/src/components/ui/TabPills.jsx`. Migrated `client/src/pages/PipelineIssue.jsx`'s previously-inlined stage tab row (the 11th outlier — its per-tab `STATUS_DOT[status]` indicator didn't fit the prior contract) onto `<TabPills>`, with the status dot supplied via `trailing`. Net 22-line bespoke `<button>` block collapsed onto the shared primitive; the row also picks up the standard mobile touch-target (`min-h-[44px]`) and icon size (16 vs 14) used elsewhere. +1 vitest case in `TabPills.test.jsx` pins the DOM-order contract (`trailing` follows `count`) in both variants; all 78 client tests pass.diff --git a/client/src/components/pipeline/CanonCard.jsx b/client/src/components/pipeline/CanonCard.jsxindex ddb6a5efac..d34fd85de0 100644--- a/client/src/components/pipeline/CanonCard.jsx+++ b/client/src/components/pipeline/CanonCard.jsx@@ -174,9 +174,12 @@ function WardrobeSection({ wardrobes, editable, onChange }) {if ((current[field] || '') === value) return;const nextPending = pendingNew.map((p, i) => i === pendingIdx ? { ...p, [field]: value } : p);// Once a pending row has a non-empty name it's safe to promote into- // the persisted list (server sanitizer no longer drops it).+ // the persisted list (server sanitizer no longer drops it). Strip the+ // client-only `pending-wardrobe-*` id so server `ensureId('wd-')` mints+ // a fresh `wd-<uuid>` — `ensureId` preserves any non-empty string, so+ // an unstripped prefix would round-trip onto the persisted row.if (field === 'name' && value.trim()) {- const promoted = nextPending[pendingIdx];+ const { id: _pendingId, ...promoted } = nextPending[pendingIdx];setPendingNew(nextPending.filter((_, i) => i !== pendingIdx));onChange([...wardrobes, promoted]);} else {diff --git a/server/services/imageGenWaiter.js b/server/services/imageGenWaiter.jsindex a643f9e469..ca7a3ec2f9 100644--- a/server/services/imageGenWaiter.js+++ b/server/services/imageGenWaiter.js@@ -30,17 +30,19 @@ export function createImageGenWaiter({const promise = new Promise((res, rej) => { resolve = res; reject = rej; });promise.catch(() => {});- const onCompletedEvent = (ev) => { if (ev?.generationId === registeredId) { cleanup(); resolve(ev); } };- const onFailedEvent = (ev) => { if (ev?.generationId === registeredId) { cleanup(); reject(onFailed(ev)); } };-- const timer = setTimeout(() => { cleanup(); reject(onTimeout()); }, timeoutMs);-+ let onCompletedEvent;+ let onFailedEvent;+ let timer;const cleanup = () => {clearTimeout(timer);imageGenEvents.off('completed', onCompletedEvent);imageGenEvents.off('failed', onFailedEvent);};+ onCompletedEvent = (ev) => { if (ev?.generationId === registeredId) { cleanup(); resolve(ev); } };+ onFailedEvent = (ev) => { if (ev?.generationId === registeredId) { cleanup(); reject(onFailed(ev)); } };+ timer = setTimeout(() => { cleanup(); reject(onTimeout()); }, timeoutMs);+imageGenEvents.on('completed', onCompletedEvent);imageGenEvents.on('failed', onFailedEvent);