Skip to content

fix(reflect): continue past visited graph seeds - #1243

Open
DimitriChrysafis wants to merge 1 commit into
rohitg00:mainfrom
DimitriChrysafis:fix/1133-reflect-cluster-seeds
Open

fix(reflect): continue past visited graph seeds#1243
DimitriChrysafis wants to merge 1 commit into
rohitg00:mainfrom
DimitriChrysafis:fix/1133-reflect-cluster-seeds

Conversation

@DimitriChrysafis

@DimitriChrysafis DimitriChrysafis commented Aug 23, 2026

Copy link
Copy Markdown

Summary

mem::reflect stopped clustering when it reached a seed that had already been visited, so disconnected groups could be skipped.

This changes that case from break to continue and uses a map for node lookups instead of scanning the node list each time. In the issue reporter's 5,128-node benchmark, cluster construction was 2.8x faster.

This PR only covers the seed-loop and node-lookup fixes from #1133. The other follow-up ideas in that issue are separate changes.

Testing

  • Added tests for disconnected graph groups and the maxClusters limit
  • 1,713 tests passed
  • Build and skill checks passed

Addresses #1133

Signed-off-by: dimitri <dimitri.chrysafis@gmail.com>
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

@DimitriChrysafis is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: baef4054-d557-49b3-a00e-1835a5f50b2e

📥 Commits

Reviewing files that changed from the base of the PR and between e04ba88 and 517f976.

📒 Files selected for processing (2)
  • src/functions/reflect.ts
  • test/reflect.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

buildGraphClusters now processes disconnected concept groups correctly, skips visited seeds, enforces maxClusters, and uses direct concept-node lookup. Reflection tests cover multiple groups and cluster-limit behavior.

Changes

Reflection clustering

Layer / File(s) Summary
Cluster processing
src/functions/reflect.ts
buildGraphClusters indexes concept nodes by ID, continues past visited seeds, stops at maxClusters, and uses the index for node-name lookup.
Cluster processing tests
test/reflect.test.ts
Tests verify that disconnected groups are summarized separately and that maxClusters: 1 limits processing to one cluster.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 517f9

This localized change fixes disconnected graph clustering and adds coverage for the affected behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses seed handling and lookup performance but does not address the issue's provenance, deduplication, cluster-size, or KV-state objectives. Implement the remaining objectives or split them into separate linked issues with an explicitly narrower scope for this PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The code and tests remain focused on graph clustering, disconnected groups, and the maxClusters limit described in issue #1133.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: continuing past visited graph seeds during reflection clustering.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant