feat!: replace isPreview with top-level debug mode [AIS-243] - #98
Open
Chase Poirier (chasepoirier) wants to merge 1 commit into
Open
feat!: replace isPreview with top-level debug mode [AIS-243]#98Chase Poirier (chasepoirier) wants to merge 1 commit into
Chase Poirier (chasepoirier) wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reshapes the render-context API around a single
debugswitch and flattensmetadata+debugto top-level args on bothfetchExperience/resolveExperienceand the renderers. Implements AIS-243.debug: trueis 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 oldisPreviewrender flag. Preview host/token switching stays an independent fetch concern.Changes
ExperienceContext.isPreview→debug. New sharedcreateDebugLogger([experiences:debug]prefix, lazy payloads, timed spans).resolveExperiencelogs the raw payload, node counts, and per-noderesolveDatafan-out timings.fetchExperience's third arg is now{ config, metadata?, debug? }(was nestedcontext); logs the fetch (host, ids) and raw payload.metadata+debugprops (wascontext).MissingComponentgates ondebugwith a richer box naming the unregisteredcomponentTypeId. 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.debugfrom?debug=true, independent of?preview=true.<DebugExperience>/renderUnknownsections;AGENTS.mdrecords the deferreduseExperience()hook-split investigation.Testing
nx run-many -t build test typecheckgreen 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
isPreviewis removed from the render context and the nestedcontextoption is gone. Passmetadataanddebugas top-level options onfetchExperience/resolveExperienceand as props on the renderers. (Alpha 0.x — intentional hard break.)🤖 Generated with Claude Code