Skip to content

diffr: index the plugin cursor - #1011

Open
sidkmenon wants to merge 3 commits into
sm/diffr-leaf-pair-wirefrom
sm/diffr-leaf-pair
Open

sidkmenon wants to merge 3 commits into
sm/diffr-leaf-pair-wirefrom
sm/diffr-leaf-pair

Conversation

@sidkmenon

@sidkmenon sidkmenon commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

The plugin cursor searched both trees on most calls. Three commits:

  1. Read leaf partners (pair, from diffr: give each leaf the id of its partner on the other side #1014) instead of rebuilding the other side's alignment ids per call.
  2. Index regions by id: side, parent and path. cut and join keep it current. No behavior change.
  3. Index fold states, for linked_regions, set_collapsed and link.

cargo bench --bench engine (#1013), before → after:

benchmark before after
shape/pr998/context 1.575 s 64 ms
engine/pr998/default 2.00 s 233 ms
engine/pr998/no_context 148 ms 118 ms

Tests: diffr-core cursor, present and protocol units; plugin tests; context goldens for rust, go, typescript and tsx. The full cargo test suite was not run.

@sidkmenon
sidkmenon added this pull request to stack #1012 October 8, 2026 05:23
`has_changes`, `is_one_sided` and change coverage asked whether a leaf
is paired by collecting every alignment id on the other side, once per
call. `paired_leaf` searched the other side for the matching leaf. They
now read the leaf's `pair`. Test fixtures name pairs from their
alignment ids.

AI-assisted: developed with Claude Code.
Agent-Session: fb96350b-c19e-48f0-b364-31e9ad2b72f4
Agent-Session: 01a1196d-bad4-7f61-bafc-f63d12217676
Agent-Session: 7d7ac281-cc4b-4437-9e1e-3872651e8bcf
Agent-Session: a7af3b88-3bb7-48a2-ae20-7626a83628a1
Every lookup by id searched both trees. The cursor now keeps each
region's side, parent and path from its side's root, so a lookup is a
probe and a descent. `cut` and `join` rewrite the entries of the
regions they move. The sides become private so nothing else can move a
region; the plugin host takes them back with `into_sides`.

No behavior change.

AI-assisted: developed with Claude Code.
Agent-Session: fb96350b-c19e-48f0-b364-31e9ad2b72f4
Agent-Session: 01a1196d-bad4-7f61-bafc-f63d12217676
Agent-Session: 7d7ac281-cc4b-4437-9e1e-3872651e8bcf
Agent-Session: a7af3b88-3bb7-48a2-ae20-7626a83628a1
`linked_regions`, `set_collapsed` and `link` walked both trees to find
the regions in a fold state. The cursor now keeps the regions of each
fold state, and `cut`, `join` and `link` update it.

AI-assisted: developed with Claude Code.
Agent-Session: fb96350b-c19e-48f0-b364-31e9ad2b72f4
Agent-Session: 01a1196d-bad4-7f61-bafc-f63d12217676
Agent-Session: 7d7ac281-cc4b-4437-9e1e-3872651e8bcf
Agent-Session: a7af3b88-3bb7-48a2-ae20-7626a83628a1
@sidkmenon
sidkmenon removed this pull request from stack #1012 October 8, 2026 05:30
@sidkmenon sidkmenon changed the title diffr: give leaves their partner and index the plugin cursor diffr: index the plugin cursor Oct 8, 2026
@sidkmenon
sidkmenon changed the base branch from codex/reapply-diffr-after-release to sm/diffr-leaf-pair-wire October 8, 2026 05:30
@sidkmenon
sidkmenon added this pull request to stack #1015 October 8, 2026 05:31

This branch has not been deployed

No deployments
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