Omit deps from query field results during indexing#4037
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modifies the indexing system to exclude query-backed relationships from dependency tracking. Query-backed relationships (identified by the presence of a links.search property) populate their results dynamically through queries rather than explicit relationships, making traditional dependency tracking inappropriate. The PR introduces helper methods to identify and skip these relationships during dependency extraction, ensuring a consistent invalidation story until a proper query field invalidation strategy is implemented.
Changes:
- Added methods to detect and filter out query-backed relationships during dependency extraction
- Modified all relationship dependency extraction methods to skip query field paths
- Removed processing of
includedresources in serialized relationships since they can contain query results - Added comprehensive test coverage for both
linksToandlinksToManyquery-backed relationships
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/runtime-common/index-runner/dependency-resolver.ts | Core implementation: Added query field detection methods and modified all dependency extraction methods to skip query-backed relationships |
| packages/runtime-common/index-runner/card-indexer.ts | Updated card indexer to extract and pass query field paths to search doc dependency extraction |
| packages/realm-server/tests/indexing-test.ts | Added test verifying that query-backed relationship targets are not tracked as dependencies |
| AGENTS.md | Added documentation for lint:fix commands (unrelated documentation improvement) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-query-field-results-as-deps
This PR omits capturing dependencies for relationships that originate from query fields. This allows us to have a consistent invalidation story while we figure out how we want to handle query field invalidations.