Unified search: FileDef parity in the host consumer (identity-only file-meta rows)#5180
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84011d1993
ℹ️ 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".
Preview deploymentsHost Test Results 1 files ±0 1 suites ±0 1h 53m 2s ⏱️ - 2m 9s Results for commit f6bbbb5. ± Comparison against earlier commit a45e8ee. Realm Server Test Results 1 files ±0 1 suites ±0 9m 56s ⏱️ -18s Results for commit f6bbbb5. ± Comparison against earlier commit a45e8ee. |
There was a problem hiding this comment.
Pull request overview
This PR extends the unified-search “prefer HTML” pipeline to support file-meta rows at parity with card rows (identity-only + rendered-html + deduped css), and updates the host-side unified consumer to distinguish cards vs files for hydration. It also includes substantial operational/diagnostic changes in the realm-server (HTTP/2 listener behavior in env mode and prerender CPU profiling) plus an unpublish-realm host command and related test/config updates.
Changes:
- Add shared unified-search resource builders (
rendered-html, identity-onlycard/file-meta,css) and server-side unified search mapping for cards + files. - Update federated search merging/caching/request parsing and adjust host unified consumer/tests for file-meta hydration typing.
- Introduce realm-server HTTP/2 env-mode invariants, CPU-profiling diagnostics on prerender timeout/affinity, and add an
unpublish-realmcommand + tests/config.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/unified-search.ts | New pure builders/helpers for unified-search resources (rendered-html/css/identity-only). |
| packages/runtime-common/search-utils.ts | Unified federated merge + search fan-out refactor; SearchOpts extended for render/dataOnly. |
| packages/runtime-common/resource-types.ts | Extends card meta typing + re-exports identity-only file-meta predicate. |
| packages/runtime-common/realm.ts | Routes Realm.search() to unified prefer-HTML path when opts.render is present. |
| packages/runtime-common/realm-index-query-engine.ts | Implements searchUnified + searchUnifiedFileMeta result mapping and includes/css/link expansion. |
| packages/runtime-common/index.ts | Exports unified-search builders. |
| packages/runtime-common/index-query-engine.ts | Adds types column to render projection to recover actual adoptsFrom for HTML-backed rows. |
| packages/runtime-common/card-document-shape.ts | Adds isIdentityOnlyFileMetaResource. |
| packages/realm-server/handlers/handle-search.ts | Parses unified request body; resolves renderSpec; unifies job-scoped cache logic via helper. |
| packages/realm-server/handlers/handle-search-prerendered.ts | Reuses shared job-scoped cache helper. |
| packages/realm-server/tests/unified-search-contracts-test.ts | Adds unit coverage for builders/predicates and included dedupe behavior. |
| packages/realm-server/tests/server-endpoints/search-test.ts | Adds endpoint coverage for prefer-HTML file-meta parity + cache-key behaviors. |
| packages/host/app/lib/unified-search-results.ts | Host unified consumer now threads row type (card vs file-meta) and file renderType suppression. |
| packages/host/tests/unit/unified-search-results-test.ts | Adds file-meta identity-only/full-live cases; cards assert type: 'card'. |
| packages/host/app/services/realm.ts | Changes unpublish to rethrow after logging so callers can surface failures. |
| packages/host/app/components/operator-mode/host-submode.gts | Uses new UnpublishRealmCommand for UI unpublish path. |
| packages/host/app/commands/unpublish-realm.ts | New host command wrapper around RealmService.unpublish + published URL resolution. |
| packages/host/app/commands/index.ts | Registers/shims the new unpublish command. |
| packages/host/tests/integration/commands/unpublish-realm-test.gts | Adds integration coverage for UnpublishRealmCommand behavior. |
| packages/host/tests/helpers/realm-server-mock/routes.ts | Updates mock realm search typing to unified document. |
| packages/realm-server/server.ts | Changes env-mode listener to serve HTTP/2 over TLS (no downgrade) + adds helper for secure h2 construction. |
| packages/realm-server/tests/listener-dispatcher-test.ts | Updates listener tests for env-mode h2 + fail-loud cert handling; adds env isolation helper. |
| packages/realm-server/prerender/cpu-profiler.ts | New CDP sampling profiler utility + affinity gating helpers. |
| packages/realm-server/prerender/utils.ts | Integrates timeout-path CPU sampling + optional affinity-scoped profiling into withTimeout. |
| packages/realm-server/prerender/render-runner.ts | Threads profiling context into withTimeout across render steps. |
| packages/realm-server/tests/cpu-profiler-affinity-gate-test.ts | Adds unit tests for affinity gate + env parsing. |
| packages/realm-server/tests/index.ts | Registers new CPU profiler test module. |
| packages/realm-server/main.ts | Registers realm-server as an HTTP/2 backend in env-mode service registry. |
| packages/realm-server/lib/dev-service-registry.ts | Adds http2 option; configures Traefik upstream scheme + serversTransport for h2 backends. |
| mise-tasks/lib/env-vars.sh | Updates env-mode TLS var behavior: realm-server now needs dev certs for h2/TLS backend. |
| packages/host/memory-baseline.json | Updates memory baselines (test artifact). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
buildRenderableSearchItems now treats an HTML-backed file row the same way as a card: it recognizes an identity-only file-meta resource, builds the inert component from its rendered-html, imports the scoped css, and marks the row file-meta. Each renderable item carries its resource type so the consumer hydrates a file row to a live FileDef; a file row carries no render type, since files render natively rather than as an ancestor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84011d1 to
a45e8ee
Compare
…ch-filedef-parity-host-consume-identity-only # Conflicts: # packages/host/app/lib/unified-search-results.ts
Extends the unified-search host consumer with FileDef parity: an HTML-backed file search result renders from prerendered HTML and hydrates to a live
FileDef, the same treatment a card already gets.buildRenderableSearchItems(packages/host/app/lib/unified-search-results.ts):file-metarow (isIdentityOnlyFileMetaResource) alongside the card case, builds the inert component from itsrendered-html, and imports its scopedcss. File rows previously fell through to the full-live branch.card/file-meta) on the renderable item, threaded toHydratableCard @typeso a file row resolves to a liveFileDefrather than aCardDef.file-metarow carries no render type — files render natively, not as an ancestor type — even when the collection resolves one for its cards.Additive: card rows are unchanged, and file rows keep rendering through the existing prerendered path until the UI migration adopts the unified consumer.
The selective Store inflate already keys on
meta.identityOnly(type-agnostic), so an identity-only file row is never deposited as an attribute-less stub.Tests:
buildRenderableSearchItemsover an identity-only file-meta row (inert component,type: 'file-meta', css imported, no render type) and over a full-live file-meta row; card rows now asserttype: 'card'. (HydratableCardfile-meta hover-hydration to a liveFileDefis covered by the hydration PR.)Stacking. This sits on top of two open PRs:
isIdentityOnlyFileMetaResource. Its commits appear in this diff until it lands onmain; once both land I'll retarget this PR's base tomainfor a clean diff.Linear: CS-11471