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(validation): remove .default(false) from appSchema booleans to prevent partial updates overwriting stored values

Adam Eivy011cb735ae24
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 9ccf72f2a0..2d5ffb736e 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -41,6 +41,7 @@
- Chart date range comparison uses local date strings instead of UTC Date objects — fixes today/yesterday missing from 7-day chart
- Empty entry objects no longer accumulate in daily-log.json after moving the last item from a date
- README screenshot labels corrected to match actual screenshot content (all 6 were mislabeled)
+- Zod `.default(false)` on `archived`, `defaultUseWorktree`, and `defaultOpenPR` in `appSchema` caused `appUpdateSchema.partial()` to inject `false` for omitted fields, silently overwriting stored `true` values during partial updates
## Removed
- Dead code: `euclideanDistance`, `averageVectors`, `similarityMatrix` from `vectorMath.js` (unused outside tests)
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 8d7c0db9b3..c8bb82402c 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -190,15 +190,15 @@ export const appSchema = z.object({
appIconPath: z.string().nullable().optional(), // Absolute path to detected app icon image
editorCommand: z.string().optional(),
description: z.string().optional(),
- archived: z.boolean().optional().default(false),
+ archived: z.boolean().optional(),
pm2Home: z.string().optional(), // Custom PM2_HOME path for apps that run in their own PM2 instance
disabledTaskTypes: z.array(z.string()).optional(), // Legacy: migrated to taskTypeOverrides
taskTypeOverrides: z.record(z.object({
enabled: z.boolean().optional(),
interval: z.string().nullable().optional()
})).optional(), // Per-task overrides: { [taskType]: { enabled, interval } }
- defaultUseWorktree: z.boolean().optional().default(false),
- defaultOpenPR: z.boolean().optional().default(false),
+ defaultUseWorktree: z.boolean().optional(),
+ defaultOpenPR: z.boolean().optional(),
jira: jiraConfigSchema.optional().nullable(),
datadog: datadogConfigSchema.optional().nullable()
});
diff --git a/server/lib/validation.test.js b/server/lib/validation.test.js
index 13cb1be34b..b402c983f8 100644
--- a/server/lib/validation.test.js
+++ b/server/lib/validation.test.js
@@ -191,6 +191,15 @@ describe('validation.js', () => {
const result = appUpdateSchema.safeParse(update);
expect(result.success).toBe(false);
});
+
+ it('should not inject default values for omitted boolean fields', () => {
+ const update = { name: 'Updated Name' };
+ const result = appUpdateSchema.safeParse(update);
+ expect(result.success).toBe(true);
+ expect(result.data).not.toHaveProperty('archived');
+ expect(result.data).not.toHaveProperty('defaultUseWorktree');
+ expect(result.data).not.toHaveProperty('defaultOpenPR');
+ });
});
describe('providerSchema', () => {