Skip to content

Add targeted tree placement lookup#174

Closed
marcus-pousette wants to merge 2 commits into
cybersemics:mainfrom
marcus-pousette:codex/tree-placement-lookup
Closed

Add targeted tree placement lookup#174
marcus-pousette wants to merge 2 commits into
cybersemics:mainfrom
marcus-pousette:codex/tree-placement-lookup

Conversation

@marcus-pousette

@marcus-pousette marcus-pousette commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add optional tree.placement(node) read API that returns a node's current parent plus restore placement
  • implement the lookup in the shared SQLite adapter without reading all siblings
  • expose it through sqlite-node and wa-sqlite RPC/direct clients
  • make edits.capture use the targeted lookup when available, with the existing sibling-scan fallback for other backends
  • add conformance coverage for first/after placement, moves, deletes, root, and missing nodes

Stack note

This is an exploratory draft stacked on #173. The public undo API remains edits.capture/undo/redo; this PR only tries a lower-cost backend read so move/delete capture does not need tree.children(parent) on SQLite-backed runtimes.

Verification

  • pnpm -C packages/treecrdt-ts run build
  • pnpm -C packages/treecrdt-engine-conformance run build
  • pnpm -C packages/treecrdt-wa-sqlite run build:ts
  • pnpm -C packages/treecrdt-sqlite-node run test

Known local limitation

pnpm -C packages/treecrdt-wa-sqlite run test still fails in the vendor build with No rule to make target tmp/obj/dist/sqlite3.o, before Vitest runs. The wa-sqlite TypeScript/RPC path compiles.

@marcus-pousette

Copy link
Copy Markdown
Collaborator Author

Closing this as superseded by #175. This was an optimization for eager capture reads; #175 defers inversion to undo time, so targeted placement lookup is not needed for the first clean solution. We can revisit it later as a separate optimization if eager capture remains useful.

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