GPT Review — Backup Triage Fix Path Decision
GPT Review — Backup Triage Fix Path Decision
Date: 2026-04-27
Scope: Review Claude Code triage report knowledge/dev/laws/dieu38-trien-khai/reports/p9-g6-backup-incident-triage-fix-plan-2026-04-27.md and Opus evaluation.
Verdict
Claude Code PASS. Proceed to a narrow governed fix gate: Option A + Option D.
Do not wait for broader P7/C2 ownership clarification before restoring backups. Backup integrity is an operational blocker and should be restored first. Medium-term ownership/cleanup of sandbox_tac can be handled after backups are healthy.
Evidence checked
knowledge/dev/laws/dieu38-trien-khai/reports/p9-g6-backup-incident-triage-fix-plan-2026-04-27.mdrev 1.knowledge/dev/reports/gpt-review-backup-incident-triage-dispatch-final-pass-2026-04-27.md.knowledge/dev/reports/gpt-review-backup-recovery-root-cause-sandbox-tac-2026-04-27.md.- Prior P7B/PF-4 evidence:
sandbox_tacwas a P7B/C2 sandbox schema and had 0 Directus collections exposed.
Findings
sandbox_tacis owned byworkflow_admin, notdirectus.- It has 8 tables, at least 243 live rows, 3 functions, and 2 triggers.
- It is standalone except internal
pg_toastdependency. - It has 0 Directus collection binding based on prior PF-4 evidence and current triage.
directuslacksUSAGEonsandbox_tac, causingpg_dumpfailure.- Backup failure window is about 37–41h, with last good backup around 2026-04-26 02:00 UTC at about 43.7 MB.
- Script was already partially hardened in S174; the remaining weakness is failure cleanup/notification behavior around
pg_dump | gzipwithset -euo pipefail. - Kuma did not false-report UP; failure was DOWN-by-absence / no success heartbeat. The previous Opus assumption was incorrect and should be corrected.
Decision
Choose Option A + Option D now:
Option A — narrow grant for backup restore
Grant only what is needed for backup role directus to dump sandbox_tac:
GRANT USAGE ON SCHEMA sandbox_tac TO directus;GRANT SELECT ON ALL TABLES IN SCHEMA sandbox_tac TO directus;- If sequences exist or appear later:
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA sandbox_tac TO directus;
Do not grant CREATE. Do not modify owners. Do not expose Directus collections. Do not change search_path.
Option D — script hardening companion
Patch the governed backup script so future dump failures do not leave misleading output and do not silently disappear:
- Use temp output file and atomic move only after validation PASS.
- Add trap/cleanup for incomplete temp files.
- Preserve
set -euo pipefail. - Make validation explicit: size threshold, gzip validity, PG dump header/table sanity.
- Success heartbeat only after validation PASS.
- Failure notification/alert path should be explicit without leaking secrets. If Kuma supports explicit failure status in the existing setup, use it; otherwise rely on absence of success heartbeat plus Telegram/log alert.
Law / constitutional check
| Rule | Result | Finding |
|---|---|---|
| Hiến pháp / Zero Trust | PASS | Fix is scoped to restoring backup integrity; post-verify required. |
| Đ33 DB governance | PASS if gated | GRANT is DDL and must be executed only via a scoped governed gate. |
| Đ35 / 100% DOT-AI | PASS if AI/DOT governed | User must not run manual psql; Claude Code/agent can execute after explicit authorization. |
| Đ32 gate discipline | PASS | Fix gate must be separate from G6 retry. |
| Đ24 | PASS | No taxonomy/entity labels involved. |
Required next step
Opus should draft a compact Backup Fix Execution Gate — Option A + D for Claude Code, medium/high effort. Because it includes production DDL GRANT plus script patch, recommended effort is high (not xhigh unless the executor has low confidence). The task should be one execution block with pre-checks, mutation, post-verify, and action log.
The gate must include:
- Pre-checks:
- VPS context.
- Confirm
sandbox_tacexists anddirectuslacks required privileges. - Confirm no Directus collections bind
sandbox_tac. - Confirm current backup script path, owner, permissions, and last good backup baseline.
- Backup script snapshot/hash before edit.
- Mutations:
- Apply narrow GRANTs only.
- Patch backup script hardening only; no cron/systemd/rclone destination changes.
- Post-verify:
has_schema_privilege('directus','sandbox_tac','USAGE') = true.- Table SELECT privilege sufficient for backup.
- Run governed backup script.
- New backup is non-trivial size, gzip valid, PG header/table sanity PASS.
- No 20-byte output remains as “latest good”.
- Failure path documented if backup still fails.
- Action log:
knowledge/dev/laws/dieu38-trien-khai/reports/p9-g6-backup-fix-option-a-d-log-2026-04-27.md.
- Stop after report. No G6 retry, no PF-07 wrapper patch, no Directus mutation.
Medium-term follow-up after backup restored
- Decide whether to keep, cleanup, or archive
sandbox_tacafter P7/C2 ownership clarification. - Update operational memory: code backup 4x/day vs full DB backup daily; remote
gdrive-backup:; Kuma failure behavior is DOWN-by-absence, not false-UP.