refactor(backup): let the account-settings domain own the User column verdicts

The SETTING verdicts are now the keys of the codec table, so a column
becomes a setting by getting a codec and nothing else has to name it. The
verdicts for every other User column move beside it into
account-settings-classes.ts, and the restore half into
account-settings-restore.ts. The backup plan keeps the model verdicts.

The classification guard now also refuses a column that has both a codec
and another verdict, since the composed table would quietly carry it as a
setting.
This commit is contained in:
Marc-André Bombeck committed 2026-10-22 06:50:58 +02:00
1 parent 66f8b18cf8
commit dcf49dd14e
11 files changed
+329 -340

No files matched your search

+3 -4
View File
@@ -74,12 +74,11 @@ import { BackupKeyIdCollector } from "@/lib/export/backup-key-ids";
import { createBackupPreviewCollector } from "@/lib/export/backup-preview";
import { parseBackupPayload } from "@/lib/validations/backup";
import { summarizeBackup } from "@/lib/validations/backup-summary";
import { TWO_ENDED_MODELS, type TwoEndedModel } from "@/lib/export/backup-plan";
import {
TWO_ENDED_MODELS,
ACCOUNT_SETTING_COLUMNS,
USER_COLUMN_BACKUP_CLASS,
type TwoEndedModel,
} from "@/lib/export/backup-plan";
import { ACCOUNT_SETTING_COLUMNS } from "@/lib/export/account-settings-backup";
} from "@/lib/export/account-settings-backup";
import { parseOnboardingSteps } from "@/lib/onboarding/needs";
import { POST } from "./restore-job-driver";
import {
@@ -4,8 +4,8 @@
* restored into a fresh account, and read back there.
*
* The table below has one entry per write, and every `User` column the backup
* classifies as a `SETTING` (`USER_COLUMN_BACKUP_CLASS` in
* `src/lib/export/backup-plan.ts`) appears in exactly one entry. A new setting
* classifies as a `SETTING` (a codec in `ACCOUNT_SETTING_CODECS`,
* `src/lib/export/account-settings-backup.ts`) appears in exactly one entry. A new setting
* column fails the inventory case until it is given an entry, which is the
* point: the class of bug this file exists for is a setting that is stored but
* not read back, read back but not published, or published but dropped by the
@@ -29,7 +29,7 @@ import type { User } from "@/generated/prisma/client";
import {
USER_COLUMN_BACKUP_CLASS,
type AccountSettingColumn,
} from "@/lib/export/backup-plan";
} from "@/lib/export/account-settings-backup";
import { GET as getMe } from "@/app/api/auth/me/route";
import * as profile from "@/app/api/user/profile/route";