|
| 1 | +# PR_26169_029 DB Viewer Table Groups Regression Report |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +Restored Admin DB Viewer rendering for configured product data snapshots. The viewer now receives schema-backed table arrays and viewer groups even when individual configured database tables are missing, and it displays those missing-table issues as visible source diagnostics instead of falling into the generic Configured Data load-error state. |
| 6 | + |
| 7 | +## Root Cause |
| 8 | + |
| 9 | +The DB Viewer page, route, script imports, and Admin navigation route were intact. PR_26169_023 and PR_26169_027/028 did not replace the DB Viewer route or point navigation at the wrong page. |
| 10 | + |
| 11 | +The regression was caused by the configured DB snapshot path. `admin/db-viewer.js` correctly loaded `src/api/db-viewer-ui.js`, but `/api/product-data/snapshot` called the shared Supabase/Postgres adapter snapshot. That adapter used an all-or-nothing table read, so one missing configured table, observed locally as `membership_limits`, rejected the entire snapshot. The UI then rendered its load-error path, which left the page as the generic Configured Data shell with no filters, table groups, table list, schemas, or relationship diagnostics. |
| 12 | + |
| 13 | +## Changes |
| 14 | + |
| 15 | +- Updated `SupabasePostgresProviderAdapter.getDbViewerSnapshot()` to keep DB Viewer reads schema-aware when a configured table is missing. |
| 16 | +- Added table-level `DB_VIEWER_TABLE_UNAVAILABLE` diagnostics for recoverable per-table read failures. |
| 17 | +- Preserved fatal behavior for missing/unreachable configured DB sources such as missing server config, connection failure, authentication failure, or timeout. |
| 18 | +- Passed configured DB table diagnostics through `/api/product-data/snapshot`. |
| 19 | +- Updated DB Viewer UI provider display to honor server-provided `supabase-postgres` provider metadata. |
| 20 | +- Rendered configured-source diagnostics in the DB Inspector diagnostics panel while keeping existing audit, bleed, stale-display, and relationship checks. |
| 21 | +- Added targeted Node and Playwright coverage for configured DB Viewer snapshots, missing-table diagnostics, empty schema-known sources, and snapshot-load failure diagnostics. |
| 22 | + |
| 23 | +## Requirement Checklist |
| 24 | + |
| 25 | +| Requirement | Status | Notes | |
| 26 | +| --- | --- | --- | |
| 27 | +| Restore DB Viewer initialization | PASS | Existing route/script load path remained intact; snapshot failure no longer collapses initialization. | |
| 28 | +| Restore table group rendering | PASS | `/api/product-data/snapshot` now returns `viewerGroups` even with missing configured tables. | |
| 29 | +| Restore configured table listing | PASS | Snapshot maps all shared schema tables to arrays, using empty arrays for unavailable tables. | |
| 30 | +| Restore schemas/relationships/diagnostics | PASS | Schema headers remain visible; relationship and existing diagnostics still render. | |
| 31 | +| Keep DB Viewer under Admin | PASS | No navigation or route move was made. | |
| 32 | +| Do not move DB Viewer to Owner | PASS | Owner navigation untouched. | |
| 33 | +| Do not create generic configured-data placeholder | PASS | Provider-aware UI shows `Supabase Postgres` and table groups. | |
| 34 | +| Do not hardcode table lists page-locally | PASS | Runtime table list still comes from shared schemas and adapter snapshot; test fixtures only provide deterministic payloads. | |
| 35 | +| Read from shared DB adapter/source of truth | PASS | Fix is in `SupabasePostgresProviderAdapter` and `/api/product-data/snapshot`. | |
| 36 | +| Missing DB adapter/source visible diagnostic | PASS | Fatal source failures still render visible configured-source load diagnostics. | |
| 37 | +| Empty DB source shows meaningful schema state | PASS | Empty arrays render table headers and empty-state text. | |
| 38 | +| Preserve Admin/Owner navigation SSoT | PASS | Navigation files were not changed. | |
| 39 | +| Avoid unrelated domains | PASS | Memberships, marketplace, AI credits, legal, notes, storage, and Admin/Owner menus were not changed. | |
| 40 | + |
| 41 | +## Validation |
| 42 | + |
| 43 | +- PASS: `git branch --show-current` -> `main` |
| 44 | +- PASS: `node --check src/dev-runtime/auth/provider-contract-stubs.mjs` |
| 45 | +- PASS: `node --check src/dev-runtime/server/local-api-router.mjs` |
| 46 | +- PASS: `node --check src/api/db-viewer-ui.js` |
| 47 | +- PASS: `node --check tests/dev-runtime/DbViewerConfiguredSnapshot.test.mjs` |
| 48 | +- PASS: `node --check tests/playwright/tools/AdminDbViewer.spec.mjs` |
| 49 | +- PASS: `node --test tests/dev-runtime/DbViewerConfiguredSnapshot.test.mjs` |
| 50 | +- PASS: live route probe: `/api/product-data/snapshot` returned 30 viewer groups and 48 schema-backed tables, with table diagnostics instead of a 500. |
| 51 | +- PASS: `npx playwright test tests/playwright/tools/AdminDbViewer.spec.mjs --grep "(Admin DB Viewer restores configured table groups|Admin DB Viewer renders schema headers|Admin DB Viewer shows a visible configured source diagnostic)" --workers=1` (3 passed) |
| 52 | +- PASS: `git diff --check` |
| 53 | + |
| 54 | +## Notes |
| 55 | + |
| 56 | +- A broad name-pattern run against `tests/dev-runtime/SupabaseProviderContractStub.test.mjs` timed out and left Node test workers; those validation-only processes were stopped. The final validation uses the dedicated focused Node test instead. |
| 57 | +- The existing local API server on port 5501 was observed and left running. |
| 58 | +- Playwright V8 coverage was refreshed. Server-side runtime files report advisory WARN coverage only, as expected for browser V8 coverage; `src/api/db-viewer-ui.js` is covered by the focused Playwright run. |
0 commit comments