Conversation
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background and Goal
Card JSON assembly still performs broad index reads: individual card reads and linked-card/file expansion select
i.*plus every rendered HTML format and markdown. Healthy card assembly does not use most of those columns, but Postgres transfers them and the driver parses the JSONB values before Node discards them. Root search results already have a narrower projection; this change targets the follow-up entry reads.Add an internal
dataOnlyprojection and use it incardDocument()and the batched lookups inloadLinks(). Full reads remain the default for other callers. Query predicates, graph traversal, authorization, response formatting, and the public API are unchanged. No migrations or card-definition changes.Where to start
packages/runtime-common/index-query-engine.ts:entryColumns()selects the columns needed for JSON assembly. Healthy instances omit their search documents and rendered output; file rows retain search attributes. Both retain dependencies, timestamps, and screenshots. Effective source/render errors retain their error document, title source, and last-known-good isolated HTML.packages/runtime-common/realm-index-query-engine.ts: opt the card-document read and the existing linked-card/file batches into that projection.Handoff
The implementation is deliberately small: 35 added production lines across two files, plus focused regression coverage. The new database tests compare full and narrow results using multi-megabyte unused fields, cover canonical URLs/aliases, production and working tables, missing/deleted rows, file metadata, screenshots, and source/render error precedence. The existing linked-card integration test now also checks that its actual database results omit unused fields.
Locally, all 50 tests in
index-entry-projection-testandprerender-html-split-testpass.pnpm lintpasses in runtime-common and realm-server. A separate SQLite query smoke check passed for all four entry methods and both table pairs; this does not substitute for the host/browser suite.Before taking this out of draft:
load-links-batching-testand existing card/file endpoint and host tests in a healthy test environment. The local services required for browser integration returned 502, so that integration test was not run here.