|
| 1 | +# PR_26168_245-postgres-backup-foundation |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | +- PASS: Current branch was `main`. |
| 5 | +- Expected branch: `main`. |
| 6 | +- Local branches found: `main`. |
| 7 | + |
| 8 | +## Summary |
| 9 | +- Create Backup now routes through Admin Operations to the Local API and runs a server-side Postgres backup foundation. |
| 10 | +- The Local API validates the configured database connection with a lightweight Postgres query before attempting backup. |
| 11 | +- Backup execution uses `pg_dump --format=custom` and writes to `GAMEFOUNDRY_DB_BACKUP_DIR` on the server side. |
| 12 | +- Backup filenames use `gamefoundry-<environment>-db-<YYJJJ>-<sequence>.dump`. |
| 13 | +- Browser backup downloads/storage were removed from Create Backup; the UI shows the Local API PASS/FAIL result only. |
| 14 | +- Restore From Backup is guarded scaffold-only and does not apply browser-uploaded backup data. |
| 15 | + |
| 16 | +## Requirement Checklist |
| 17 | +- PASS: Hard stop guard passed on `main`. |
| 18 | +- PASS: Admin Operations Create Backup button calls the Local API action route. |
| 19 | +- PASS: Local API Create Backup validates DB connection before `pg_dump`. |
| 20 | +- PASS: Local API backup service runs `pg_dump --format=custom` for backups. |
| 21 | +- PASS: Backup filename format implemented as `gamefoundry-<environment>-db-<YYJJJ>-<sequence>.dump`. |
| 22 | +- PASS: Backup output is directed to `GAMEFOUNDRY_DB_BACKUP_DIR`; repo `tmp/` backup targets are rejected. |
| 23 | +- PASS: `.env.example` includes `GAMEFOUNDRY_DB_BACKUP_DIR=`. |
| 24 | +- PASS: `.env.dev`, `.env.ist`, `.env.uat`, and `.env.prd` were updated locally with `GAMEFOUNDRY_DB_BACKUP_DIR=`; they are gitignored and contain private values, so they are not included in review artifacts or ZIP output. |
| 25 | +- PASS: No real backup files or `.dump` files were created in the repo. |
| 26 | +- PASS: Missing `GAMEFOUNDRY_DB_BACKUP_DIR` returns visible FAIL diagnostics. |
| 27 | +- PASS: Missing `pg_dump` returns visible FAIL diagnostics. |
| 28 | +- PASS: Successful backup reports PASS with filename, size, and timestamp. |
| 29 | +- PASS: DB passwords and secrets are not exposed in UI results, reports, command args, or ZIP artifacts. |
| 30 | +- PASS: Restore From Backup remains guarded scaffold-only. |
| 31 | +- PASS: Export Project Package still shows visible feedback and fails visibly if package bytes are missing. |
| 32 | +- PASS: No inline scripts, inline styles, style blocks, script blocks, or inline event handlers were added. |
| 33 | +- PASS: No unrelated import, migration, reseed, or Project Workspace behavior was added. |
| 34 | + |
| 35 | +## Validation Lane Report |
| 36 | +- PASS: `node --check src/dev-runtime/database/postgres-backup-service.mjs` |
| 37 | +- PASS: `node --check src/dev-runtime/server/local-api-router.mjs` |
| 38 | +- PASS: `node --check assets/theme-v2/js/admin-operations.js` |
| 39 | +- PASS: `node --check tests/dev-runtime/PostgresBackupService.test.mjs` |
| 40 | +- PASS: `node --check tests/playwright/tools/AdminPlatformToolsWireframes.spec.mjs` |
| 41 | +- PASS: `rg --pcre2 -n "<script(?![^>]+src=)|<style|\s(onclick|onchange|oninput|onsubmit|onkeydown|onkeyup|onload)=" admin/operations.html` returned no matches. |
| 42 | +- PASS: `node --test tests/dev-runtime/PostgresBackupService.test.mjs` |
| 43 | + - 5 passed. |
| 44 | + - Covered filename format, missing backup dir, unavailable `pg_dump`, repo `tmp/` rejection, and successful custom-format dump command construction. |
| 45 | +- PASS: `npx playwright test tests/playwright/tools/AdminPlatformToolsWireframes.spec.mjs --grep "Admin Operations" --reporter=line` |
| 46 | + - 4 passed. |
| 47 | + - Covered Create Backup visible PASS/FAIL behavior, Export Project Package visible feedback, no silent no-op behavior, no secret exposure, Admin Operations section order, DEV reseed gating, and non-admin access blocking. |
| 48 | +- PASS: Playwright V8 coverage report generated at `docs_build/dev/reports/playwright_v8_coverage_report.txt`. |
| 49 | + |
| 50 | +## Manual Validation Notes |
| 51 | +- Create Backup success path now reports the server-side `.dump` filename, byte size, timestamp, and current environment. |
| 52 | +- Create Backup failure paths are visible and actionable for missing backup directory, disallowed repo `tmp/` target, unavailable `pg_dump`, invalid database config, failed database connection validation, and failed `pg_dump`. |
| 53 | +- The service passes the DB password to `pg_dump` through `PGPASSWORD`; it is not included in command arguments or browser-visible results. |
| 54 | +- Actual live backup creation requires a real `.env` with `GAMEFOUNDRY_DB_BACKUP_DIR`, a reachable Postgres database, and PostgreSQL client tools installed on the Local API host. |
| 55 | + |
| 56 | +## Full Samples Decision |
| 57 | +- SKIP: Full samples smoke was not run because this PR only changes Admin Operations backup feedback, Local API backup service behavior, env placeholders, and targeted tests. No sample JSON or sample runtime surface was touched. |
0 commit comments