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([issue-1346]): remount author form on target change; lenient settings gate for custom-check defs (codex review)
Adam Eivye02ff55ba46c
diff --git a/client/src/pages/PipelineEditorialChecks.jsx b/client/src/pages/PipelineEditorialChecks.jsxindex 511be3ff6f..47c99a24d3 100644--- a/client/src/pages/PipelineEditorialChecks.jsx+++ b/client/src/pages/PipelineEditorialChecks.jsx@@ -342,7 +342,11 @@ export default function PipelineEditorialChecks() {) : null}</div>{formOpen ? (+ // Key on the target so switching new↔edit (or check A→B) while the+ // form stays mounted remounts it with a fresh draft — otherwise the+ // mount-only useState initializer would save the previous draft.<EditorialCustomCheckForm+ key={editingCheck?.id || 'new'}check={editingCheck}saving={formSaving}onSave={handleSaveCustom}diff --git a/server/lib/validation.js b/server/lib/validation.jsindex b958f30514..ff77856fca 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -1048,24 +1048,19 @@ export const editorialCustomCheckCreateSchema = z.object({// field is left unchanged rather than reset.export const editorialCustomCheckUpdateSchema = z.object(editorialCustomCheckShape).partial().strict();-// The STORED definition shape (settings.pipelineEditorialChecks.customChecks[]):-// the authored fields + the generated id and timestamps. Validated as part of-// the settings slice below so a hand-edited / synced file is bounded.-export const editorialCustomCheckDefSchema = z.object({- id: z.string().trim().min(1).max(120),- ...editorialCustomCheckShape,- description: editorialCustomCheckShape.description.optional().default(''),- category: editorialCustomCheckShape.category.optional().default('custom'),- createdAt: z.string().optional(),- updatedAt: z.string().optional(),-}).strict();-// settings.pipelineEditorialChecks slice (validated on PUT /api/settings when// present). `checks` maps a checkId → its persisted enable/config; `customChecks`// holds the user-defined check definitions (#1346).+//+// `customChecks` items are gated LENIENTLY (any object, unknown keys preserved):+// the authoring CRUD routes (editorialCustomCheck{Create,Update}Schema) are the+// strict input gate, while this wholesale-settings path must stay forward/older-+// peer compatible — a def carrying a future field (or a newer scope value) must+// not 400 an unrelated settings save. `buildCustomCheck`/`isValidCustomCheckDef`+// decide at read time which stored defs are actually runnable.export const pipelineEditorialChecksSettingsSchema = z.object({checks: z.record(editorialCheckConfigSchema).optional(),- customChecks: z.array(editorialCustomCheckDefSchema).optional(),+ customChecks: z.array(z.object({}).passthrough()).optional(),}).strict();// Cursor-context payload for the CD-bridge suggest route — identical shape todiff --git a/server/lib/validation.test.js b/server/lib/validation.test.jsindex 3c3658617f..9f2425d833 100644--- a/server/lib/validation.test.js+++ b/server/lib/validation.test.js@@ -17,7 +17,9 @@ import {codeReviewSettingsSchema,locationSettingsSchema,writersRoomCharacterUpdateSchema,- writersRoomObjectUpdateSchema+ writersRoomObjectUpdateSchema,+ editorialCustomCheckUpdateSchema,+ pipelineEditorialChecksSettingsSchema} from './validation.js';describe('validation.js', () => {@@ -864,4 +866,28 @@ describe('validation.js', () => {expect(result.success).toBe(false);});});++ describe('editorial custom checks (#1346)', () => {+ it('the update schema applies NO defaults (omitted field stays absent)', () => {+ const parsed = editorialCustomCheckUpdateSchema.parse({ label: 'Renamed' });+ // A defaulted optional would inject scope/category/description here and+ // silently reset the stored values on a field-specific PATCH.+ expect(parsed).toEqual({ label: 'Renamed' });+ });++ it('the update schema still rejects bad enum values and unknown keys', () => {+ expect(editorialCustomCheckUpdateSchema.safeParse({ scope: 'bogus' }).success).toBe(false);+ expect(editorialCustomCheckUpdateSchema.safeParse({ nope: 1 }).success).toBe(false);+ });++ it('the settings slice accepts forward/older-peer custom-check shapes (lenient)', () => {+ // A def carrying a future field (or a not-yet-known scope) must not 400 an+ // unrelated settings save — runtime buildCustomCheck decides runnability.+ const result = pipelineEditorialChecksSettingsSchema.safeParse({+ customChecks: [{ id: 'custom.x', label: 'Future', prompt: 'p', scope: 'galaxy', futureField: { nested: true } }],+ });+ expect(result.success).toBe(true);+ expect(result.data.customChecks[0].futureField).toEqual({ nested: true }); // unknown keys preserved+ });+ });});