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: preserve legacy DataDog instance IDs (#4922)

[._.]/ Adam Eivy59a5b4bf976d
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 1978947766..259050ca3c 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -96,7 +96,10 @@ export const datadogConfigSchema = z.object({
// existing instance because the route preserves the stored secret in that
// case.
export const datadogInstanceRequestSchema = z.object({
- id: z.string().trim().min(1).max(128),
+ // Preserve the exact key for updates. Older installs may have stored IDs
+ // outside the current preferred length/whitespace convention, and changing
+ // the lookup key here would make those instances impossible to edit.
+ id: z.string().min(1),
name: z.string().trim().min(1).max(120),
site: z.string().trim().min(1).max(253),
apiKey: z.string().max(512).optional(),
diff --git a/server/lib/validation.test.js b/server/lib/validation.test.js
index 97287b480c..0f59e6d8c5 100644
--- a/server/lib/validation.test.js
+++ b/server/lib/validation.test.js
@@ -87,6 +87,11 @@ describe('validation.js', () => {
apiKey: '',
appKey: 'example-app-key',
}).success).toBe(true);
+ expect(datadogInstanceRequestSchema.safeParse({
+ id: ` ${'legacy-id-'.repeat(20)} `,
+ name: 'Legacy DataDog',
+ site: 'api.datadoghq.com',
+ }).data.id).toBe(` ${'legacy-id-'.repeat(20)} `);
expect(datadogSearchErrorsRequestSchema.safeParse({
serviceName: 'example-service',
environment: 'staging',