Skip to content

Commit cb17f22

Browse files
committed
PR_26171_ALPHA_023 game journey postgres metrics migration
1 parent 1b27b0a commit cb17f22

14 files changed

Lines changed: 546 additions & 386 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# PR_26171_ALPHA_023 Migration And Data Preservation Notes
2+
3+
TEAM ownership: ALPHA.
4+
5+
Migration behavior:
6+
- Active Game Journey completion metrics persistence now uses Postgres through `GAMEFOUNDRY_DATABASE_URL`.
7+
- The legacy SQLite file path is treated as a data-preservation guard only.
8+
- Existing legacy SQLite metrics data is preserved in place and is not deleted or overwritten.
9+
- If the legacy file exists, the metrics store stops with an actionable diagnostic instead of silently replacing data with Postgres seed rows.
10+
- No SQLite fallback is used after the Postgres path is active.
11+
12+
Operator action when legacy data exists:
13+
- Export or migrate legacy metrics into Postgres.
14+
- Verify the Postgres `game_journey_completion_metrics` table contains the expected rows.
15+
- Move or archive the legacy SQLite file after verification.
16+
- Restart the Local API.
17+
18+
Known local state:
19+
- This workspace had an ignored legacy metrics file under `tmp/local-api/`; tests used injected Postgres stubs and disabled the legacy-path guard only for isolated validation.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# PR_26171_ALPHA_023 Instruction Compliance Checklist
2+
3+
TEAM ownership: ALPHA.
4+
5+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md`.
6+
- PASS: Read `docs_build/dev/PROJECT_MULTI_PC.txt`.
7+
- PASS: Verified Game Journey is Team Alpha owned.
8+
- PASS: Started from synced `main` before creating `team/ALPHA/game-journey`.
9+
- PASS: Scope stayed within Game Journey metrics persistence, Local API async pass-through, affected tests, and required reports.
10+
- PASS: Removed active Game Journey `node:sqlite` / `DatabaseSync` persistence.
11+
- PASS: Preserved data by blocking silent legacy SQLite replacement.
12+
- PASS: Used targeted validation only.
13+
- PASS: Did not run samples.
14+
- PASS: Required shared reports are generated under `docs_build/dev/reports/`.
15+
- PASS: Manual validation notes are present.
16+
- PASS: Repo-structured ZIP is required under `tmp/`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PR_26171_ALPHA_023 Manual Validation Notes
2+
3+
TEAM ownership: ALPHA.
4+
5+
Manual validation performed:
6+
- Confirmed Game Journey completion metrics dashboard renders through the Local API with a Postgres client stub.
7+
- Confirmed `/api/game-journey/completion-metrics` returns `databaseEngine: "Postgres"` and the existing 14 completion metric records.
8+
- Confirmed updating `001-idea` persists through the Postgres stub and returns `updatedMetric`.
9+
- Confirmed missing Postgres configuration reports `GAMEFOUNDRY_DATABASE_URL`.
10+
- Confirmed legacy SQLite data guard blocks startup without deleting the legacy file.
11+
12+
Expected outcome:
13+
- Game Journey completion metrics preserve user-visible behavior and response shapes.
14+
- Active metrics persistence no longer depends on `node:sqlite` or `DatabaseSync`.
15+
- Legacy SQLite data cannot be silently dropped during cutover.
16+
17+
Out of scope:
18+
- Full samples smoke.
19+
- Broad Game Journey editor/detail regression tests.
20+
- Live Postgres connectivity against an operator database.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# PR_26171_ALPHA_023-game-journey-postgres-metrics-migration
2+
3+
## Summary
4+
5+
TEAM ownership: ALPHA.
6+
7+
Branch: `team/ALPHA/game-journey`.
8+
9+
Scope completed:
10+
- Migrated Game Journey completion metrics persistence from active SQLite usage to Postgres.
11+
- Replaced `node:sqlite` / `DatabaseSync` usage in `src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs`.
12+
- Reused the existing `createPostgresConnectionClient` dev-runtime pattern backed by `GAMEFOUNDRY_DATABASE_URL`.
13+
- Preserved the existing Game Journey completion metrics API response shape, including summary counts, `records`, `updatedMetric`, and compatibility metadata fields.
14+
- Updated Game Journey repository and Local API routes to await the Postgres-backed metrics store.
15+
- Updated affected Game Journey Playwright tests to use an injected Postgres client stub.
16+
17+
## Validation
18+
19+
Passed:
20+
- `git diff --check`
21+
- `node --check src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs`
22+
- `node --check src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js`
23+
- `node --check src/dev-runtime/server/local-api-router.mjs`
24+
- `node --check tests/playwright/tools/GameJourneyTool.spec.mjs`
25+
- `node --check tests/helpers/playwrightRepoServer.mjs`
26+
- `node --check tests/helpers/gameJourneyCompletionMetricsPostgresClientStub.mjs`
27+
- `npx playwright test tests/playwright/tools/GameJourneyTool.spec.mjs --config=codex_playwright_system_chrome.config.cjs --project=playwright -g "Game Journey progress dashboard|Game Journey mock data keeps system guidance template-owned|Game Journey Local API persists completion metrics to Postgres|Game Journey completion metrics fail visibly|Game Journey completion metrics protect legacy SQLite"`
28+
29+
Targeted checks:
30+
- Verified changed Game Journey metrics paths no longer import `node:sqlite` or `DatabaseSync`.
31+
- Verified missing Postgres configuration fails with an actionable `GAMEFOUNDRY_DATABASE_URL` diagnostic.
32+
- Verified legacy SQLite metrics files are not deleted or silently ignored.
33+
- Verified no secret values are emitted by the metrics store.
34+
35+
Skipped:
36+
- Full samples smoke: out of scope for this Game Journey metrics persistence migration.
37+
- Broad Game Journey editor/detail Playwright cases: out of scope for completion metrics persistence. A broader exploratory run surfaced editor/detail assertions outside the metrics path, so the completion gate used the affected metrics/API lane only.
38+
39+
## Data Preservation
40+
41+
The Postgres metrics store does not delete, overwrite, or fall back to legacy SQLite data.
42+
43+
If a legacy Game Journey completion metrics SQLite file exists at the configured legacy path, the store fails visibly before seeding Postgres and reports that the operator must export or migrate the legacy data before moving the file. This prevents silent data loss while removing SQLite as the active persistence path.
44+
45+
Tests inject `gameJourneyCompletionMetricsLegacyDbPath: null` with a Postgres client stub so the active Postgres path can be validated without touching ignored local runtime files.
Lines changed: 28 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,30 @@
1-
# PR_26171_GAMMA_019-admin-workstream-mergeability-recovery changed files
1+
## git status --short
2+
A docs_build/dev/reports/PR_26171_ALPHA_023-game-journey-postgres-metrics-migration-data-preservation-notes.md
3+
A docs_build/dev/reports/PR_26171_ALPHA_023-game-journey-postgres-metrics-migration-instruction-compliance-checklist.md
4+
A docs_build/dev/reports/PR_26171_ALPHA_023-game-journey-postgres-metrics-migration-manual-validation-notes.md
5+
A docs_build/dev/reports/PR_26171_ALPHA_023-game-journey-postgres-metrics-migration.md
6+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
7+
M docs_build/dev/reports/playwright_v8_coverage_report.txt
8+
M src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs
9+
M src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js
10+
M src/dev-runtime/server/local-api-router.mjs
11+
A tests/helpers/gameJourneyCompletionMetricsPostgresClientStub.mjs
12+
M tests/helpers/playwrightRepoServer.mjs
13+
M tests/playwright/tools/GameJourneyTool.spec.mjs
214

3-
Base: origin/main 35b04c02ea54da8b13c10354126f1ee8ddd14a89
4-
Head before recovery merge commit: 1806adbf5df787f7072c6579d23b99bb4257466b
15+
## git diff --cached --stat
16+
...es-metrics-migration-data-preservation-notes.md | 19 ++
17+
...s-migration-instruction-compliance-checklist.md | 16 +
18+
...es-metrics-migration-manual-validation-notes.md | 20 ++
19+
..._023-game-journey-postgres-metrics-migration.md | 45 +++
20+
.../dev/reports/coverage_changed_js_guardrail.txt | 30 +-
21+
.../dev/reports/playwright_v8_coverage_report.txt | 85 +----
22+
.../game-journey-completion-metrics-store.mjs | 369 ++++++++++++---------
23+
.../game-journey-mock-repository.js | 6 +-
24+
src/dev-runtime/server/local-api-router.mjs | 41 ++-
25+
...eJourneyCompletionMetricsPostgresClientStub.mjs | 87 +++++
26+
tests/helpers/playwrightRepoServer.mjs | 11 +-
27+
tests/playwright/tools/GameJourneyTool.spec.mjs | 108 ++++--
28+
12 files changed, 518 insertions(+), 319 deletions(-)
529

6-
## Changed files against origin/main
7-
M admin/system-health.html
8-
M assets/theme-v2/js/admin-system-health.js
9-
A docs_build/dev/reports/PR_26171_GAMMA_011-admin-system-health-foundation-instruction-compliance-checklist.md
10-
A docs_build/dev/reports/PR_26171_GAMMA_011-admin-system-health-foundation-manual-validation-notes.md
11-
A docs_build/dev/reports/PR_26171_GAMMA_011-admin-system-health-foundation.md
12-
A docs_build/dev/reports/PR_26171_GAMMA_012-admin-system-health-status-reason-cleanup-instruction-compliance-checklist.md
13-
A docs_build/dev/reports/PR_26171_GAMMA_012-admin-system-health-status-reason-cleanup-manual-validation-notes.md
14-
A docs_build/dev/reports/PR_26171_GAMMA_012-admin-system-health-status-reason-cleanup.md
15-
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan-instruction-compliance-checklist.md
16-
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan-manual-validation-notes.md
17-
A docs_build/dev/reports/PR_26171_GAMMA_013-admin-system-health-diagnostics-plan.md
18-
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-instruction-compliance-checklist.md
19-
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime-manual-validation-notes.md
20-
A docs_build/dev/reports/PR_26171_GAMMA_014-admin-postgres-diagnostics-runtime.md
21-
A docs_build/dev/reports/PR_26171_GAMMA_015-admin-r2-diagnostics-runtime-instruction-compliance-checklist.md
22-
A docs_build/dev/reports/PR_26171_GAMMA_015-admin-r2-diagnostics-runtime-manual-validation-notes.md
23-
A docs_build/dev/reports/PR_26171_GAMMA_015-admin-r2-diagnostics-runtime.md
24-
A docs_build/dev/reports/PR_26171_GAMMA_016-admin-runtime-environment-runtime-instruction-compliance-checklist.md
25-
A docs_build/dev/reports/PR_26171_GAMMA_016-admin-runtime-environment-runtime-manual-validation-notes.md
26-
A docs_build/dev/reports/PR_26171_GAMMA_016-admin-runtime-environment-runtime.md
27-
A docs_build/dev/reports/PR_26171_GAMMA_019-admin-workstream-mergeability-recovery.md
28-
M docs_build/dev/reports/codex_changed_files.txt
29-
M docs_build/dev/reports/codex_review.diff
30-
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
31-
M docs_build/dev/reports/playwright_v8_coverage_report.txt
32-
M src/dev-runtime/server/local-api-router.mjs
33-
M tests/playwright/tools/AdminHealthOperationsPage.spec.mjs
34-
35-
## Diff stat against origin/main
36-
admin/system-health.html | 366 +--
37-
assets/theme-v2/js/admin-system-health.js | 505 ++--
38-
...-foundation-instruction-compliance-checklist.md | 32 +
39-
...em-health-foundation-manual-validation-notes.md | 34 +
40-
...171_GAMMA_011-admin-system-health-foundation.md | 65 +
41-
...son-cleanup-instruction-compliance-checklist.md | 57 +
42-
...tatus-reason-cleanup-manual-validation-notes.md | 26 +
43-
...12-admin-system-health-status-reason-cleanup.md | 70 +
44-
...ostics-plan-instruction-compliance-checklist.md | 64 +
45-
...lth-diagnostics-plan-manual-validation-notes.md | 27 +
46-
...MMA_013-admin-system-health-diagnostics-plan.md | 82 +
47-
...ics-runtime-instruction-compliance-checklist.md | 64 +
48-
...-diagnostics-runtime-manual-validation-notes.md | 27 +
49-
...GAMMA_014-admin-postgres-diagnostics-runtime.md | 93 +
50-
...ics-runtime-instruction-compliance-checklist.md | 62 +
51-
...-diagnostics-runtime-manual-validation-notes.md | 26 +
52-
...26171_GAMMA_015-admin-r2-diagnostics-runtime.md | 95 +
53-
...ent-runtime-instruction-compliance-checklist.md | 66 +
54-
...-environment-runtime-manual-validation-notes.md | 28 +
55-
..._GAMMA_016-admin-runtime-environment-runtime.md | 102 +
56-
...A_019-admin-workstream-mergeability-recovery.md | 50 +
57-
docs_build/dev/reports/codex_changed_files.txt | 79 +-
58-
docs_build/dev/reports/codex_review.diff | 2696 +++++++++++++++++---
59-
.../dev/reports/coverage_changed_js_guardrail.txt | 28 +
60-
.../dev/reports/playwright_v8_coverage_report.txt | 94 +-
61-
src/dev-runtime/server/local-api-router.mjs | 46 +
62-
.../tools/AdminHealthOperationsPage.spec.mjs | 151 +-
63-
27 files changed, 4034 insertions(+), 1001 deletions(-)
64-
65-
## Validation evidence
66-
- git diff --check: PASS
67-
- git diff --cached --check: PASS
68-
- npx playwright test tests/playwright/tools/AdminHealthOperationsPage.spec.mjs --config=codex_playwright_system_chrome.config.cjs --project=playwright: PASS (3 passed)
69-
- samples smoke: SKIPPED by request
30+
## git diff --stat
-36.1 KB
Binary file not shown.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,11 @@ Missing changed runtime JS files are WARN, not FAIL.
66
Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
9-
(0%) assets/theme-v2/js/account-achievements.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10-
(0%) src/dev-runtime/messages/messages-sqlite-service.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11-
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
9+
(0%) src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1210
(0%) src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
13-
(0%) src/dev-runtime/seed/server-seed-loader.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1411
(0%) src/dev-runtime/server/local-api-router.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
15-
(0%) src/shared/toolbox/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
16-
(0%) toolbox/controls/controls.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
17-
(0%) toolbox/game-hub/game-hub-api-client.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
18-
(0%) toolbox/game-hub/game-hub.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
19-
(0%) toolbox/game-journey/game-journey.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
20-
(0%) toolbox/idea-board/index.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21-
(0%) toolbox/messages/messages.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
22-
(0%) toolbox/text-to-speech/text2speech.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
23-
(0%) toolbox/tools-page-accordions.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
24-
(74%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 977/977; executed functions 67/90
25-
(90%) assets/theme-v2/js/admin-system-health.js - executed lines 227/227; executed functions 28/31
2612

2713
Guardrail warnings:
28-
(0%) assets/theme-v2/js/account-achievements.js - WARNING: changed runtime JS file missing from coverage; advisory only
29-
(0%) src/dev-runtime/messages/messages-sqlite-service.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
30-
(0%) src/dev-runtime/persistence/mock-db-store.js - WARNING: changed runtime JS file missing from coverage; advisory only
14+
(0%) src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
3115
(0%) src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
32-
(0%) src/dev-runtime/seed/server-seed-loader.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
3316
(0%) src/dev-runtime/server/local-api-router.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
34-
(0%) src/shared/toolbox/tool-metadata-inventory.js - WARNING: changed runtime JS file missing from coverage; advisory only
35-
(0%) toolbox/controls/controls.js - WARNING: changed runtime JS file missing from coverage; advisory only
36-
(0%) toolbox/game-hub/game-hub-api-client.js - WARNING: changed runtime JS file missing from coverage; advisory only
37-
(0%) toolbox/game-hub/game-hub.js - WARNING: changed runtime JS file missing from coverage; advisory only
38-
(0%) toolbox/game-journey/game-journey.js - WARNING: changed runtime JS file missing from coverage; advisory only
39-
(0%) toolbox/idea-board/index.js - WARNING: changed runtime JS file missing from coverage; advisory only
40-
(0%) toolbox/messages/messages.js - WARNING: changed runtime JS file missing from coverage; advisory only
41-
(0%) toolbox/text-to-speech/text2speech.js - WARNING: changed runtime JS file missing from coverage; advisory only
42-
(0%) toolbox/tools-page-accordions.js - WARNING: changed runtime JS file missing from coverage; advisory only

0 commit comments

Comments
 (0)