Unified search: expose the v2 <SearchResults> surface on the card @context#5239
Unified search: expose the v2 <SearchResults> surface on the card @context#5239habdelra wants to merge 2 commits into
Conversation
…ntext The card @context now carries `searchResultsComponent` — the v2 `<SearchResults>` rendering surface — alongside the existing `prerenderedCardSearchComponent`, which is marked @deprecated. Card authors opt into the v2 surface; first-party card source migrates to it via the @context search codemod, after which the deprecated affordance is removed. The card-facing contract (`SearchResultsComponentSignature` plus its yield and entry view-model) lives in runtime-common so `CardContext` can type the member without importing host code; `HydrationMode` and `SearchEntryRendering` move there too and are re-exported from their host locations. The three root @context providers expose the host `<SearchResults>` through the new member; the operator-mode providers inherit it via their context spread. The cards-facing `Store` interface stays instances-only (no `searchEntries`), already codified at the type level. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c22c5f2a14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR advances the unified-search project by exposing the v2 <SearchResults> rendering surface on the card @context (additive/opt-in), and by moving the card-facing type contract for that surface into runtime-common so cards can type it without importing host code.
Changes:
- Add
CardContext.searchResultsComponent(v2<SearchResults>surface) and markprerenderedCardSearchComponentas deprecated in the card API. - Introduce
runtime-commontype contracts for the v2 surface (SearchResultsComponentSignature, yield shape, entry/rendering view-models,HydrationMode), and re-export from existing host locations to avoid import churn. - Wire the new
searchResultsComponentinto the main host@contextproviders and add an integration test covering the converged context shape and hydration behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/search-results-component.ts | Adds the card-facing v2 <SearchResults> component signature + related types (HydrationMode, rendering/entry/yield shapes). |
| packages/runtime-common/index.ts | Exports the new v2 search surface types from the runtime-common barrel. |
| packages/base/card-api.gts | Extends CardContext with searchResultsComponent and deprecates prerenderedCardSearchComponent. |
| packages/host/app/components/card-search/search-results.gts | Adopts the runtime-common v2 signature types so the host component is assignable to @context.searchResultsComponent. |
| packages/host/app/components/card-search/hydratable-card.gts | Moves HydrationMode to runtime-common and re-exports it from the historical host import location. |
| packages/host/app/resources/search-entries.ts | Moves SearchEntryRendering to runtime-common and re-exports it from the historical host import location. |
| packages/host/app/templates/render/html.gts | Provides searchResultsComponent on the render-route card context. |
| packages/host/app/templates/index.gts | Provides searchResultsComponent on the index-route card context. |
| packages/host/app/components/operator-mode/container.gts | Provides searchResultsComponent on the operator-mode card context. |
| packages/host/tests/integration/components/card-context-search-results-test.gts | Adds an integration test asserting v2 surface presence and hydration behavior via @context.searchResultsComponent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lukemelia
left a comment
There was a problem hiding this comment.
Test coverage seems light. For example, does the polymorphic live/html component rendering have test coverage?
@lukemelia This PR specifically was introducing |
…ntext-search-api-to-v2 Integrates the v2 error / last-known-good rendering that landed on main: HydrationMode stays sourced from runtime-common (re-exported from hydratable-card), ErrorEntry is imported from its error.ts home, and the SearchResultError error-component path coexists with the @context surface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Exposes the v2
<SearchResults>rendering surface on the card@context, the next step of the unified-search project. Additive and opt-in — it sits alongside the existingprerenderedCardSearchComponent; no consumer is migrated here. Stacked on #5237.What it does
CardContextgains asearchResultsComponentmember — the v2<SearchResults>component — andprerenderedCardSearchComponentis marked@deprecated. A card author opts into the v2 surface by rendering<@context.searchResultsComponent @query=… />(asearch-entry-rooted query, with an optional hydration@mode); the deprecated component keeps working unchanged until first-party card source moves over via the@contextsearch codemod, after which it's removed.The instances surface (
getCard/getCards/getCardCollection/@context.store.search → CardDef[]) is unchanged, and the cards-facingStoreinterface stays instances-only (nosearchEntries), already codified at the type level.How it's wired
SearchResultsComponentSignature, its yieldedresultsshape, and the entry view-model — lives inruntime-commonsoCardContexttypes the member without importing host code (mirroringPrerenderedCardComponentSignature).HydrationModeandSearchEntryRenderingmove toruntime-commonfor the same reason, re-exported from their previous host locations so existing import sites are untouched.<SearchResults>adopts that contract as its own signature, so it's assignable wherever the@contextmember is provided.@contextproviders (host route, render route, operator-mode container) expose it; the operator-mode providers that augment the context inherit it through their existing spread.Tests
card-context-search-results-test.gts: a card renders the heterogeneoussearch-entrystream through@context.searchResultsComponent(prerendered HTML inert, hydrating live on hover); the converged@contextexposes the v2 + deprecated rendering surfaces and the instances surface at once; compile-time witnesses pin theCardContextshape.search-resultssuite stays green after the component's signature swap.