Skip to content

Unified search: expose the v2 <SearchResults> surface on the card @context#5239

Open
habdelra wants to merge 2 commits into
mainfrom
cs-11438-unified-search-converge-the-card-context-search-api-to-v2
Open

Unified search: expose the v2 <SearchResults> surface on the card @context#5239
habdelra wants to merge 2 commits into
mainfrom
cs-11438-unified-search-converge-the-card-context-search-api-to-v2

Conversation

@habdelra

Copy link
Copy Markdown
Contributor

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 existing prerenderedCardSearchComponent; no consumer is migrated here. Stacked on #5237.

What it does

CardContext gains a searchResultsComponent member — the v2 <SearchResults> component — and prerenderedCardSearchComponent is marked @deprecated. A card author opts into the v2 surface by rendering <@context.searchResultsComponent @query=… /> (a search-entry-rooted query, with an optional hydration @mode); the deprecated component keeps working unchanged until first-party card source moves over via the @context search codemod, after which it's removed.

The instances surface (getCard / getCards / getCardCollection / @context.store.search → CardDef[]) is unchanged, and the cards-facing Store interface stays instances-only (no searchEntries), already codified at the type level.

How it's wired

  • The card-facing contract — SearchResultsComponentSignature, its yielded results shape, and the entry view-model — lives in runtime-common so CardContext types the member without importing host code (mirroring PrerenderedCardComponentSignature).
  • HydrationMode and SearchEntryRendering move to runtime-common for the same reason, re-exported from their previous host locations so existing import sites are untouched.
  • The host <SearchResults> adopts that contract as its own signature, so it's assignable wherever the @context member is provided.
  • The three root @context providers (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 heterogeneous search-entry stream through @context.searchResultsComponent (prerendered HTML inert, hydrating live on hover); the converged @context exposes the v2 + deprecated rendering surfaces and the instances surface at once; compile-time witnesses pin the CardContext shape.
  • The existing search-results suite stays green after the component's signature swap.

…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>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   1h 52m 28s ⏱️
3 075 tests 3 060 ✅ 15 💤 0 ❌
3 094 runs  3 079 ✅ 15 💤 0 ❌

Results for commit c22c5f2.

Realm Server Test Results

    1 files      1 suites   10m 55s ⏱️
1 715 tests 1 715 ✅ 0 💤 0 ❌
1 808 runs  1 808 ✅ 0 💤 0 ❌

Results for commit c22c5f2.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/host/app/templates/render/html.gts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mark prerenderedCardSearchComponent as deprecated in the card API.
  • Introduce runtime-common type 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 searchResultsComponent into the main host @context providers 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.

@habdelra habdelra requested a review from a team June 15, 2026 21:44

@lukemelia lukemelia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage seems light. For example, does the polymorphic live/html component rendering have test coverage?

@habdelra

habdelra commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Test coverage seems light. For example, does the polymorphic live/html component rendering have test coverage?

@lukemelia This PR specifically was introducing searchResultsComponent on the @context. but this component was introduced in a different PR that was approved earlier today :-) #5237. Additionaly the hydration which is a nested component in that component is tested in this PR #5177

@habdelra habdelra changed the base branch from cs-11437-unified-search-searchresults-component-host-consumer-v2 to main June 16, 2026 15:24
…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>
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.

3 participants