Skip to content

Refactor PrerenderedCardSearch to use live search during render/indexing context#4102

Open
habdelra wants to merge 6 commits intomainfrom
cs-10220-at-index-time-make-prerenderedcardsearch-use-real-_search
Open

Refactor PrerenderedCardSearch to use live search during render/indexing context#4102
habdelra wants to merge 6 commits intomainfrom
cs-10220-at-index-time-make-prerenderedcardsearch-use-real-_search

Conversation

@habdelra
Copy link
Contributor

@habdelra habdelra commented Mar 2, 2026

Summary

  • Refactors PrerenderedCardSearch to use live search during render/indexing context, while preserving existing prerendered-search behavior elsewhere.
  • Preserves host test semantics by only enabling this fallback when globalThis.__boxelRenderContext is true and isTesting() is false (since host test use the same js runtime for both indexing and tests--its more straight forward that this behavior is suppressed during host tests).
  • Keeps the PrerenderedCardSearch yielded API compatible by adapting live CardDef | FileDef results into PrerenderedCard instances.

What Changed

  • Added a new resource: packages/host/app/resources/live-prerendered-search.ts
  • Updated packages/host/app/components/prerendered-card-search.gts:
    • Chooses getSearch() + live adapter in render context.
    • Falls back to getPrerenderedSearch() outside that context.
  • Updated packages/host/app/templates/render/html.gts:
    • Provides full CardContext (including prerenderedCardSearchComponent) in /render route so nested dynamic-card usage works.
  • Added realm-server prerender coverage in packages/realm-server/tests/prerendering-test.ts:
    • CardDef case proves live-rendered HTML is used instead of stale indexed isolated_html.
    • FileDef/file-meta parity case verifies same live fallback behavior.
    • CSS assertion verifies scoped-css marker behavior for live-rendered search results.

Copy link

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

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: 6fb9e785f0

ℹ️ 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".

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Preview deployments

Copy link
Contributor

Copilot AI left a comment

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 refactors PrerenderedCardSearch to use live search (live rendering) during render/indexing context (when globalThis.__boxelRenderContext is set) instead of fetching stale pre-indexed HTML. Outside of that context, the existing prerendered-search behavior is preserved. The live path adapts CardDef | FileDef instances into PrerenderedCard objects by rendering them on the fly.

Changes:

  • Added LivePrerenderedSearchResource for rendering card/file search instances live inside the prerender context
  • Updated PrerenderedCardSearch to choose between live and prerendered search based on __boxelRenderContext flag
  • Updated the /render route template (html.gts) to provide a full CardContext (including prerenderedCardSearchComponent) for nested card rendering
  • Added prerender coverage tests for the live-search fallback behavior
  • Minor operational changes: PRERENDER_REALM_TAB_MAX default 1→4, startup timeout 2000000→2400000ms

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/host/app/resources/live-prerendered-search.ts New resource that renders CardDef/FileDef instances live and wraps them in PrerenderedCard objects
packages/host/app/components/prerendered-card-search.gts Adds conditional search path selection; live path for render context, prerendered path otherwise
packages/host/app/templates/render/html.gts Refactored from template-only to full Glimmer component providing complete CardContext
packages/realm-server/tests/prerendering-test.ts New test module verifying live CardDef and FileDef HTML is used instead of stale indexed HTML
packages/realm-server/prerender/page-pool.ts Default PRERENDER_REALM_TAB_MAX changed from 1 to 4
packages/realm-server/scripts/start-all.sh Wait timeout increased from 2000000 to 2400000ms

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

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   1h 58m 54s ⏱️ + 6m 56s
1 919 tests ±0  1 904 ✅ +1  15 💤 ±0  0 ❌ ±0 
1 934 runs  ±0  1 919 ✅ +2  15 💤 ±0  0 ❌  - 1 

Results for commit e75b83b. ± Comparison against base commit 11665e3.

♻️ This comment has been updated with latest results.

@habdelra habdelra requested a review from a team March 3, 2026 00:16
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.

2 participants