Skip to content

Add bounded exact text item batch resolution - #246

Draft
MadeByDouglas wants to merge 3 commits into
satoren:mainfrom
boldflight:codex/offline-multiplayer
Draft

MadeByDouglas wants to merge 3 commits into
satoren:mainfrom
boldflight:codex/offline-multiplayer

Conversation

@MadeByDouglas

@MadeByDouglas MadeByDouglas commented Sep 10, 2026 •

Copy link
Copy Markdown

Adds Yex.StickyIndex.resolve_text_items/2 for bounded exact item-ID runs against one XML text. It resolves all positions in one read transaction on a dirty CPU scheduler, returns live/collapsed/unavailable/wrong-type results, and checks the actual containing branch. Deleted original IDs stay collapsed when undo/redo recreates content under new IDs.

The binding uses public Yrs APIs only. Input is limited to 4,096 runs and 131,072 UTF-16 units; a separate linked-item traversal budget fails recoverably. Applications still own root reachability, plain-text validation, authorization and provenance.

This is a draft because it depends on the companion Yrs API in y-crdt/y-crdt#656. For reproducible integration, Cargo currently pins a public immutable backport of that change to Yrs 0.25. The fork pin should be replaced with a compatible released dependency before a normal package release. No machine-local paths are required.

The follow-up at a312e0c corrects two Elixir typespecs to match existing native behavior: Yex.Doc.Options.collection_id accepts nil, and Yex.Awareness.apply_update/3 can return {:error, term()} for malformed updates. It adds regressions for default collection options with UTF-16 editing and awareness decode errors preserving existing state. No Rust or runtime behavior changes are included in this follow-up.

Validation:

  • Complete-suite baseline at b6fa2ba: 617 cases passed (63 doctests and 554 tests), using the actual remote Git dependency.
  • Typespec follow-up at a312e0c: 70 focused checks passed (11 doctests and 59 tests) in the document and awareness test files, using the existing source-built native library. The complete suite has not been rerun at this commit.
  • Shared Yjs fixtures cover emoji, multiple leaves, concurrent interior insertion, deletion and unavailable ancestors.
  • Additional cases cover redo, wrong-type claims, active transactions, malformed/oversized runs and the maximum clock boundary.
  • A 131,072-unit, 4,096-format-span benchmark improved from 13,222 ms before prefix caching to 36 ms afterward, checking every position. This is a local measurement, not an adversarial latency guarantee.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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