Skip to content

Unified search: render-store readiness for getSearchEntriesResource#5242

Open
habdelra wants to merge 2 commits into
cs-11438-unified-search-converge-the-card-context-search-api-to-v2from
cs-11569-unified-search-render-store-readiness-for
Open

Unified search: render-store readiness for getSearchEntriesResource#5242
habdelra wants to merge 2 commits into
cs-11438-unified-search-converge-the-card-context-search-api-to-v2from
cs-11569-unified-search-render-store-readiness-for

Conversation

@habdelra

Copy link
Copy Markdown
Contributor

Part of Unify prerendered-card-search and card-search. Stacked on #5239 (retarget base to main once that lands).

A card that renders @context.searchResultsComponent in a prerenderable template drives getSearchEntriesResource through the render route. The render route's settle loop (routes/render.ts #waitForRenderLoadStability) only awaits the render store's loaded() / loadGeneration — but SearchEntriesResource tracked its in-flight v2 search solely via an @ember/test-waiter, which that loop never observes. The html-only result branch deposits nothing into the store, so nothing moved the load generation either, and a prerender of such a card could capture its HTML before the search resolved: an empty result list that only fills in later, in the live SPA.

The resource now resolves the render store while prerendering (gated on __boxelRenderContext, the same signal prerendered-card-search uses) and routes its v2 search fetch and a store.trackLoad() of every search through it. trackLoad bumps the load generation the moment a search starts and keeps the load pending until it resolves, so the settle loop waits for results before HTML capture — mirroring how the v1 SearchResource already wires render-context searches. Outside a prerender, runtimeStore is the injected live store and behavior is unchanged.

Tests

  • Integration (search-entries-test.gts) — the deterministic contract: under __boxelRenderContext, performing the search registers exactly one load on the render store, that load is the in-flight search, and the render store's loadGeneration advances. (An acceptance-level capture can't isolate this — the resource's test-waiter makes await visit wait for the search regardless of the readiness wiring; the real puppeteer prerenderer has no such settle gate.) Verified red without the trackLoad call, green with it.
  • Acceptance (prerender-search-results-test.gts) — end-to-end: a card renders the v2 surface in its isolated template and prerenders with both results' prerendered HTML present, not an empty list.

This is a prerequisite for the codemod (CS-11439) migrating cards that render search in a fitted / embedded template, and for the Phase 2 query/collection-field prerendered-HTML work.

A card rendering @context.searchResultsComponent in a prerenderable
template drives getSearchEntriesResource through the render route. The
render route's settle loop (#waitForRenderLoadStability) only awaits the
render store's loaded() / loadGeneration, but the resource tracked its
in-flight v2 search solely via an @ember/test-waiter — invisible to that
loop. The html-only branch deposits nothing into the store, so nothing
moved the load generation either, and the prerender could capture HTML
before the search resolved: an empty result list.

The resource now resolves the render store while prerendering (gated on
__boxelRenderContext, like prerendered-card-search) and routes its v2
search fetch and a store.trackLoad() of every search through it. trackLoad
bumps the load generation the moment a search starts and keeps the load
pending until it resolves, so the settle loop waits for results before
HTML capture — mirroring the v1 SearchResource. Outside a prerender this
is the injected live store, unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread packages/host/tests/acceptance/prerender-search-results-test.gts Outdated
Comment thread packages/host/tests/integration/resources/search-entries-test.gts

@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: a0f603619a

ℹ️ 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/resources/search-entries.ts Outdated

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

Ensures v2 SearchEntriesResource participates in prerender readiness by routing its fetch + load tracking through the render store when running under __boxelRenderContext, so the render route’s settle loop waits for search results before HTML capture.

Changes:

  • Update SearchEntriesResource to (a) use the render store during prerender and (b) trackLoad() each in-flight search to advance loadGeneration.
  • Add an integration test asserting render-store load tracking + generation bump under prerender context.
  • Add an acceptance prerender test covering the v2 @context.searchResultsComponent surface in an isolated template with results present in captured HTML.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/host/app/resources/search-entries.ts Use render-store + trackLoad() during prerender so render-route readiness observes v2 searches.
packages/host/tests/integration/resources/search-entries-test.gts Add deterministic integration coverage for render-store readiness wiring.
packages/host/tests/acceptance/prerender-search-results-test.gts Add end-to-end prerender capture test ensuring results are present in HTML.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/host/tests/integration/resources/search-entries-test.gts
@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 38s ⏱️
3 076 tests 3 061 ✅ 15 💤 0 ❌
3 095 runs  3 080 ✅ 15 💤 0 ❌

Results for commit f56b11c.

Realm Server Test Results

    1 files      1 suites   10m 20s ⏱️
1 716 tests 1 716 ✅ 0 💤 0 ❌
1 809 runs  1 809 ✅ 0 💤 0 ❌

Results for commit f56b11c.

The end-to-end "/render waits for the v2 search before HTML capture"
behavior belongs in the realm-server prerendering suite, which drives the
real prerenderer — host tests run through card-prerender and never exercise
the /render route. Replace the host acceptance test with a v2 prerendering
test alongside the existing live-search-fallback cases: a card renders
@context.searchResultsComponent in its isolated template and prerenders with
its result present, not an empty list.

Keep the host integration test — it's orthogonal to the route, driving the
resource directly with the prerender signal set by hand to assert it
registers its search with the render store's readiness mechanism.

Gate the render-store switch on `__boxelRenderContext === true` to match the
prerender header / job-priority helpers, so store selection and header
emission agree.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@habdelra habdelra requested a review from a team June 15, 2026 23:27
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