2.8 KiB
Task 4 Report — StepDbSettings Rewrite
Status: DONE_WITH_CONCERNS
Commit: d309faf
TSC Summary
Zero new errors introduced in step-db-settings.tsx. All pre-existing errors in the repo are unrelated (in form.tsx, toaster.tsx, channel-form.tsx, database-form.action.ts, etc.).
What Was Done
Replaced the placeholder implementation of StepDbSettings (~91 lines, only retention days + apply-to-all switch) with the full three-level phase navigation component (~1050 lines):
- Phase: grid — lists all project databases with "Configured" badge when any section is set
- Phase: db — shows 4 section cards (Retention, Scheduling, Notifications, Storage) with per-section ✓ indicators and "Apply to all" button
- Phase: section — renders the appropriate inline section form
All 4 sections implemented inline (no dashboard component imports):
RetentionSection: count / days / GFS with storage impact estimateSchedulingSection: delegates toBackupScheduleSelectorNotificationsSection: multi-policy,MultiSelectfor events, empty-state when no notifiersStorageSection: multi-policy, empty-state when no storages
Save flow: calls applyOnboardingDbSettingsAction → on success calls updateDbSettings(dbId, patch) → toast → phase back to db.
"Apply to all": loops over other DB IDs, calls action with section: "all" for each, batch-updates context, shows toast, navigates to grid.
Concerns
-
Type cast on
notificationPolicies:OnboardingNotificationPolicy.eventKindsis typed asstring[]but the action's Zod schema uses a specific enum union. Twoas anycasts were added at action call sites to bridge the mismatch. The runtime is safe (Zod validates and rejects invalid values), but the type inconsistency betweentypes/index.tsandapply-db-settings.action.tsshould be resolved by tighteningOnboardingNotificationPolicy.eventKindsto the same enum type as the action'sEventKindSchema. -
No browser test performed: manual verification steps from the brief (Steps 3–5) were not executed as they require a running dev server and live DB. The component logic follows the brief exactly.
Hotfix Follow-up Commit: a6e528d
Fixed two critical issues:
-
Wire
applyMutation.mutateAsynceverywhere (5 sites):- Replaced all direct
applyOnboardingDbSettingsAction(...)calls withawait applyMutation.mutateAsync(...) - Removed
if (result?.data?.success)guards since mutateAsync throws on error - Mutation's
onError: () => toast.error(...)handles failures
- Replaced all direct
-
Stabilize list keys:
- NotificationsSection: changed
key={index}tokey={policy.channelId || index} - StorageSection: changed
key={index}tokey={policy.channelId || index}
- NotificationsSection: changed
TypeScript: Zero new errors in target file. Pre-existing errors in form.tsx, toaster.tsx, channel-form.tsx (unrelated).