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(issue-6770): share manuscript category labels

[._.]/ Adam Eivy64283f8b7cf0
diff --git a/client/src/components/pipeline/manuscript/ManuscriptCommentCard.test.jsx b/client/src/components/pipeline/manuscript/ManuscriptCommentCard.test.jsx
index 03839d35b7..cab135387a 100644
--- a/client/src/components/pipeline/manuscript/ManuscriptCommentCard.test.jsx
+++ b/client/src/components/pipeline/manuscript/ManuscriptCommentCard.test.jsx
@@ -1,6 +1,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';
import ManuscriptCommentCard, { Badge } from './ManuscriptCommentCard';
+import { CATEGORY_LABEL } from './constants';
import { Toaster, toast } from '../../ui/Toast';
import {
acceptPipelineManuscriptFix,
@@ -154,6 +155,38 @@ describe('ManuscriptCommentCard keyboard shortcuts (#1603)', () => {
});
});
+describe('ManuscriptCommentCard finding categories (#6770)', () => {
+ it('humanizes every editorial category added after the original manuscript map', () => {
+ const categories = {
+ dialogue: 'Dialogue',
+ naming: 'Naming',
+ world: 'World',
+ character: 'Character',
+ emotion: 'Emotion',
+ opening: 'Opening',
+ cliche: 'Cliché',
+ prose: 'Prose',
+ };
+
+ render(<>{Object.keys(categories).map((category) => (
+ <Badge key={category} comment={{ severity: 'low', category }} />
+ ))}</>);
+
+ for (const label of Object.values(categories)) {
+ expect(screen.getByText(label)).toBeTruthy();
+ }
+ });
+
+ it('keeps manuscript-completeness category labels in the shared map', () => {
+ expect(CATEGORY_LABEL).toMatchObject({
+ 'missing-content': 'Missing content',
+ 'arc-gap': 'Arc gap',
+ 'character-gap': 'Character gap',
+ other: 'Note',
+ });
+ });
+});
+
describe('ManuscriptCommentCard — accept toast offers Undo (#1609)', () => {
beforeEach(() => {
acceptPipelineManuscriptFix.mockReset();
diff --git a/client/src/components/pipeline/manuscript/constants.js b/client/src/components/pipeline/manuscript/constants.js
index f1a0efeaa5..f45abf18b8 100644
--- a/client/src/components/pipeline/manuscript/constants.js
+++ b/client/src/components/pipeline/manuscript/constants.js
@@ -28,35 +28,9 @@ export const SEVERITY_UNDERLINE = {
low: 'border-gray-500',
};
-export const CATEGORY_LABEL = {
- 'missing-content': 'Missing content',
- 'arc-gap': 'Arc gap',
- // Character-arc findings (#1293/#1295): POV justification + transition beats /
- // flat-arc warnings from the arc.transitions editorial check.
- arc: 'Character arc',
- 'character-gap': 'Character gap',
- // Plot-structure findings (#1310): passive protagonist, deus ex machina, idiot
- // plot, flat stakes, sagging middle, dropped subplots from plot.structure-momentum.
- plot: 'Plot structure',
- // Theme-coherence findings (#1317): stated-but-undramatized / dropped / unpaid
- // themes and emergent-theme suggestions from the theme.coherence check.
- theme: 'Theme',
- // Casting findings (#1292/#1312/#1412): roster economy / throwaway names, cast
- // representation balance, and unmodeled proper nouns used as character names.
- casting: 'Casting',
- pacing: 'Pacing',
- continuity: 'Continuity',
- // Real-world fact-accuracy findings (#1588): prose claims that contradict an
- // author-supplied fact reference, from the opt-in research.fact-accuracy check.
- // Distinct from `continuity` (internal contradiction) — this is external truth.
- accuracy: 'Fact accuracy',
- style: 'Style',
- exposition: 'Exposition',
- // Comic lettering-density findings (#1313): over-stuffed balloons/panels/pages
- // from the comic.lettering-density editorial check.
- lettering: 'Lettering',
- other: 'Note',
-};
+// Re-export the server-owned browser-safe leaf so category chips cannot drift
+// from the categories declared by built-in editorial checks.
+export { FINDING_CATEGORY_LABELS as CATEGORY_LABEL } from '../../../../../server/lib/editorial/findingCategories.js';
// Per-check finding sub-classifications (#1626). A finding's optional `subtype`
// names *why* it was flagged within its category — currently only
diff --git a/server/lib/editorial/README.md b/server/lib/editorial/README.md
index fadb7ba178..c32da1d7ff 100644
--- a/server/lib/editorial/README.md
+++ b/server/lib/editorial/README.md
@@ -208,6 +208,7 @@ runner-injected `ctx.callInlineLLM` (an inline-prompt sibling of
| Module | Purpose |
|---|---|
| `checkRegistry.js` | The public entry point. Assembles `EDITORIAL_CHECKS` by spreading the per-category arrays from `./checks/*.js`, re-exports the shared infra from `./checkInfra.js`, and keeps the registry's lookup/state helpers that need the assembled array: `EDITORIAL_SOURCES` (the per-check `sources` vocabulary the staleness runner fingerprints, #1387), fail-fast guards (`assertValidChecks`), and `getCheck`, `getCheckById`, `getAllChecks`, `listChecks`, `resolveCheckState`, `getEnabledChecks`, `resolveCheckConfig`, `orderChecksByDependencies` (the dependency topo-sort, #1627) plus the user-defined-check helpers (`buildCustomCheck`, `readCustomCheckDefs`, `isCustomCheckId`, `isValidCustomCheckDef`). Decomposed from a 7,474-line god file in #1829. |
+| `findingCategories.js` | Browser-safe human labels for built-in editorial-check and manuscript-completeness finding categories, shared by the registry parity guard and manuscript editor. |
| `checkInfra.js` | Shared check infrastructure extracted in #1829: imports + constants + stage names + the pure summary/helper functions (e.g. `runManuscriptLlmCheck`, `canonCharacterTraitsSummary`, `editorialFindingKey`, `buildCustomCheckPrompt`, `normalizeCheckScopes`/`primaryCheckScope`) that the check definitions and the registry tail depend on. Kept side-effect-free so `./checks/*.js` import from it without a cycle through `checkRegistry.js` (whose `EDITORIAL_CHECKS` spread would otherwise hit a TDZ on the checks' eagerly-evaluated `configSchema`s). Re-exports its externals (zod + the sibling primitive modules) so a check file imports everything from one hub. **Since #2842 this file is a pure re-exporting barrel over `./checkInfra/*.js`** (it had grown to 2,635 lines spanning a dozen sub-domains); every existing `from './checkInfra.js'` import still resolves, and new code may import the focused module directly. |
| `checkInfra/*.js` | The sub-domain modules behind the `checkInfra.js` barrel (#2842, same treatment #1152 gave `arcPlanner.js`): `externals` (the zod/`estimateTokens`/sibling-scanner hub), `taxonomy` (scopes/kinds/severities/`EDITORIAL_SOURCES`/field types), `revealForeshadowing`, `craftStages`, `structureStages` (stage names + their prompt summaries), `voiceCanon` (voice/state/trait/continuity-ledger summaries), `povAndNames`, `canonScaffolding` (relationship-link + object-attachment walkers), `llmRunner` (chunked manuscript runs, prior-findings/setup digests, finding normalization, custom-check prompts), `readability`, `rosterCast`, `sceneAnalysis`, `proseDensity`, `comic` (lettering + comic↔prose sync). Import via the barrel or directly; `checkInfraBarrel.test.js` pins the re-export contract. |
| `checks/*.js` | The `EDITORIAL_CHECKS` definitions, grouped by category (#1829): `naming`, `cast`, `pov`, `characterArc`, `continuity` (incl. #2178 `continuity.premature-reveal` — the information-economy guard that flags a reveal-gated canon fact leaked before its reveal issue, reconciled against `revealGatedCanonSummary`; gated on `canonHasRevealGated`), `comic`, `visual`, `scene`, `dialogue`, `proseStyle`, `research`, `slop` (#2165 — `prose.slop-banned-words`/`prose.ai-tells`/`prose.structural-tics`/`prose.burstiness`, built on `../slopScore.js`), `world` (#2175 — `world.unforeshadowed-solution`/`world.cost-free-power`, the review-side companion to the Sanderson's-Laws worldbuilding doctrine injected into the universe-expansion generation prompt; reconciles against canon + the continuity-bible world-rule facts). Each exports a `<group>Checks` array of declarative check entries (scope, kind, severity, `configSchema`, `gate`, `run(ctx)`); `checkRegistry.js` imports and spreads them. Internal to the registry — imported only via `checkRegistry.js`, not the barrel. |
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index 9b8f38caa7..61740d65fc 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -1,5 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { z } from 'zod';
+import { FINDING_CATEGORY_LABELS } from './findingCategories.js';
import {
EDITORIAL_CHECKS,
EDITORIAL_SOURCES,
@@ -111,6 +112,15 @@ describe('editorial check registry — shape invariants', () => {
}
});
+ it('gives every built-in finding category a manuscript display label', () => {
+ for (const check of EDITORIAL_CHECKS) {
+ expect(
+ Object.hasOwn(FINDING_CATEGORY_LABELS, check.category),
+ `${check.id} category "${check.category}"`,
+ ).toBe(true);
+ }
+ });
+
it('ships both reference checks (one deterministic, one llm)', () => {
const ids = listChecks().map((c) => c.id);
expect(ids).toContain(NAMING);
diff --git a/server/lib/editorial/findingCategories.js b/server/lib/editorial/findingCategories.js
new file mode 100644
index 0000000000..79aca76513
--- /dev/null
+++ b/server/lib/editorial/findingCategories.js
@@ -0,0 +1,31 @@
+/**
+ * Human labels for editorial and manuscript-completeness finding categories.
+ *
+ * This leaf is shared with the browser manuscript editor, so keep it pure and
+ * dependency-free. Completeness-only categories remain here alongside the
+ * categories declared by built-in editorial checks.
+ */
+export const FINDING_CATEGORY_LABELS = Object.freeze({
+ 'missing-content': 'Missing content',
+ 'arc-gap': 'Arc gap',
+ arc: 'Character arc',
+ 'character-gap': 'Character gap',
+ character: 'Character',
+ plot: 'Plot structure',
+ theme: 'Theme',
+ casting: 'Casting',
+ pacing: 'Pacing',
+ continuity: 'Continuity',
+ accuracy: 'Fact accuracy',
+ style: 'Style',
+ exposition: 'Exposition',
+ lettering: 'Lettering',
+ dialogue: 'Dialogue',
+ naming: 'Naming',
+ world: 'World',
+ emotion: 'Emotion',
+ opening: 'Opening',
+ cliche: 'Cliché',
+ prose: 'Prose',
+ other: 'Note',
+});
diff --git a/server/lib/editorial/index.js b/server/lib/editorial/index.js
index 456931e9ad..f53f7a25af 100644
--- a/server/lib/editorial/index.js
+++ b/server/lib/editorial/index.js
@@ -1,6 +1,7 @@
// Barrel for server/lib/editorial/ — the extensible editorial-check registry
// (#1284). See README.md for the catalog. Re-export every public module here.
export * from './checkRegistry.js';
+export * from './findingCategories.js';
export * from './cutApplier.js';
export * from './severityConfig.js';
export * from './balloonAttribution.js';