Skip to content

feat!: replace isPreview with top-level debug mode [AIS-243] - #98

Open
Chase Poirier (chasepoirier) wants to merge 1 commit into
mainfrom
feat/ais-243-debug-mode
Open

feat!: replace isPreview with top-level debug mode [AIS-243]#98
Chase Poirier (chasepoirier) wants to merge 1 commit into
mainfrom
feat/ais-243-debug-mode

Conversation

@chasepoirier

@chasepoirier Chase Poirier (chasepoirier) commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What

Reshapes the render-context API around a single debug switch and flattens metadata + debug to top-level args on both fetchExperience/resolveExperience and the renderers. Implements AIS-243.

debug: true is the single observability switch: it emits verbose logs across fetch + resolve, renders the visible missing-component box, and auto-mounts a JSON-dump panel. It replaces the old isPreview render flag. Preview host/token switching stays an independent fetch concern.

Changes

  • coreExperienceContext.isPreviewdebug. New shared createDebugLogger ([experiences:debug] prefix, lazy payloads, timed spans). resolveExperience logs the raw payload, node counts, and per-node resolveData fan-out timings.
  • clientfetchExperience's third arg is now { config, metadata?, debug? } (was nested context); logs the fetch (host, ids) and raw payload.
  • adapter-react / adapter-svelte — renderers take top-level metadata + debug props (was context). MissingComponent gates on debug with a richer box naming the unregistered componentTypeId. New first-party <DebugExperience> dumps the resolved plan as circular-safe JSON in a collapsible <details> — auto-mounts when debug is on, or mount manually.
  • examples + test-apps — drive debug from ?debug=true, independent of ?preview=true.
  • docs — README render-context field table + debug-mode / <DebugExperience> / renderUnknown sections; AGENTS.md records the deferred useExperience() hook-split investigation.

Testing

nx run-many -t build test typecheck green across all 5 projects. New tests: core debug-logging (silent-off / logs-on), adapter auto-mount + metadata-threading + missing-component gating, and dedicated <DebugExperience> suites (both adapters — summary/pluralization, template label, defaultOpen, circular-reference guard). Prettier clean.

Breaking change

isPreview is removed from the render context and the nested context option is gone. Pass metadata and debug as top-level options on fetchExperience/resolveExperience and as props on the renderers. (Alpha 0.x — intentional hard break.)

🤖 Generated with Claude Code

Reshape the render-context API around a single `debug` switch and flatten
`metadata` + `debug` to top-level args on both fetch and render.

- core: `ExperienceContext.isPreview` → `debug`; add a shared `createDebugLogger`
  (`[experiences:debug]` prefix, lazy payloads, timed spans). `resolveExperience`
  logs the raw payload, node counts, and per-node `resolveData` fan-out timings.
- client: `fetchExperience`'s third arg is now `{ config, metadata?, debug? }`
  (was nested `context`); logs the fetch, host/ids, and raw payload. Preview
  host/token switching stays a separate fetch concern.
- adapters (react + svelte): renderers take top-level `metadata` + `debug`
  (was `context`). `MissingComponent` gates on `debug` with a richer box naming
  the unregistered componentTypeId. New first-party `<DebugExperience>` dumps the
  resolved plan as circular-safe JSON in a collapsible <details>; auto-mounts
  when debug is on, or mount manually.
- examples + test-apps: drive `debug` from `?debug=true`, independent of preview.
- docs: README render-context field table, debug-mode + `<DebugExperience>` +
  `renderUnknown` sections; AGENTS.md records the deferred useExperience hook-split
  investigation.

BREAKING CHANGE: `isPreview` is removed from the render context and the nested
`context` option is gone. Pass `metadata` and `debug` as top-level options on
`fetchExperience`/`resolveExperience` and as props on the renderers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chasepoirier
Chase Poirier (chasepoirier) requested a review from a team as a code owner July 29, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant