Skip to content

Unified search: FileDef parity in the host consumer (identity-only file-meta rows)#5180

Merged
habdelra merged 2 commits into
mainfrom
cs-11471-unified-search-filedef-parity-host-consume-identity-only
Jun 10, 2026
Merged

Unified search: FileDef parity in the host consumer (identity-only file-meta rows)#5180
habdelra merged 2 commits into
mainfrom
cs-11471-unified-search-filedef-parity-host-consume-identity-only

Conversation

@habdelra

Copy link
Copy Markdown
Contributor

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):

  • Recognizes an identity-only file-meta row (isIdentityOnlyFileMetaResource) alongside the card case, builds the inert component from its rendered-html, and imports its scoped css. File rows previously fell through to the full-live branch.
  • Carries each row's resource type (card / file-meta) on the renderable item, threaded to HydratableCard @type so a file row resolves to a live FileDef rather than a CardDef.
  • A file-meta row 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: buildRenderableSearchItems over 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 assert type: 'card'. (HydratableCard file-meta hover-hydration to a live FileDef is covered by the hydration PR.)


Stacking. This sits on top of two open PRs:

Linear: CS-11471

@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: 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".

Comment thread packages/realm-server/handlers/handle-search.ts
Comment thread packages/runtime-common/search-utils.ts
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files  ±0      1 suites  ±0   1h 53m 2s ⏱️ - 2m 9s
3 035 tests ±0  3 020 ✅ ±0  15 💤 ±0  0 ❌ ±0 
3 054 runs  ±0  3 039 ✅ ±0  15 💤 ±0  0 ❌ ±0 

Results for commit f6bbbb5. ± Comparison against earlier commit a45e8ee.

Realm Server Test Results

    1 files  ±0      1 suites  ±0   9m 56s ⏱️ -18s
1 616 tests +6  1 616 ✅ +6  0 💤 ±0  0 ❌ ±0 
1 707 runs  +6  1 707 ✅ +6  0 💤 ±0  0 ❌ ±0 

Results for commit f6bbbb5. ± Comparison against earlier commit a45e8ee.

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 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-only card/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-realm command + 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.

Comment thread packages/runtime-common/search-utils.ts
Comment thread packages/runtime-common/realm-index-query-engine.ts
Comment thread packages/runtime-common/realm-index-query-engine.ts
Comment thread packages/host/app/lib/unified-search-results.ts
Comment thread packages/realm-server/server.ts
@habdelra
habdelra marked this pull request as draft June 10, 2026 14:27
@habdelra
habdelra changed the base branch from cs-11435-unified-search-hydration-lazy-get-linksself-modes-diagnostic to main June 10, 2026 16:53
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>
@habdelra
habdelra force-pushed the cs-11471-unified-search-filedef-parity-host-consume-identity-only branch from 84011d1 to a45e8ee Compare June 10, 2026 17:06
@habdelra
habdelra requested a review from Copilot June 10, 2026 17:19
@habdelra
habdelra marked this pull request as ready for review June 10, 2026 17:19

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

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

Comment thread packages/host/app/components/card-search/hydratable-card.gts
@habdelra
habdelra changed the base branch from main to cs-11435-unified-search-hydration-lazy-get-linksself-modes-diagnostic June 10, 2026 17:30
@habdelra
habdelra requested a review from Copilot June 10, 2026 17:32

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@habdelra
habdelra requested a review from a team June 10, 2026 17:36
@habdelra
habdelra changed the base branch from cs-11435-unified-search-hydration-lazy-get-linksself-modes-diagnostic to main June 10, 2026 18:07
…ch-filedef-parity-host-consume-identity-only

# Conflicts:
#	packages/host/app/lib/unified-search-results.ts
@habdelra
habdelra merged commit 8656486 into main Jun 10, 2026
71 of 73 checks passed
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