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: tighten settings merge slugline back-fill + UUID-strict history ids
Adam Eivy2a688632a138
diff --git a/server/routes/videoGen.js b/server/routes/videoGen.jsindex 95934b1570..ed0548e427 100644--- a/server/routes/videoGen.js+++ b/server/routes/videoGen.js@@ -273,7 +273,11 @@ router.post('/last-frame/:id', asyncHandler(async (req, res) => {res.json(await extractLastFrame(req.params.id));}));-const historyIdSchema = z.string().regex(/^[a-f0-9-]{36}$/i, 'invalid history id');+// History ids are produced by crypto.randomUUID(), so validate them as+// proper UUIDs rather than the looser /^[a-f0-9-]{36}$/ pattern (which+// happily accepts e.g. 36 hyphens). Matches the .uuid() usage in the+// other route schemas.+const historyIdSchema = z.string().uuid('invalid history id');const failValidation = (parsed) => {throw new ServerError(`Validation failed: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join(', ')}`, { status: 400, code: 'VALIDATION_ERROR' });diff --git a/server/services/writersRoom/settings.js b/server/services/writersRoom/settings.jsindex 5888552154..6134add867 100644--- a/server/services/writersRoom/settings.js+++ b/server/services/writersRoom/settings.js@@ -197,6 +197,15 @@ export async function mergeExtractedSettings(workId, extracted) {// same batch keyed by that name resolves to this record.indexSetting(existing);}+ // Back-fill slugline when the existing record was created name-only+ // (typical for hand-edited entries). Without this, a storyboard scene's+ // slugline can never match this setting record so setting injection+ // silently no-ops even though the merge correctly de-duped. Re-index+ // afterward so later batch entries keyed by the new slugline resolve.+ if (isBlank(existing.slugline) && !isBlank(incoming.slugline)) {+ existing.slugline = String(incoming.slugline).trim();+ indexSetting(existing);+ }existing.firstAppearance = incoming.firstAppearance ?? existing.firstAppearance ?? null;existing.evidence = Array.isArray(incoming.evidence) ? incoming.evidence : (existing.evidence || []);existing.missingFromProse = Array.isArray(incoming.missingFromProse) ? incoming.missingFromProse : [];diff --git a/server/services/writersRoom/settings.test.js b/server/services/writersRoom/settings.test.jsindex eea3c55008..23bf0ba6bc 100644--- a/server/services/writersRoom/settings.test.js+++ b/server/services/writersRoom/settings.test.js@@ -188,6 +188,36 @@ describe('writers room — settings merge', () => {expect(updated.firstAppearance).toBe('Chapter 2');});+ it('back-fills slugline on a name-only existing setting when extraction supplies one', async () => {+ // User created a setting via name only ("The Atrium"). A later analysis+ // pass extracts the same place with a slugline. The merge MUST+ // back-fill `slugline` so storyboard scenes can match this entry by+ // slugline; otherwise setting injection silently fails.+ const id = await newWork();+ const s = await createSetting(id, { name: 'The Atrium' });+ expect(s.slugline).toBe('');+ const merged = await mergeExtractedSettings(id, [{+ slugline: 'INT. THE ATRIUM — DAY',+ name: 'The Atrium',+ description: 'glass dome, copper rails',+ }]);+ expect(merged).toHaveLength(1);+ expect(merged[0].slugline).toBe('INT. THE ATRIUM — DAY');+ expect(merged[0].description).toBe('glass dome, copper rails');+ });++ it('re-indexes after slugline back-fill so a later batch entry keyed by slugline matches', async () => {+ const id = await newWork();+ await createSetting(id, { name: 'The Vault' });+ const merged = await mergeExtractedSettings(id, [+ { slugline: 'INT. THE VAULT — NIGHT', name: 'The Vault', description: 'heavy steel doors' },+ { slugline: 'INT. THE VAULT — NIGHT', palette: 'pewter and oxblood' },+ ]);+ expect(merged).toHaveLength(1);+ expect(merged[0].description).toBe('heavy steel doors');+ expect(merged[0].palette).toBe('pewter and oxblood');+ });+it('does not duplicate within a single batch when a new entry is referenced by both slugline and name', async () => {// Within ONE merge call, the AI introduces a new setting with both// slugline and a distinct name, then a later entry in the same batch