GeezerVison is showing github.com — perf(server): avoid thread-wide scans for message projection by juliusmarminge · Pull Request #1647 · pingdotgg/t3code
Conversation
juliusmarminge
commented
Apr 1, 2026
•
edited by macroscopeapp
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- add keyed projected-message lookup support in the projection repository
- stop loading every thread message row for each
thread.message-sent projection update
- extend repository coverage for the new lookup path
Stack
- base: oxc stack #1 in this stack (
codex/backend-perf-queries)
Validation
bun run test src/persistence/Layers/ProjectionThreadMessages.test.ts src/orchestration/Layers/ProjectionPipeline.test.ts
bun run test src/orchestration/Layers/ProjectionSnapshotQuery.test.ts src/checkpointing/Layers/CheckpointDiffQuery.test.ts src/persistence/Layers/ProjectionThreadMessages.test.ts src/orchestration/Layers/ProjectionPipeline.test.ts src/orchestration/Layers/OrchestrationEngine.test.ts src/orchestration/Layers/CheckpointReactor.test.ts src/orchestration/Layers/ProviderRuntimeIngestion.test.ts src/orchestration/Layers/ProviderCommandReactor.test.ts
bun fmt
bun lint
bun typecheck (currently fails in apps/web due pre-existing @effect/atom-react / Layer.suspend errors)
Note Medium Risk
Changes the thread.message-sent projection write path to depend on a new getByMessageId query instead of scanning all messages in a thread, which could subtly affect message text/attachment merge behavior if the lookup or Option handling is incorrect.
Overview
Improves message projection performance by avoiding per-event thread-wide reads when handling thread.message-sent.
Adds a keyed ProjectionThreadMessageRepository.getByMessageId API (service + SQLite implementation) and refactors the projector to fetch only the prior row for that message to compute streaming text updates and attachment retention/clearing. Tests are extended to cover the new lookup path alongside existing attachment-preservation behavior.
Written by Cursor Bugbot for commit d64edba. This will update automatically on new commits. Configure here.
Note
Replace thread-wide message scan with direct lookup by messageId in projection pipeline
- Adds
getByMessageId to ProjectionThreadMessageRepository (ProjectionThreadMessages.ts), returning Option<ProjectionThreadMessage> via a targeted SQL query instead of listing all thread messages.
- Updates the
thread.message-sent handler in ProjectionPipeline.ts to use this new lookup, eliminating a full thread scan per message event.
- Introduces a shared
toProjectionThreadMessage helper to consolidate row-to-domain mapping used by both listByThreadId and getByMessageId.
Macroscope summarized d64edba.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Apr 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Important
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: cc8271a2-c88d-4bae-9276-d15ac875f896
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
codex/backend-perf-message-projection
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
macroscopeapp
Bot
commented
Apr 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved
Performance optimization that replaces a thread-wide message scan with a direct message ID lookup. The business logic is preserved and restructured using Effect's Option utilities. The PR author owns this code and tests are included.
You can customize Macroscope's approvability policy. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:L
100-499 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|