Skip to content

Commit be09af4

Browse files
committed
Add creator-driven Game Journey completion metrics - PR_26171_001-game-journey-completion-model
1 parent b0fb553 commit be09af4

22 files changed

Lines changed: 3738 additions & 793 deletions

docs_build/database/ddl/game-journey.sql

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,30 @@
44
-- Target DEV database: gamefoundry_dev
55
-- Scope: executable grouped table DDL for active Supabase/server API migration.
66
-- Authoritative key values are generated by the server/API layer unless a later DEV-only seed exception explicitly applies.
7-
-- Owned tables: game_journey_note_types, game_journey_notes, game_journey_templates, game_journey_items, game_journey_activity
7+
-- Owned tables: game_journey_completion_metrics, game_journey_note_types, game_journey_notes, game_journey_templates, game_journey_items, game_journey_activity
8+
CREATE TABLE IF NOT EXISTS game_journey_completion_metrics (
9+
key text PRIMARY KEY,
10+
"bucketKey" text NOT NULL UNIQUE,
11+
"bucketOrder" integer NOT NULL DEFAULT 0,
12+
"bucketName" text NOT NULL,
13+
"friendlyDescription" text NOT NULL,
14+
"requiredForMvp" boolean NOT NULL DEFAULT false,
15+
"canSkip" boolean NOT NULL DEFAULT false,
16+
"plannedCount" integer NOT NULL DEFAULT 0,
17+
"completedCount" integer NOT NULL DEFAULT 0,
18+
"active" boolean NOT NULL DEFAULT true,
19+
"status" text NOT NULL DEFAULT 'active',
20+
"createdAt" timestamptz NOT NULL DEFAULT now(),
21+
"updatedAt" timestamptz NOT NULL DEFAULT now(),
22+
"createdBy" text NOT NULL REFERENCES users(key),
23+
"updatedBy" text NOT NULL REFERENCES users(key)
24+
);
25+
26+
CREATE INDEX IF NOT EXISTS idx_game_journey_completion_metrics_active ON game_journey_completion_metrics ("active");
27+
CREATE INDEX IF NOT EXISTS idx_game_journey_completion_metrics_status ON game_journey_completion_metrics ("status");
28+
CREATE INDEX IF NOT EXISTS idx_game_journey_completion_metrics_createdby ON game_journey_completion_metrics ("createdBy");
29+
CREATE INDEX IF NOT EXISTS idx_game_journey_completion_metrics_updatedby ON game_journey_completion_metrics ("updatedBy");
30+
831
CREATE TABLE IF NOT EXISTS game_journey_note_types (
932
key text PRIMARY KEY,
1033
"typeSlug" text,

docs_build/database/dml/game-journey.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- Runtime setup/seed operations for this group must run through server-side APIs.
55
-- Temporary scope: DEV/review artifact only until Admin Site Setup/server seed APIs fully own grouped setup.
66
-- Browser pages must not directly seed authoritative DB records.
7-
-- Owned tables: game_journey_note_types, game_journey_notes, game_journey_templates, game_journey_items, game_journey_activity
7+
-- Owned tables: game_journey_completion_metrics, game_journey_note_types, game_journey_notes, game_journey_templates, game_journey_items, game_journey_activity
88

99
-- DML status: Server-seed-owned.
1010
-- Setup is performed through the Admin-owned server-side seed API.

docs_build/database/seed/game-journey.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"serverSideSeedRequired": true,
66
"browserAuthoritativeKeyGenerationAllowed": false,
77
"tables": {
8+
"game_journey_completion_metrics": [],
89
"game_journey_note_types": [],
910
"game_journey_notes": [],
1011
"game_journey_templates": [],

docs_build/database/seed/guest/game-journey.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"writableByGuest": false,
77
"signInRedirect": "account/sign-in.html",
88
"tables": {
9+
"game_journey_completion_metrics": [],
910
"game_journey_note_types": [],
1011
"game_journey_notes": [],
1112
"game_journey_templates": [],
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# PR_26171_001 Manual Validation Notes
2+
3+
## Local API Snapshot
4+
- The completion metrics endpoint returns 14 Game Journey buckets.
5+
- The seeded model totals 66 planned items.
6+
- Initial status distribution is 10 active buckets and 4 inactive buckets.
7+
- Initial completion is 0 completed items and 0%.
8+
9+
## Persistence Probe
10+
- An isolated SQLite path under `tmp/local-api` was used for validation.
11+
- Updating bucket `001-idea` with `active: true`, `plannedCount: 4`, and `completedCount: 2` returned `percentComplete: 50`.
12+
- Reading the SQLite row directly confirmed:
13+
- `plannedCount = 4`
14+
- `completedCount = 2`
15+
- `active = 1`
16+
- `status = active`
17+
18+
## UI Review
19+
- Toolbox Game Journey accordion labels now derive from numeric API metrics.
20+
- Placeholder `xxx%` labels were removed from the rendered accordion expectations.
21+
- Game Journey now includes a completion metrics table with planned, completed, percent, and active/inactive status columns.
22+
23+
## Known Validation Issue
24+
- `npm run test:workspace-v2` still fails in the workspace/root lane because several pages request `127.0.0.1:5501/api/...` during Playwright execution and one header-order assertion does not match the current rendered menu order.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# PR_26171_001 Validation Report
2+
3+
## Targeted Syntax Checks
4+
Status: PASS
5+
6+
Command:
7+
`node --check` was run against the changed runtime, API, UI, and targeted Playwright files:
8+
- `src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs`
9+
- `src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js`
10+
- `src/dev-runtime/server/local-api-router.mjs`
11+
- `src/api/game-journey-completion-api-client.js`
12+
- `toolbox/game-journey/game-journey-api-client.js`
13+
- `toolbox/game-journey/game-journey.js`
14+
- `toolbox/tools-page-accordions.js`
15+
- `tests/playwright/tools/GameJourneyTool.spec.mjs`
16+
- `tests/playwright/tools/ToolboxRoutePages.spec.mjs`
17+
- `tests/playwright/tools/AdminDbViewer.spec.mjs`
18+
- `src/dev-runtime/auth/provider-contract-stubs.mjs`
19+
- `src/dev-runtime/persistence/mock-db-store.js`
20+
21+
## Diff Whitespace Check
22+
Status: PASS
23+
24+
Command:
25+
`git diff --check`
26+
27+
Result:
28+
No whitespace errors were reported. Git printed normal CRLF normalization warnings for existing text files.
29+
30+
## Local API And SQLite Persistence
31+
Status: PASS
32+
33+
Command:
34+
`npx playwright test tests/playwright/tools/GameJourneyTool.spec.mjs -g "Game Journey Local API persists completion metrics to SQLite" --workers=1 --reporter=list`
35+
36+
Result:
37+
`1 passed`
38+
39+
Coverage:
40+
- `GET /api/game-journey/completion-metrics` returned the SQLite-backed model.
41+
- `POST /api/game-journey/completion-metrics/001-idea` updated planned/completed counts and active status.
42+
- The test opened the physical SQLite database and verified `plannedCount`, `completedCount`, `active`, and `status` persisted on the row.
43+
44+
Note:
45+
Node emitted the expected experimental warning for `node:sqlite`.
46+
47+
## Workspace V2 Test Lane
48+
Status: FAIL
49+
50+
Command:
51+
`npm run test:workspace-v2`
52+
53+
Result:
54+
The lane failed. Observed failures were in existing workspace/root route coverage, including:
55+
- `RootToolsFutureState.spec.mjs` root tools control-card count remained `0`.
56+
- Header primary navigation order assertion expected `Game Hub` before `Game Journey`, while the rendered order had `Game Journey` before `Game Hub`.
57+
- Several workspace/root page tests attempted API requests against `http://127.0.0.1:5501/api/...` instead of the ephemeral Playwright server.
58+
59+
Follow-up:
60+
The focused Game Journey Local API + SQLite persistence validation passed separately.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# PR_26171_001 Game Journey Completion Model
2+
3+
## Scope
4+
- Added a Game Journey completion metric model backed by a Local API route and SQLite persistence.
5+
- Updated Game Journey UI surfaces to render numeric planned/completed counts and calculated completion percentages.
6+
- Added active/inactive bucket status to the persisted completion model and admin/database table metadata.
7+
8+
## Implementation
9+
- Added `game_journey_completion_metrics` SQLite persistence with 14 seeded Game Journey buckets, stable seed keys, planned counts, completed counts, calculated percentages, and active/inactive status.
10+
- Added Local API routes:
11+
- `GET /api/game-journey/completion-metrics`
12+
- `POST /api/game-journey/completion-metrics/:bucketKey`
13+
- `PATCH /api/game-journey/completion-metrics/:bucketKey`
14+
- Added a browser API client for completion metrics and re-exported it from the Game Journey client.
15+
- Updated toolbox Game Journey accordions to use API-provided numeric labels instead of placeholder `xxx%` labels.
16+
- Added a Game Journey completion metrics table view with bucket, planned, completed, percent, and status columns.
17+
- Added database DDL/DML/seed metadata and mock DB schema/table ownership metadata for the new metrics table.
18+
- Updated targeted Playwright expectations and added a Local API + SQLite persistence test.
19+
20+
## Notes
21+
- No engine core files were modified.
22+
- No `start_of_day` folders were modified.
23+
- No `imageDataUrl` contract fields were added.
Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
# git status --short
2-
?? docs_build/dev/admin-notes/GFS_Game_Journey_Master_Plan.txt
3-
?? docs_build/dev/reports/PR_26170_014-game-journey-master-plan.md
4-
?? docs_build/pr/BUILD_PR_26170_014-game-journey-master-plan.md
5-
6-
# git ls-files --others --exclude-standard
7-
docs_build/dev/admin-notes/GFS_Game_Journey_Master_Plan.txt
8-
docs_build/dev/reports/PR_26170_014-game-journey-master-plan.md
9-
docs_build/pr/BUILD_PR_26170_014-game-journey-master-plan.md
10-
11-
# git diff --stat
12-
(no output)
1+
docs_build/database/ddl/game-journey.sql
2+
docs_build/database/dml/game-journey.sql
3+
docs_build/database/seed/game-journey.json
4+
docs_build/database/seed/guest/game-journey.json
5+
docs_build/dev/reports/codex_changed_files.txt
6+
docs_build/dev/reports/codex_review.diff
7+
docs_build/dev/reports/PR_26171_001-game-journey-completion-model-manual-validation.md
8+
docs_build/dev/reports/PR_26171_001-game-journey-completion-model-validation.md
9+
docs_build/dev/reports/PR_26171_001-game-journey-completion-model.md
10+
src/api/game-journey-completion-api-client.js
11+
src/dev-runtime/auth/provider-contract-stubs.mjs
12+
src/dev-runtime/persistence/game-journey-completion-metrics-store.mjs
13+
src/dev-runtime/persistence/mock-db-store.js
14+
src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js
15+
src/dev-runtime/server/local-api-router.mjs
16+
tests/playwright/tools/AdminDbViewer.spec.mjs
17+
tests/playwright/tools/GameJourneyTool.spec.mjs
18+
tests/playwright/tools/ToolboxRoutePages.spec.mjs
19+
toolbox/game-journey/game-journey-api-client.js
20+
toolbox/game-journey/game-journey.js
21+
toolbox/game-journey/index.html
22+
toolbox/tools-page-accordions.js

0 commit comments

Comments
 (0)