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

refactor: hoist the pipeline severity palette to a shared manuscript constant (#4109)

[._.]/ Adam Eivydc8c58ce8198
diff --git a/.changelog/next/changed-issue-4109.md b/.changelog/next/changed-issue-4109.md
new file mode 100644
index 0000000000..b9ec401221
--- /dev/null
+++ b/.changelog/next/changed-issue-4109.md
@@ -0,0 +1 @@
+- Pipeline severity styling (series review, autopilot, arc-canvas verification and completeness panels) now reads one shared palette instead of three duplicate inline copies, so a tweak can't land on one panel only.
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index d50c154460..3ed906bfe3 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -27,6 +27,7 @@ import Pill from '../ui/Pill';
import ProviderModelSelector from '../ProviderModelSelector';
import AutopilotMilestones from './AutopilotMilestones';
import SeriesAutopilotSchedule from './SeriesAutopilotSchedule';
+import { severityColor } from './constants.js';
// Convergence-round bounds — mirror the server (seriesAutopilot.js + the
// pipelineEditorialChecks settings schema). 0 = skip that gate entirely.
@@ -266,12 +267,6 @@ function RoundInput({ id, label, settingKey, value, setValue, persist, max = ROU
);
}
-const SEVERITY_COLORS = {
- high: 'text-port-error border-port-error/40 bg-port-error/10',
- medium: 'text-port-warning border-port-warning/40 bg-port-warning/10',
- low: 'text-gray-400 border-gray-500/30 bg-gray-700/20',
-};
-
// Step labels are shared with the milestone map (lib/autopilotMilestones.js) so
// the live status line and the map can't name the same step differently.
const stepLabel = autopilotStepLabel;
@@ -477,7 +472,7 @@ function Findings({ items }) {
return (
<ul className="space-y-1.5 mt-2">
{items.map((f, i) => (
- <li key={i} className={`text-xs p-2 rounded border ${SEVERITY_COLORS[f.severity] || SEVERITY_COLORS.medium}`}>
+ <li key={i} className={`text-xs p-2 rounded border ${severityColor(f.severity)}`}>
<div className="flex items-center gap-2">
<AlertCircle size={12} />
<span className="uppercase tracking-wider font-semibold">{f.severity || 'note'}</span>
diff --git a/client/src/components/pipeline/SeriesReviewPanel.jsx b/client/src/components/pipeline/SeriesReviewPanel.jsx
index 2d0d27e631..b9f1fd84ea 100644
--- a/client/src/components/pipeline/SeriesReviewPanel.jsx
+++ b/client/src/components/pipeline/SeriesReviewPanel.jsx
@@ -19,12 +19,7 @@ import {
getPipelineSeries,
listPipelineIssues,
} from '../../services/api';
-
-const SEVERITY_STYLES = {
- high: 'text-port-error border-port-error/40 bg-port-error/10',
- medium: 'text-port-warning border-port-warning/40 bg-port-warning/10',
- low: 'text-gray-400 border-gray-500/30 bg-gray-700/20',
-};
+import { severityColor } from './constants.js';
const RUN_ENDED = new Set(['complete', 'canceled', 'error']);
// The fix run's terminal frames: `rejected` = the cos gate/budget refused it.
@@ -425,7 +420,7 @@ export default function SeriesReviewPanel({ series, onSeriesUpdate, onIssuesUpda
</div>
<ul className="space-y-1">
{g.items.map((f) => (
- <li key={f.commentId} className={`p-2 rounded border ${SEVERITY_STYLES[f.severity] || SEVERITY_STYLES.medium}`}>
+ <li key={f.commentId} className={`p-2 rounded border ${severityColor(f.severity)}`}>
<div className="flex items-center gap-2">
<AlertCircle size={11} />
<span className="uppercase tracking-wider font-semibold text-[10px]">{f.severity}</span>
diff --git a/client/src/components/pipeline/arcCanvas/CompletenessResults.jsx b/client/src/components/pipeline/arcCanvas/CompletenessResults.jsx
index 67b981ea29..160fa4537c 100644
--- a/client/src/components/pipeline/arcCanvas/CompletenessResults.jsx
+++ b/client/src/components/pipeline/arcCanvas/CompletenessResults.jsx
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import { Link } from 'react-router';
import { X, FileSearch, FileText } from 'lucide-react';
-import { SEVERITY_COLORS } from './shared.js';
+import { severityColor } from '../constants.js';
// Human-readable labels for the manuscript-completeness categories.
const COMPLETENESS_CATEGORY_LABELS = {
@@ -55,7 +55,7 @@ export default function CompletenessResults({ issues, onDismiss, seriesId }) {
<span className="text-[11px] uppercase tracking-wider text-gray-500">{COMPLETENESS_CATEGORY_LABELS[cat]} ({list.length})</span>
<ul className="space-y-1">
{list.map((iss, i) => (
- <li key={i} className={`text-xs p-2 rounded border ${SEVERITY_COLORS[iss.severity] || SEVERITY_COLORS.medium}`}>
+ <li key={i} className={`text-xs p-2 rounded border ${severityColor(iss.severity)}`}>
{iss.location ? <span className="font-medium">{iss.location}: </span> : null}
<span>{iss.problem}</span>
{iss.suggestion ? <p className="mt-1 text-gray-300"><span className="opacity-70">Suggestion: </span>{iss.suggestion}</p> : null}
diff --git a/client/src/components/pipeline/arcCanvas/VerifyResults.jsx b/client/src/components/pipeline/arcCanvas/VerifyResults.jsx
index a0d7ba691f..962b9889c8 100644
--- a/client/src/components/pipeline/arcCanvas/VerifyResults.jsx
+++ b/client/src/components/pipeline/arcCanvas/VerifyResults.jsx
@@ -1,5 +1,5 @@
import { AlertCircle, Wand2, Loader2, Lock } from 'lucide-react';
-import { SEVERITY_COLORS } from './shared.js';
+import { severityColor } from '../constants.js';
export default function VerifyResults({ issues, onDismiss, onResolveAll, onResolveOne, resolvingAll, resolvingIdx, title = 'Verification', lockedNote = null }) {
const busy = resolvingAll || (resolvingIdx && resolvingIdx.size > 0);
@@ -39,7 +39,7 @@ export default function VerifyResults({ issues, onDismiss, onResolveAll, onResol
{issues.map((iss, i) => {
const resolvingThis = resolvingIdx && resolvingIdx.has(i);
return (
- <li key={i} className={`text-xs p-2 rounded border ${SEVERITY_COLORS[iss.severity] || SEVERITY_COLORS.medium}`}>
+ <li key={i} className={`text-xs p-2 rounded border ${severityColor(iss.severity)}`}>
<div className="flex items-center gap-2 mb-1">
<AlertCircle size={12} />
<span className="uppercase tracking-wider font-semibold">{iss.severity}</span>
diff --git a/client/src/components/pipeline/arcCanvas/shared.js b/client/src/components/pipeline/arcCanvas/shared.js
deleted file mode 100644
index 8cf7136928..0000000000
--- a/client/src/components/pipeline/arcCanvas/shared.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Shared design tokens for the Arc Canvas subtree. Severity → Tailwind class
-// map used by both verification panels (VerifyResults) and the manuscript-
-// completeness panel (CompletenessResults).
-export const SEVERITY_COLORS = {
- high: 'text-port-error border-port-error/40 bg-port-error/10',
- medium: 'text-port-warning border-port-warning/40 bg-port-warning/10',
- low: 'text-gray-400 border-gray-500/30 bg-gray-700/20',
-};
diff --git a/client/src/components/pipeline/constants.js b/client/src/components/pipeline/constants.js
new file mode 100644
index 0000000000..de66d22386
--- /dev/null
+++ b/client/src/components/pipeline/constants.js
@@ -0,0 +1,30 @@
+/**
+ * Shared display constants for the Pipeline component subtree. Pure data —
+ * co-located with the pipeline components that render it.
+ */
+
+// Severity → Tailwind classes for a finding/issue card (text + border + fill).
+// One palette for every pipeline surface that lists severity-tagged findings:
+// the series review panel, the autopilot panel, and the arc-canvas verification
+// and manuscript-completeness panels. It used to be three byte-identical inline
+// copies (#4109); keep it here so a tweak can't land on one panel only.
+//
+// The class names are complete literal strings on purpose — Tailwind's build
+// scans source text, so a name assembled by interpolation is silently absent
+// from the bundle.
+export const SEVERITY_COLORS = {
+ high: 'text-port-error border-port-error/40 bg-port-error/10',
+ medium: 'text-port-warning border-port-warning/40 bg-port-warning/10',
+ low: 'text-gray-400 border-gray-500/30 bg-gray-700/20',
+};
+
+// Resolve a finding's severity to its card classes, defaulting to `medium` for
+// an absent or unrecognized value. Use this rather than a bare
+// `SEVERITY_COLORS[severity] || SEVERITY_COLORS.medium`: findings arrive from
+// LLM output and older peers, so a severity of `constructor` / `__proto__` /
+// `toString` would otherwise resolve to an inherited Object.prototype member —
+// truthy, so the `||` fallback wouldn't catch it, and it lands in a className.
+export const severityColor = (severity) =>
+ (Object.hasOwn(SEVERITY_COLORS, severity) && typeof SEVERITY_COLORS[severity] === 'string'
+ ? SEVERITY_COLORS[severity]
+ : SEVERITY_COLORS.medium);
diff --git a/client/src/components/pipeline/constants.test.js b/client/src/components/pipeline/constants.test.js
new file mode 100644
index 0000000000..07fc8cd552
--- /dev/null
+++ b/client/src/components/pipeline/constants.test.js
@@ -0,0 +1,57 @@
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+import { describe, it, expect } from 'vitest';
+import { SEVERITY_COLORS, severityColor } from './constants.js';
+
+const HERE = dirname(fileURLToPath(import.meta.url));
+
+// Every pipeline surface that renders a severity-tagged finding card. These used
+// to carry three byte-identical inline copies of the palette (#4109); the guard
+// below fails if one of them grows a private copy again.
+const CONSUMERS = [
+ 'SeriesReviewPanel.jsx',
+ 'AutopilotPanel.jsx',
+ 'arcCanvas/VerifyResults.jsx',
+ 'arcCanvas/CompletenessResults.jsx',
+];
+
+const readConsumer = (rel) => readFileSync(join(HERE, rel), 'utf8');
+
+describe('pipeline severity palette', () => {
+ it('exposes complete literal Tailwind class strings per severity', () => {
+ // Literal, not interpolated — Tailwind scans source text, so an assembled
+ // class name is silently dropped from the bundle.
+ expect(SEVERITY_COLORS).toEqual({
+ high: 'text-port-error border-port-error/40 bg-port-error/10',
+ medium: 'text-port-warning border-port-warning/40 bg-port-warning/10',
+ low: 'text-gray-400 border-gray-500/30 bg-gray-700/20',
+ });
+ for (const classes of Object.values(SEVERITY_COLORS)) {
+ expect(classes).not.toMatch(/[`${}]/);
+ }
+ });
+
+ it('resolves each known severity to its palette entry', () => {
+ for (const [severity, classes] of Object.entries(SEVERITY_COLORS)) {
+ expect(severityColor(severity)).toBe(classes);
+ }
+ });
+
+ it('falls back to medium for absent, unknown, and prototype-key severities', () => {
+ for (const severity of [undefined, null, '', 'critical', '__proto__', 'constructor', 'toString', 'hasOwnProperty']) {
+ expect(severityColor(severity)).toBe(SEVERITY_COLORS.medium);
+ }
+ });
+
+ it.each(CONSUMERS)('%s renders the shared palette rather than a private copy', (rel) => {
+ const src = readConsumer(rel);
+ expect(src).toMatch(/import \{ severityColor \} from '\.{1,2}\/constants\.js'/);
+ expect(src).toContain('severityColor(');
+ // No local severity→class map, and no hand-inlined palette class strings.
+ expect(src).not.toMatch(/(SEVERITY_STYLES|SEVERITY_COLORS)\s*=\s*\{/);
+ expect(src).not.toContain(SEVERITY_COLORS.high);
+ expect(src).not.toContain(SEVERITY_COLORS.medium);
+ expect(src).not.toContain(SEVERITY_COLORS.low);
+ });
+});