|
| 1 | +# PR_26166_167-product-data-provider-contract-hardening |
| 2 | + |
| 3 | +## Branch Validation |
| 4 | + |
| 5 | +PASS |
| 6 | + |
| 7 | +- Current branch: `main` |
| 8 | +- Expected branch: `main` |
| 9 | +- Local branches found: `main` |
| 10 | +- `docs_build/dev/PROJECT_INSTRUCTIONS.md` read before PR_167 execution. |
| 11 | + |
| 12 | +## Scope Summary |
| 13 | + |
| 14 | +PASS |
| 15 | + |
| 16 | +- Hardened the browser Toolbox registry client so product metadata must resolve through `/api/toolbox/registry/snapshot`. |
| 17 | +- Removed the silent empty browser-owned registry fallback from `toolbox/tool-registry-api-client.js`. |
| 18 | +- Kept the static missing-image path as display fallback only; it no longer carries product registry data. |
| 19 | +- Added contract coverage for API-backed browser product-data entrypoints. |
| 20 | +- No product table cutover was introduced. |
| 21 | +- No Supabase product tables, UAT resources, PROD resources, `.env.local`, secrets, password tables, or browser-owned auth/provider logic were changed. |
| 22 | + |
| 23 | +## Requirement Checklist |
| 24 | + |
| 25 | +- PASS - Treat PR_167 as one separate BUILD unit. |
| 26 | +- PASS - Main branch only; current branch was `main`. |
| 27 | +- PASS - Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before work. |
| 28 | +- PASS - Harden product-data provider contracts before cutover. |
| 29 | +- PASS - Ensure browser pages use API/service contracts only. |
| 30 | +- PASS - Identify and fix browser-owned product data paths: fixed the Toolbox registry API client's synthesized empty registry fallback. |
| 31 | +- PASS - No product table cutover was introduced. |
| 32 | +- PASS - Product data remains Local DB for this PR. |
| 33 | +- PASS - No silent fallback remains in the Toolbox registry client when the API contract is unavailable. |
| 34 | +- PASS - `npm run validate:supabase-dev` was skipped because PR_167 does not touch Supabase setup or Supabase data. |
| 35 | +- PASS - Targeted provider/API validation ran. |
| 36 | +- PASS - Targeted Playwright validation ran. |
| 37 | +- PASS - `npm run test:workspace-v2` ran because runtime/tool registry behavior changed. The command name is legacy; user-facing language remains Project Workspace. |
| 38 | +- PASS - No Supabase validation data was written, so no Supabase cleanup report is required. |
| 39 | +- PASS - Playwright impacted: yes. |
| 40 | +- PASS - Full samples smoke was not run. |
| 41 | + |
| 42 | +## Product-Data Contract Findings |
| 43 | + |
| 44 | +PASS |
| 45 | + |
| 46 | +- Finding fixed: `toolbox/tool-registry-api-client.js` previously caught registry API failures and synthesized `{ activeTools: [], tools: [] }` in the browser. That made the browser own product metadata fallback state and could hide a broken API contract. |
| 47 | +- Fix: registry reads now fail visibly with the server API diagnostic until `/api/toolbox/registry/snapshot` succeeds. |
| 48 | +- Fix: a failed read is retryable, so transient route timing does not permanently freeze the diagnostic. |
| 49 | +- Preserved behavior: `getToolImageSource()` may still return `/assets/theme-v2/images/image-missing.svg` when a tool lacks an image field; that is a display asset fallback, not a product-data registry fallback. |
| 50 | + |
| 51 | +## Validation Lane Report |
| 52 | + |
| 53 | +Executed lanes: |
| 54 | + |
| 55 | +- contract/runtime: `node --check toolbox/tool-registry-api-client.js` |
| 56 | +- contract/runtime: `node --check tests/dev-runtime/ProductDataProviderContractHardening.test.mjs` |
| 57 | +- contract/runtime: `node --test tests/dev-runtime/ProductDataProviderContractHardening.test.mjs` |
| 58 | +- provider contract regression: `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs` |
| 59 | +- targeted Playwright provider/API: `GAMEFOUNDRY_AUTH_PROVIDER=local-db GAMEFOUNDRY_DB_PROVIDER=local-db npx playwright test tests/playwright/tools/ToolImageRegistry.spec.mjs tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs --project=playwright --workers=1 --reporter=list` |
| 60 | +- Project Workspace legacy lane: `GAMEFOUNDRY_AUTH_PROVIDER=local-db GAMEFOUNDRY_DB_PROVIDER=local-db npm run test:workspace-v2` |
| 61 | + |
| 62 | +Skipped lanes: |
| 63 | + |
| 64 | +- `npm run validate:supabase-dev`: SKIP because this PR does not touch Supabase configuration, Supabase Auth, Supabase DDL, or Supabase data. |
| 65 | +- Full samples smoke: SKIP by request and because samples were not in scope. |
| 66 | +- Admin DB Viewer validation: SKIP because Admin DB Viewer behavior is not changed in PR_167. |
| 67 | +- Product cutover validation: SKIP because no product table cutover occurs until PR_170. |
| 68 | + |
| 69 | +## Validation Results |
| 70 | + |
| 71 | +- PASS - `node --check toolbox/tool-registry-api-client.js` |
| 72 | +- PASS - `node --check tests/dev-runtime/ProductDataProviderContractHardening.test.mjs` |
| 73 | +- PASS - `node --test tests/dev-runtime/ProductDataProviderContractHardening.test.mjs` (3 tests passed) |
| 74 | +- PASS - `node --test tests/dev-runtime/SupabaseProviderContractStub.test.mjs` (29 tests passed) |
| 75 | +- PASS - Targeted Playwright provider/API lane (9 tests passed) |
| 76 | +- PASS - `npm run test:workspace-v2` (5 tests passed) |
| 77 | + |
| 78 | +## Manual Validation Notes |
| 79 | + |
| 80 | +- Captured Admin Tool Votes diagnostics during the first targeted run and confirmed the zero-row page state was caused by an auth-provider selector mismatch, not product metadata rendering. |
| 81 | +- Reran the impacted browser lane with explicit `GAMEFOUNDRY_AUTH_PROVIDER=local-db` and `GAMEFOUNDRY_DB_PROVIDER=local-db`, matching PR_167's pre-cutover Local DB product-data scope. |
| 82 | +- Verified Admin Tool Votes and Toolbox index render from API snapshots and do not request the retired browser registry module. |
| 83 | +- Validation wrote no Supabase records. Playwright-created local DB state used per-run temp SQLite files and was cleaned up when each test server closed. |
| 84 | + |
| 85 | +## Playwright V8 Coverage |
| 86 | + |
| 87 | +- Report: `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 88 | +- Guardrail: `docs_build/dev/reports/coverage_changed_js_guardrail.txt` |
| 89 | +- PR_167 changed runtime JS: `toolbox/tool-registry-api-client.js` |
| 90 | +- Coverage evidence: `(90%) toolbox/tool-registry-api-client.js - executed lines 155/155; executed functions 26/29` |
| 91 | +- Advisory note: because the PR stack is still uncommitted locally, the coverage report also lists changed runtime JS from earlier stacked PRs as warnings. |
| 92 | + |
| 93 | +## Required Artifacts |
| 94 | + |
| 95 | +- `docs_build/dev/reports/PR_26166_167-product-data-provider-contract-hardening_report.md` |
| 96 | +- `docs_build/dev/reports/codex_review.diff` |
| 97 | +- `docs_build/dev/reports/codex_changed_files.txt` |
| 98 | +- `docs_build/dev/reports/playwright_v8_coverage_report.txt` |
| 99 | +- `docs_build/dev/reports/coverage_changed_js_guardrail.txt` |
| 100 | +- `tmp/PR_26166_167-product-data-provider-contract-hardening_delta.zip` |
0 commit comments