perf(server): streamed projection updates no longer rewrite unchanged index entries #19619
ClosedKiroshiAiviom(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/19619/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/orchestration-v2/ProjectionStore.test.ts line 940Resolvedby KiroshiAiviom(GitHub profile, opens in a new tab)@@ -623,0 +837,21 @@837+ assert.deepEqual(new Set([...assigned, ...guarded]), tableColumns, projection.table);838+839+ const indexes = yield* sql.unsafe<{ name: string; sql: string | null }>(840+ "SELECT name, sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ?",841+ [projection.table],842+ );843+ for (const index of indexes) {844+ const keys = new Set(845+ (yield* sql.unsafe<{ name: string | null }>(`PRAGMA index_info(${index.name})`)).map(846+ (column) => column.name ?? "",847+ ),848+ );849+ const filter = columnsIn(850+ /\bWHERE\b([\s\S]*)$/i.exec(index.sql ?? "")?.[1] ?? "",851+ tableColumns,852+ );853+ for (const column of filter) {854+ assert.isTrue(guarded.has(column), `${index.name}.${column}`);855+ }856+ for (const column of keys) {857+ assert.isTrue(guarded.has(column) || filter.size > 0, `${index.name}.${column}`);
maria-rcks closed this
Sign in to join this conversation.
Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
6c9d7b32-521a-4dbc-924a-67583135071d📥 Commits
Reviewing files that changed from the base of the PR and between a3ef468dc77424a0b3a9325554ddd5a9f234db74 and 98fe53bf5b9494e76cbe3628d3f1eb7d62307e52.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
fcbeb6c9-f20d-462a-a30f-6fd41ebcd939📥 Commits
Reviewing files that changed from the base of the PR and between 79adf8c4800fbbb8511aee5c5f9cd05b0a434345 and a3ef468dc77424a0b3a9325554ddd5a9f234db74.
📒 Files selected for processing: 2
apps/server/src/orchestration-v2/ProjectionStore.test.tsapps/server/src/orchestration-v2/ProjectionStore.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
The node, message, and turn-item update handlers now update matching rows before using their existing upsert fallback. SQL tests cover stable updates, changed indexed values, SQL column guards, and database integrity.
Changes: Projection update matching
apps/server/src/orchestration-v2/ProjectionStore.tsapps/server/src/orchestration-v2/ProjectionStore.test.tsPriority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers:
t3dotgg,juliusmarmingeMerge Risk: 🔵 Low · up to
a3ef4Updates to failed error items can still rewrite an index entry the optimization aims to avoid. This is a bounded performance risk; the change is mergeable with owner awareness or a follow-up fix.
Security architecture risk: 🔵 Low · up to
a3ef4The new write paths preserve existing row identities, stored values, and surrounding transaction boundaries. No expanded access or weakened security control was identified. Failure and concurrency behavior were assessed from source rather than exercised during this review.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Pre-merge checks:
4
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.