mAi
99c9d89daa
feat(backups): t-paliad-246 — Backup Mode Slice A (on-demand admin org export)
m/paliad#77 Slice A. Folds the unbuilt t-paliad-214 Slice 3 (org async
export) into a new "Backup Mode" surface gated by adminGate.
m's calls (all 4 material picks per design §2):
- Storage: local disk PALIAD_EXPORT_DIR (LocalDiskStore only)
- Format: .zip bundle (xlsx + JSON + CSV + README) — no-lock-in preserved
- paliadin_turns + paliadin_aichat_conversation: EXCLUDE structurally
- Scheduler (Slice B): nightly 03:00 UTC, env-tunable
Wiring:
- mig 123 adds paliad.backups catalog table (kind/status/storage_uri/
size/row_counts/warnings/error/deleted_at + admin-only RLS).
- ExportService.WriteOrg + orgSheetQueries enumerate 37 entity sheets
+ 12 ref sheets; REPEATABLE READ READ ONLY tx wraps the dump for
snapshot consistency (design §3.3).
- writeBundle + runSheetQuery refactored to take a sqlx.QueryerContext
so both *sqlx.DB (personal/project paths, unchanged) and *sqlx.Tx
(org snapshot path) work.
- BackupRunner orchestrates: catalog INSERT → audit INSERT
(event_type='backup_created') → WriteOrg → ArtifactStore.Put → patch
catalog + audit on success/failure.
- ArtifactStore interface + LocalDiskStore impl (defense-in-depth key
validation + URI-outside-dir guard).
- Sentinel actor for scheduled runs: actor_email='system@paliad',
actor_id=NULL — no phantom user in paliad.users.
- Admin handlers POST /api/admin/backups/run + GET list/get/download
behind adminGate(users, …); /admin/backups page + sidebar entry +
bilingual i18n keys.
- BackupRunner only wired when PALIAD_EXPORT_DIR is set; routes return
503 otherwise (same shape as requireDB).
Tests: 8 pure-function tests cover registry shape (no dups, paliadin
absent both as sheet name and SQL substring, ref__* sheets unscoped,
every sheet has ORDER BY) and LocalDiskStore (round-trip, bad-key
rejection, URI-traversal rejection, mkdir on construction).
go build ./... + go test ./internal/... clean. bun run build clean.
Slice B (BackupScheduler + retention cleanup) and Slice C (UI polish)
are separate follow-ups per head's instruction.
2026-05-25 15:28:37 +02:00
..
2026-04-30 16:46:31 +02:00
2026-05-15 02:09:10 +02:00
2026-05-20 15:19:48 +02:00
2026-04-22 23:38:03 +02:00
2026-04-30 16:46:31 +02:00
2026-05-20 15:23:28 +02:00
2026-05-20 13:26:23 +02:00
2026-05-20 10:02:36 +02:00
2026-05-25 14:24:55 +02:00
2026-04-29 19:12:11 +02:00
2026-04-30 16:46:31 +02:00
2026-04-18 02:23:50 +02:00
2026-04-30 16:46:31 +02:00
2026-05-25 15:28:37 +02:00
2026-05-07 20:58:57 +02:00
2026-05-07 22:41:18 +02:00
2026-04-30 16:46:31 +02:00
2026-05-13 00:03:45 +02:00
2026-05-13 00:03:45 +02:00
2026-05-01 09:48:25 +02:00
2026-05-20 15:38:30 +02:00
2026-05-20 15:24:06 +02:00
2026-05-22 23:32:12 +02:00
2026-04-30 16:46:31 +02:00
2026-05-20 13:55:56 +02:00
2026-05-20 13:55:56 +02:00
2026-05-20 13:55:56 +02:00
2026-05-15 01:01:28 +02:00
2026-05-21 14:23:04 +02:00
2026-05-06 16:24:31 +02:00
2026-05-06 16:41:41 +02:00
2026-04-14 19:32:07 +02:00
2026-04-30 16:46:31 +02:00
2026-05-15 01:09:20 +02:00
2026-04-30 16:46:31 +02:00
2026-05-04 14:40:53 +02:00
2026-05-07 22:58:44 +02:00
2026-05-20 13:03:57 +02:00
2026-05-25 14:44:58 +02:00
2026-05-20 19:15:32 +02:00
2026-05-05 11:18:38 +02:00
2026-05-05 11:39:30 +02:00
2026-05-13 00:18:42 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-05-25 15:28:37 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-26 00:36:33 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-04-30 16:46:31 +02:00
2026-05-08 19:59:44 +02:00
2026-05-22 15:17:24 +02:00
2026-04-30 16:46:31 +02:00
2026-05-07 22:21:45 +02:00
2026-05-22 23:43:15 +02:00
2026-04-20 17:44:45 +02:00
2026-05-25 15:28:37 +02:00
2026-04-26 10:48:27 +02:00
2026-05-21 14:23:04 +02:00
2026-04-30 02:29:09 +02:00
2026-04-22 23:36:10 +02:00
2026-05-20 14:43:42 +02:00
2026-05-25 14:44:58 +02:00
2026-05-25 13:51:45 +02:00
2026-04-30 03:42:25 +02:00
2026-05-20 14:46:36 +02:00
2026-04-30 16:46:31 +02:00
2026-05-13 00:18:42 +02:00
2026-05-07 13:15:55 +02:00
2026-05-07 12:51:37 +02:00