Skip to content

Commit a0d3937

Browse files
committed
PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception
1 parent 6ebe6a4 commit a0d3937

3 files changed

Lines changed: 128 additions & 109 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception
2+
3+
## Summary
4+
5+
Status: PASS with temporary legacy exception retained.
6+
7+
No executable implementation files were changed in this PR. The remaining Game Journey API client was reviewed after the PR_034 entrypoint migration:
8+
9+
- `toolbox/game-journey/game-journey-api-client.js`
10+
11+
The file remains in its approved legacy location because moving it into `assets/toolbox/game-journey/js/` would create a second canonical tool JS file that the current guardrail does not allow.
12+
13+
## Files Reviewed
14+
15+
- `docs_build/dev/ProjectInstructions/README.txt`
16+
- `docs_build/dev/ProjectInstructions/PROJECT_INSTRUCTIONS.md`
17+
- `docs_build/dev/reports/PR_26172_CHARLIE_033-game-journey-canonical-js-migration-audit.md`
18+
- `docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md`
19+
- `assets/toolbox/game-journey/js/index.js`
20+
- `toolbox/game-journey/game-journey-api-client.js`
21+
- `toolbox/game-journey/index.html`
22+
- `tests/playwright/tools/GameJourneyTool.spec.mjs`
23+
- `scripts/validate-canonical-repository-structure.mjs`
24+
- `scripts/validate-browser-env-agnostic.mjs`
25+
26+
## Decision
27+
28+
Decision: retain `toolbox/game-journey/game-journey-api-client.js` as a temporary legacy exception.
29+
30+
Reason:
31+
32+
- The current canonical guardrail approves the tool entrypoint path `assets/toolbox/{tool-name}/js/index.js`.
33+
- It does not approve an additional tool-local API client file under `assets/toolbox/game-journey/js/`.
34+
- Folding the API client into `index.js` would be a larger refactor and could obscure the completion-metrics API boundary.
35+
- The API client re-exports completion metrics helpers from `src/api/game-journey-completion-api-client.js`, so it should stay isolated until the shared-client/secondary-file rule is explicit.
36+
37+
Removal plan:
38+
39+
1. Add or clarify a canonical rule for tool-local secondary modules, or approve a shared API-client location.
40+
2. Move the API client only after the guardrail recognizes the destination.
41+
3. Update the canonical Game Journey entrypoint import.
42+
4. Re-run Game Journey route validation and completion-metrics validation.
43+
5. Remove `toolbox/game-journey/game-journey-api-client.js` from approved legacy exceptions after validation passes.
44+
45+
## Validation Lane Report
46+
47+
- `node --check toolbox/game-journey/game-journey-api-client.js`
48+
- Result: PASS
49+
- `npm run validate:canonical-structure`
50+
- Result: PASS
51+
- Blocking violations: 0
52+
- Approved legacy exceptions: 481
53+
- Active reference check
54+
- Result: PASS
55+
- The canonical entrypoint imports `toolbox/game-journey/game-journey-api-client.js`.
56+
- Guardrail and hardening tests still list the retained exception.
57+
- Historical `docs_build/pr` references to old `game-journey.js` remain unchanged.
58+
- Targeted Game Journey Playwright validation:
59+
- Command: `npx playwright test tests/playwright/tools/GameJourneyTool.spec.mjs --grep "Game Journey summary table uses inline notes" --workers=1 --reporter=line --timeout=90000`
60+
- Result: PASS
61+
62+
## Completion Metrics Note
63+
64+
The targeted validation used the existing test Postgres completion-metrics stub and passed. The local legacy SQLite preservation blocker documented in PR_26172_CHARLIE_006A remains a separate recovery/data-preservation concern, not a reason to move the API client in this PR.
65+
66+
## Branch Validation
67+
68+
- Current branch: `PR_26172_CHARLIE_repository-compliance-stack`
69+
- Expected branch: `PR_26172_CHARLIE_repository-compliance-stack`
70+
- Local/origin sync before PR: `0 0`
71+
- Branch validation: PASS
72+
73+
## Requirement Checklist
74+
75+
- Use PR_033 and PR_034 results: PASS
76+
- Move API client if safe: PASS, not safe under current guardrail.
77+
- Retain API client and document temporary legacy exception if not safe: PASS
78+
- Preserve behavior: PASS
79+
- No feature changes: PASS
80+
- Run targeted Game Journey validation: PASS
81+
- Run canonical structure guardrail: PASS
82+
- Confirm ZIP exists: PASS after artifact creation.
83+
84+
## Manual Validation Notes
85+
86+
The canonical Game Journey entrypoint is already active. Keeping the API client in the existing legacy path avoids introducing an unapproved secondary JS file pattern and avoids changing completion-metrics behavior.
87+
88+
## Recommendation
89+
90+
Continue to PR_036 final target-tool compliance reaudit. Treat `toolbox/game-journey/game-journey-api-client.js` as a retained exception with a defined removal plan.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
R099 toolbox/game-journey/game-journey.js assets/toolbox/game-journey/js/index.js
2-
A docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md
3-
M scripts/validate-canonical-repository-structure.mjs
4-
M tests/playwright/tools/GameJourneyTool.spec.mjs
5-
M toolbox/game-journey/index.html
1+
A docs_build/dev/reports/PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception.md
Lines changed: 37 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,73 @@
1-
diff --git a/toolbox/game-journey/game-journey.js b/assets/toolbox/game-journey/js/index.js
2-
similarity index 99%
3-
rename from toolbox/game-journey/game-journey.js
4-
rename to assets/toolbox/game-journey/js/index.js
5-
index c2b2f876c..0ebc4f2ca 100644
6-
--- a/toolbox/game-journey/game-journey.js
7-
+++ b/assets/toolbox/game-journey/js/index.js
8-
@@ -6,11 +6,11 @@ import {
9-
GAME_JOURNEY_SUGGESTED_TOOLS,
10-
createGameJourneyApiRepository,
11-
readGameJourneyCompletionMetrics,
12-
-} from "./game-journey-api-client.js";
13-
+} from "../../../../toolbox/game-journey/game-journey-api-client.js";
14-
import {
15-
getActiveToolRegistry,
16-
getToolRegistryApiDiagnostic,
17-
-} from "../tool-registry-api-client.js";
18-
+} from "../../../../toolbox/tool-registry-api-client.js";
19-
20-
const repository = createGameJourneyApiRepository();
21-
const registryDiagnostic = getToolRegistryApiDiagnostic();
22-
diff --git a/docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md b/docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md
1+
diff --git a/docs_build/dev/reports/PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception.md b/docs_build/dev/reports/PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception.md
232
new file mode 100644
24-
index 000000000..c03cd09f5
3+
index 000000000..d0f945e60
254
--- /dev/null
26-
+++ b/docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md
27-
@@ -0,0 +1,98 @@
28-
+# PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration
5+
+++ b/docs_build/dev/reports/PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception.md
6+
@@ -0,0 +1,90 @@
7+
+# PR_26172_CHARLIE_035-game-journey-api-client-migration-or-exception
298
+
309
+## Summary
3110
+
32-
+Status: PASS.
11+
+Status: PASS with temporary legacy exception retained.
3312
+
34-
+The Game Journey browser entrypoint was moved from the active legacy toolbox path to the canonical tool asset path:
13+
+No executable implementation files were changed in this PR. The remaining Game Journey API client was reviewed after the PR_034 entrypoint migration:
3514
+
36-
+- From: `toolbox/game-journey/game-journey.js`
37-
+- To: `assets/toolbox/game-journey/js/index.js`
15+
+- `toolbox/game-journey/game-journey-api-client.js`
3816
+
39-
+The Game Journey API client was retained for PR_035 review.
17+
+The file remains in its approved legacy location because moving it into `assets/toolbox/game-journey/js/` would create a second canonical tool JS file that the current guardrail does not allow.
4018
+
4119
+## Files Reviewed
4220
+
4321
+- `docs_build/dev/ProjectInstructions/README.txt`
4422
+- `docs_build/dev/ProjectInstructions/PROJECT_INSTRUCTIONS.md`
4523
+- `docs_build/dev/reports/PR_26172_CHARLIE_033-game-journey-canonical-js-migration-audit.md`
46-
+- `toolbox/game-journey/index.html`
47-
+- `toolbox/game-journey/game-journey.js`
24+
+- `docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md`
25+
+- `assets/toolbox/game-journey/js/index.js`
4826
+- `toolbox/game-journey/game-journey-api-client.js`
27+
+- `toolbox/game-journey/index.html`
4928
+- `tests/playwright/tools/GameJourneyTool.spec.mjs`
5029
+- `scripts/validate-canonical-repository-structure.mjs`
30+
+- `scripts/validate-browser-env-agnostic.mjs`
5131
+
52-
+## Files Changed
32+
+## Decision
5333
+
54-
+- `assets/toolbox/game-journey/js/index.js`
55-
+- `toolbox/game-journey/index.html`
56-
+- `scripts/validate-canonical-repository-structure.mjs`
57-
+- `tests/playwright/tools/GameJourneyTool.spec.mjs`
58-
+- `docs_build/dev/reports/PR_26172_CHARLIE_034-game-journey-safe-entrypoint-migration.md`
59-
+- `docs_build/dev/reports/codex_review.diff`
60-
+- `docs_build/dev/reports/codex_changed_files.txt`
34+
+Decision: retain `toolbox/game-journey/game-journey-api-client.js` as a temporary legacy exception.
6135
+
62-
+## Migration Notes
36+
+Reason:
6337
+
64-
+- Updated the Game Journey page module script to load `assets/toolbox/game-journey/js/index.js`.
65-
+- Updated the moved module imports to continue using:
66-
+ - `toolbox/game-journey/game-journey-api-client.js`
67-
+ - `toolbox/tool-registry-api-client.js`
68-
+- Removed `toolbox/game-journey/game-journey.js` from the approved legacy JS exception list.
69-
+- Updated the Game Journey source separation test to read the canonical entrypoint path.
38+
+- The current canonical guardrail approves the tool entrypoint path `assets/toolbox/{tool-name}/js/index.js`.
39+
+- It does not approve an additional tool-local API client file under `assets/toolbox/game-journey/js/`.
40+
+- Folding the API client into `index.js` would be a larger refactor and could obscure the completion-metrics API boundary.
41+
+- The API client re-exports completion metrics helpers from `src/api/game-journey-completion-api-client.js`, so it should stay isolated until the shared-client/secondary-file rule is explicit.
7042
+
71-
+## Retained Exception
43+
+Removal plan:
7244
+
73-
+- `toolbox/game-journey/game-journey-api-client.js`
74-
+ - Reason: reviewed separately in PR_035.
75-
+ - Risk: the canonical guardrail currently approves the tool `index.js` entrypoint path but does not approve additional tool JS files under the same folder.
45+
+1. Add or clarify a canonical rule for tool-local secondary modules, or approve a shared API-client location.
46+
+2. Move the API client only after the guardrail recognizes the destination.
47+
+3. Update the canonical Game Journey entrypoint import.
48+
+4. Re-run Game Journey route validation and completion-metrics validation.
49+
+5. Remove `toolbox/game-journey/game-journey-api-client.js` from approved legacy exceptions after validation passes.
7650
+
7751
+## Validation Lane Report
7852
+
79-
+- `node --check assets/toolbox/game-journey/js/index.js`
80-
+ - Result: PASS
81-
+- `git diff --check`
53+
+- `node --check toolbox/game-journey/game-journey-api-client.js`
8254
+ - Result: PASS
8355
+- `npm run validate:canonical-structure`
8456
+ - Result: PASS
8557
+ - Blocking violations: 0
8658
+ - Approved legacy exceptions: 481
87-
+- Active stale reference check for `toolbox/game-journey/game-journey.js`
59+
+- Active reference check
8860
+ - Result: PASS
89-
+ - Only historical `docs_build/pr` references remain.
61+
+ - The canonical entrypoint imports `toolbox/game-journey/game-journey-api-client.js`.
62+
+ - Guardrail and hardening tests still list the retained exception.
63+
+ - Historical `docs_build/pr` references to old `game-journey.js` remain unchanged.
9064
+- Targeted Game Journey Playwright validation:
9165
+ - Command: `npx playwright test tests/playwright/tools/GameJourneyTool.spec.mjs --grep "Game Journey summary table uses inline notes" --workers=1 --reporter=line --timeout=90000`
9266
+ - Result: PASS
9367
+
9468
+## Completion Metrics Note
9569
+
96-
+The targeted Playwright route test uses the existing Postgres completion-metrics stub and passed. The known local legacy SQLite preservation failure documented in PR_26172_CHARLIE_006A did not appear in this validation lane.
70+
+The targeted validation used the existing test Postgres completion-metrics stub and passed. The local legacy SQLite preservation blocker documented in PR_26172_CHARLIE_006A remains a separate recovery/data-preservation concern, not a reason to move the API client in this PR.
9771
+
9872
+## Branch Validation
9973
+
@@ -104,60 +78,19 @@ index 000000000..c03cd09f5
10478
+
10579
+## Requirement Checklist
10680
+
107-
+- Use PR_033 audit: PASS
108-
+- Move only `game-journey.js` to canonical path: PASS
109-
+- Update `toolbox/game-journey/index.html`: PASS
110-
+- Update tests/references for old path: PASS
81+
+- Use PR_033 and PR_034 results: PASS
82+
+- Move API client if safe: PASS, not safe under current guardrail.
83+
+- Retain API client and document temporary legacy exception if not safe: PASS
11184
+- Preserve behavior: PASS
112-
+- Do not move API client unless PR_033 proves safe: PASS, retained.
11385
+- No feature changes: PASS
11486
+- Run targeted Game Journey validation: PASS
11587
+- Run canonical structure guardrail: PASS
116-
+- Document known SQLite preservation blocker separately if encountered: PASS, not encountered.
11788
+- Confirm ZIP exists: PASS after artifact creation.
11889
+
11990
+## Manual Validation Notes
12091
+
121-
+The entrypoint migration is isolated and validated. The retained API client should be resolved in PR_035 without changing completion-metrics behavior.
92+
+The canonical Game Journey entrypoint is already active. Keeping the API client in the existing legacy path avoids introducing an unapproved secondary JS file pattern and avoids changing completion-metrics behavior.
12293
+
12394
+## Recommendation
12495
+
125-
+Continue to PR_035 and keep `toolbox/game-journey/game-journey-api-client.js` as an exception unless a safe guardrail-compliant placement is available.
126-
diff --git a/scripts/validate-canonical-repository-structure.mjs b/scripts/validate-canonical-repository-structure.mjs
127-
index 62ef269c2..ef3cfd8db 100644
128-
--- a/scripts/validate-canonical-repository-structure.mjs
129-
+++ b/scripts/validate-canonical-repository-structure.mjs
130-
@@ -12,7 +12,6 @@ export const APPROVED_LEGACY_JS_PATHS = Object.freeze(new Set([
131-
"toolbox/game-hub/game-hub-api-client.js",
132-
"toolbox/game-hub/game-hub.js",
133-
"toolbox/game-journey/game-journey-api-client.js",
134-
- "toolbox/game-journey/game-journey.js",
135-
"toolbox/messages/message-tts-service-registry.js",
136-
"toolbox/messages/messages-api-client.js",
137-
"toolbox/messages/messages.js",
138-
diff --git a/tests/playwright/tools/GameJourneyTool.spec.mjs b/tests/playwright/tools/GameJourneyTool.spec.mjs
139-
index 390d1cc89..4d8f05378 100644
140-
--- a/tests/playwright/tools/GameJourneyTool.spec.mjs
141-
+++ b/tests/playwright/tools/GameJourneyTool.spec.mjs
142-
@@ -1531,7 +1531,7 @@ test("Toolbox registration exposes Game Journey navigation", async ({ page }) =>
143-
test("Game Journey source stays separate from notes files and browser persistence", async () => {
144-
const sourcePaths = [
145-
"toolbox/game-journey/index.html",
146-
- "toolbox/game-journey/game-journey.js",
147-
+ "assets/toolbox/game-journey/js/index.js",
148-
"src/dev-runtime/persistence/tool-repositories/game-journey-mock-repository.js"
149-
];
150-
const banned = [
151-
diff --git a/toolbox/game-journey/index.html b/toolbox/game-journey/index.html
152-
index aa1a408aa..2965e2b19 100644
153-
--- a/toolbox/game-journey/index.html
154-
+++ b/toolbox/game-journey/index.html
155-
@@ -195,7 +195,7 @@
156-
<div data-partial="footer"></div>
157-
<script src="assets/theme-v2/js/gamefoundry-partials.js"></script>
158-
<script src="assets/theme-v2/js/tool-display-mode.js"></script>
159-
- <script type="module" src="toolbox/game-journey/game-journey.js"></script>
160-
+ <script type="module" src="assets/toolbox/game-journey/js/index.js"></script>
161-
</body>
162-
163-
</html>
96+
+Continue to PR_036 final target-tool compliance reaudit. Treat `toolbox/game-journey/game-journey-api-client.js` as a retained exception with a defined removal plan.

0 commit comments

Comments
 (0)