fix: load brain graph nodes from projections (#4196) - #4295
Merged
Conversation
loadNodes() awaited getBrainProjections() once per entity type in a sequential loop, paying the sum of all six fetch latencies on a cold cache. getBrainGraphSearchIndex() already fetches the same six types with Promise.all — loadNodes() now matches that pattern.
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.
Summary
brainGraph.loadNodes()was reading full record bodies viabrainStorage.getAll()instead of the cached field projectionsbrainSearchIndexalready builds — the same duplicate disk-read pattern issue [Perf] Graph search index endpoint loads full record bodies for all entity types and daily logs #3507 fixed for the graph search index.tags/status/summary fields (description,context,oneLiner,artist,notes) plus a type-guardedcontentderived field to the shared brain projection set so the graph's edge-bearing views (overview/neighborhood) can read from projections without losing data — large SongBook sheet bodies (content.text) still never reach the cache.loadNodes()withPromise.all, matching the existing pattern in the siblinggetBrainGraphSearchIndex().Closes #4196
Test plan
cd server && NODE_ENV=test npx vitest run services/brainGraph.test.js services/brainSearchIndex.test.js— 50 passing, including new coverage for tags/status projection, string-vs-objectcontentguarding, and node-for-node parity between the full and projection-backed graph pathsNODE_ENV=test npm test): 1398 files / 29352 tests passing