feat(app): expose diagnostics global [Story-806]

Story 806Epic 80215 files · +629/−27

PR #174 · pramaan-io/pramaan-app · merged 2026-05-23

How it flows

sequenceDiagram
  autonumber
  participant browser as Browser
  participant diag as Diagnostics module
  participant kubb as Kubb client
  participant route as Internal route
  participant upstream as Upstream gateway
  browser->>diag: page load fires module
  diag->>browser: window.pramaan + console line
  browser->>kubb: generated API call
  kubb->>route: merge x-pramaan-* headers
  route-->>upstream: forward identity to gateway

What changed, file by file

The main gateway client now accepts an options field of type GatewayOptions, so upstream identity context can be threaded through gateway calls and the x-pramaan-* headers can be forwarded end-to-end.

New fields: options : GatewayOptions

Failure cases the change sidesteps

Plain build still fails closed by design.
No UI layout or design primitive touched.
Local run had Clerk dev warnings — unrelated.
Diagnostics is read-only; no mutation path.

Files changed (15)

File±
docs/visual-verification/story-806/diagnostics-console-and-object.png+0
docs/walkthroughs/story-806-walkthrough.html+141
src/app/api/internal/matter-types/route.ts ★+18 −1
src/lib/gateway.ts+17 −4
src/lib/kubb-client.ts+13
src/lib/logger-browser.ts+2 −13
src/lib/matter-types/gateway.ts ★+21 −1
src/lib/pramaan-diagnostics.ts ★+155
tests/unit/correlation-banner.test.tsx+10 −4
tests/unit/lib/gateway.test.ts+20
tests/unit/lib/kubb-client.test.ts+55
tests/unit/lib/pramaan-diagnostics.test.ts+113
tests/unit/matter-types-contract.test.ts+20 −1
tests/unit/matter-types-internal-route.test.ts+40
tests/unit/static/no-direct-console.test.ts+4 −3