Skip to content

perf(sync): optimize local entity lookup in collectUpdates - #919

Merged
d-oit merged 2 commits into
mainfrom
perf-sync-collect-updates-map-lookup-6691177906816101431
Oct 7, 2026
Merged

d-oit merged 2 commits into
mainfrom
perf-sync-collect-updates-map-lookup-6691177906816101431

Conversation

@d-oit

@d-oit d-oit commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Optimizes sync conflict resolution in src/lib/sync/bridge.ts by replacing O(N) linear array scans (locals.find(...)) in collectUpdates and applyConflictResolution with O(1) Map lookups. Added merge performance test suite.


PR created automatically by Jules for task 6691177906816101431 started by @d-oit


📝 Summary by GitNexus

Summary

A focused synchronization performance change with impact beyond the edited code, despite low file-level risk.

🟠 HIGH blast radius. A synchronization performance change centered on local entity lookup in collectUpdates, also touching applyConflictResolution, with one direct dependent.

The change is concentrated in src/lib/sync/bridge.ts, with src/lib/sync/merge.perf.test.ts also changed. The graph places the impact in Sync and Views, with 3 affected flows.

Review the lookup path in collectUpdates and the related changes in applyConflictResolution, then check the performance test. The file-level risk is LOW; the overall blast level is HIGH.

Added by GitNexus for PR #919. Edit freely — this block is replaced on the next review, everything above it is left untouched.

Pre-build Map indexes for local entities and claims in applyConflictResolution and collectUpdates, reducing entity/claim lookup complexity from O(C * N) to O(C + N) during conflict resolution.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
do-knowledge-studio Ready Ready Preview, v0 Oct 7, 2026 1:06am UTC

@github-actions github-actions Bot added config tests Related to automated/manual tests labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Blocked merge diagnosis — blocked
⏳ Check run(s) still in progress: ["Dependency Verify","Unit Tests","Quality Gate","shellcheck","Codacy Static Code Analysis","Diagnose Blocked Merge State","Trivy Filesystem Security Scan","Dependency Advisory Audit","Shell Script Security Analysis","Infrastructure as Code Security","Secret Detection","commitlint","Analyze (actions)","Analyze (javascript-typescript)","GitNexus"]

@nexus-check

nexus-check Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor
Akon Labs

GitNexus Review · PR #919

1 issue found across 1 file.

Summary

A focused synchronization performance change with impact beyond the edited code, despite low file-level risk.

🟠 HIGH blast radius. A synchronization performance change centered on local entity lookup in collectUpdates, also touching applyConflictResolution, with one direct dependent.

The change is concentrated in src/lib/sync/bridge.ts, with src/lib/sync/merge.perf.test.ts also changed. The graph places the impact in Sync and Views, with 3 affected flows.

Review the lookup path in collectUpdates and the related changes in applyConflictResolution, then check the performance test. The file-level risk is LOW; the overall blast level is HIGH.

🔀 Structural changes · perf-sync-collect-updates-map-lookup-6691177906816101431 → main

Both branches are separately indexed, so this compares their code graphs directly — what the diff cannot show.

Symbols added (2)

  • src/lib/sync/merge.perf.test.ts::generateClaims
  • src/lib/sync/merge.perf.test.ts::generateEntities

Full detail lives in the GitNexus check run for this commit.

@nexus-check

nexus-check Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Agent context for GitNexus Review · PR #919

This comment carries deterministic graph detail for coding agents and reviewers who want the receipts — the main review comment carries the human summary.

🟠 HIGH blast radius — this change reaches 1 downstream symbol across 2 modules; review the dependent list before merging. (driven by dependent/module count, not file risk)

Blast Level Dependents Modules Files
🟠 HIGH 1 2 2

What changed

Symbol Changes (2)
Kind Symbol Location
Function applyConflictResolution src/lib/sync/bridge.ts:223
Function collectUpdates src/lib/sync/bridge.ts:259
Changed Files (2)
File Status
src/lib/sync/bridge.ts 🟡 modified
src/lib/sync/merge.perf.test.ts 🟢 added

What it affects

Architecture Impact

Module Hits Direct
Sync 2 ⚪
Views 1 🟢

Blast Radius

Depth Count
d1 (direct) 1
d2 (indirect) 0
d3 (transitive) 0
Direct dependents (d1)
  • src/components/studio/views/sync-view.tsx:323 · handleConflictResolve
Prompt for AI agents (1 issue)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.

<file name="src/lib/sync/merge.perf.test.ts">

<violation number="1" location="src/lib/sync/merge.perf.test.ts:115">
P2: Performance tests never enforce a runtime bound — Both tests are named as fast-performance checks, but they only print the measured duration and assert the merged item count. Any arbitrarily slow regression still passes, so these tests do not detect the performance regressions their names imply.
</violation>

</file>

@codacy-production

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 11 complexity · 0 duplication

Metric Results
Complexity 11
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread src/lib/sync/merge.perf.test.ts
Pre-build Map indexes for local entities and claims in applyConflictResolution and collectUpdates, reducing entity/claim lookup complexity from O(C * N) to O(C + N) during conflict resolution.
@d-oit
d-oit merged commit 932b417 into main Oct 7, 2026
26 checks passed
@d-oit
d-oit deleted the perf-sync-collect-updates-map-lookup-6691177906816101431 branch October 7, 2026 06:35

This branch was successfully deployed

1 active deployment
Preview — 3949127b Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config tests Related to automated/manual tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant