Skip to content

perf: index graph parents and successors for reply paths - #1417

Open
MrPunyapal wants to merge 1 commit into
dev-null-sh:productionfrom
MrPunyapal:perf/index-commit-graph-relations
Open

MrPunyapal wants to merge 1 commit into
dev-null-sh:productionfrom
MrPunyapal:perf/index-commit-graph-relations

Conversation

@MrPunyapal

@MrPunyapal MrPunyapal commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Building reply paths repeatedly searches every measured graph node for a parent’s replies and continuation. This groups those relationships once, so each lookup scans the matching nodes in their original order.

All 33 graph-edge tests passed, along with TypeScript checks and the build. I also compared complete edge results with the original implementation for small graphs, many unrelated threads, and a large sibling group, including drawing-state variants. The results matched.

This removes scans of unrelated nodes. A single large sibling group can still require quadratic filtering; the PR does not claim linear behavior or a measured browser rendering improvement. GitHub’s test workflow is awaiting repository approval.

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency of thread branch connections when a thread is displayed alongside many unrelated nodes.
  • Tests
    • Added coverage to verify that reply and continuation connections remain consistent as unrelated nodes are added.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 59b5b4dd-7684-47f0-8e26-58b0a6857856
Commits

Reviewing files that changed from the base of the PR and between b8df0f6 and 2c15b1d.

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:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

graphEdges groups nodes by parent and predecessor before building branch edges. The branch logic uses these groups to find successors and earlier replies. A regression test checks that adding 200 unrelated nodes does not change the thread’s reply and continuation edge IDs or paths.

Changes: Graph edge lookup

Layer / File(s) Summary
Grouped branch-edge lookup
resources/js/lib/graph.ts, tests/Unit/GraphEdges.test.ts
graphEdges groups nodes by parent and predecessor, then uses those groups to find branch successors and earlier replies. A regression test checks edge IDs and paths with 200 unrelated nodes added.

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

Change: Refactor

Possibly related PRs

Suggested reviewers: jubianchi

Merge Risk: Minimal · previous review b8df0

The change is mergeable; focused source comparison found no behavior change beyond the intended lookup optimization.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names a performance change: graph parent and successor relationships are now indexed before reply paths are built. The raw summary confirms that graphEdges groups nodes by parent and after o…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names a performance change: graph parent and successor relationships are now indexed before reply paths are built. The raw summary confirms that graphEdges groups nodes by parent and after once, then uses those groups to find successors and earlier replies. The title is specific and matches the main change, so it passes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 41adfc30-debe-4949-b80c-bbd0011d957e
Commits

Reviewing files that changed from the base of the PR and between c934501 and b8df0f6.

Files selected for processing: 2
  • resources/js/lib/graph.ts
  • tests/Unit/GraphEdges.test.ts

Limit details: You’ve used all 10 included reviews currently available.

@MrPunyapal
MrPunyapal force-pushed the perf/index-commit-graph-relations branch from b58c274 to b8df0f6 Compare November 3, 2026 05:55
@MrPunyapal
MrPunyapal marked this pull request as ready for review November 3, 2026 06:02
@MrPunyapal
MrPunyapal force-pushed the perf/index-commit-graph-relations branch from b8df0f6 to 2c15b1d Compare November 3, 2026 21:04
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