Conversation
Preview deployments |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4d4043e92
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR removes “module” rows from the search index flow while remaining tolerant of existing type='module' rows in boxel_index. Module dependency/error information is now sourced from the modules cache (via DefinitionLookup) and instance deps are expanded transitively so module rows are no longer needed for invalidation.
Changes:
- Stop writing/querying
type='module'index entries; filter out existing module rows inboxel_indexqueries and counts. - Expand instance deps (and instance error deps) with transitive module dependencies using the module cache; switch dependency-error collection to read from cached module errors.
- Plumb
definitionLookupthrough worker/task args and addDefinitionLookup.getModuleCacheEntries()to support batched cache reads.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-common/worker.ts | Creates and passes a CachingDefinitionLookup into task args. |
| packages/runtime-common/tasks/index.ts | Extends TaskArgs to include definitionLookup. |
| packages/runtime-common/tasks/indexer.ts | Passes definitionLookup and realmOwnerUserId into IndexRunner. |
| packages/runtime-common/index-runner.ts | Removes module indexing; expands instance deps transitively via module cache; reads module errors from cache instead of index. |
| packages/runtime-common/definition-lookup.ts | Exports cache types and adds getModuleCacheEntries() for batched module cache retrieval. |
| packages/runtime-common/index-writer.ts | Removes module entry support; filters out module rows in reads/copy/counts; rejects module-error writes. |
| packages/runtime-common/index-structure.ts | Removes 'module' from BoxelIndexTable.type. |
| packages/runtime-common/index-query-engine.ts | Removes getModule() and associated module result types. |
| packages/runtime-common/realm-index-query-engine.ts | Removes module() query surface. |
| packages/runtime-common/realm-index-updater.ts | Drops module stats fields from initializer. |
| packages/realm-server/worker-manager.ts | Stops emitting module-error index entries for failed paths. |
| packages/realm-server/tests/server-endpoints/maintenance-endpoints-test.ts | Updates expected stats shape (no module counters). |
| packages/realm-server/tests/indexing-test.ts | Updates tests away from module index queries; validates behavior via instance deps and module cache rows. |
| packages/realm-server/tests/full-reindex-test.ts | Updates task args construction for definitionLookup. |
| packages/realm-server/tests/billing-test.ts | Updates task args construction for definitionLookup. |
| packages/host/tests/unit/index-writer-test.ts | Updates invalidation expectations to rely on instance deps instead of module rows; adjusts copy assertions. |
| packages/host/tests/unit/index-query-engine-test.ts | Adds getModuleCacheEntries to the mock DefinitionLookup. |
| packages/host/tests/integration/components/ai-module-creation-test.gts | Switches from module index assertions to file index assertions for module files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Host Test Results 1 files ±0 1 suites ±0 1h 38m 59s ⏱️ -54s Results for commit 730cad3. ± Comparison against base commit cd80b2b. This pull request removes 6 and adds 10 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ctions preventing tests from running on top of one another
d6d1894 to
92c61f4
Compare
d72f868 to
8f39cb6
Compare
packages/realm-server/server.ts
Outdated
| let moduleExtensions = ['.gts', '.ts', '.js']; | ||
| for (let extension of moduleExtensions) { | ||
| if (existsSync(join(realm.dir, `${localPath}${extension}`))) { | ||
| return true; | ||
| } | ||
| if (existsSync(join(realm.dir, localPath, `index${extension}`))) { | ||
| return true; | ||
| } | ||
| } |
There was a problem hiding this comment.
This is up to 6 IO ops on a hot path (serving a card). Should we consider a cache, or consider doing this in the case of a database miss only?
| if (surfacedAuthorizationError) { | ||
| assert.strictEqual( | ||
| stats.instanceErrors, | ||
| 1, | ||
| 'instance errors surfaced', | ||
| ); | ||
| assert.strictEqual(stats.instancesIndexed, 0, 'no instances indexed'); | ||
| } else { | ||
| assert.true( | ||
| indexingFailedBeforeStatsWereProduced, | ||
| `indexing failed before stats were produced: ${JSON.stringify( | ||
| stats, | ||
| )}`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Seems weird to have a conditional like this in the test. Shouldn't we know what's going to happen?
| const importSpecifierExpression = | ||
| /(?:import|export)\s+(?:[^'"`]*?\sfrom\s+)?['"]([^'"]+)['"]|import\(\s*['"]([^'"]+)['"]\s*\)/g; |
There was a problem hiding this comment.
Have we always used a regexp for this kind of thing?
There was a problem hiding this comment.
actually no. we do have a module syntax component in runtime common that uses an AST. let me refactor
This PR removes module indexing. This PR is meant to be backwards compatible so that if there are still module index entries we can ignore them safely.
After this PR gets deployed to staging and production, I'll create a followup PR to remove all the module index entries and streamline the queries since we can safely assume those wont exist.