Repository navigation
perf: index cross-owner universal draft lookups - #1011
Merged
domgan-oai merged 1 commit intoSep 9, 2026
Merged
Conversation
domgan-oai
marked this pull request as ready for review
September 9, 2026 10:49
Closed
68 of 84 tasks
14 of 21 tasks
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Part of #981: each sibling reading or writing a ref owned by an earlier ancestor otherwise scans the growing draft-owner list. Repeated ancestor-ref access becomes quadratic across a wide sibling tree.
Changes
Mapthat catches up with appended draft owners in order; duplicate records overwrite earlier drafts. Reads of the latest owner use the direct tail check.universal-draft-lookupin the benchmark runner and MCP catalog; add patch changesets foroctaneand@octanejs/mcp-server.Validation
pnpm syncandgit diff --checkpnpm format:files:checkfor all eight changed filespnpm typecheck:files packages/octane/src/universal-core.ts packages/octane/tests/universal-state-updates.test.tsnode benchmarks/bench.mjs --quick universal-draft-lookup(16 targets, output and identity checks)pnpm test, repository-widepnpm typecheckandpnpm format:checklocally; current-head CI will run these gatesProduction Node 26.4.0 object-driver B–C–C–B comparison (13 samples per run, eight accepted updates per sample): at 1,024 child owners, repeated ancestor-ref reads took 2.019/1.882 ms per update on the frozen baseline and 1.238/1.080 ms on the candidate (about 41% lower paired mean). The 128-owner result was inconclusive. Single distant reads, own-ref reads, and plain-property controls showed mixed small differences within run variability. All 16 targets matched output hashes across runs with stable hosts, 104 accepted commits and zero structural commands.
Risk / follow-ups
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Touches universal render-attempt hook/ref resolution in
universal-core.ts; incorrect indexing could corrupt ref/state across siblings, preparations, or retries, though new tests and the benchmark gate correctness.Overview
Cross-owner hook/ref reads no longer scan the full draft-owner list on every lookup.
findDraftOwnerkeeps an allocation-free tail check for the newest owner and builds an attempt-localMaponly when a render needs an earlier owner's draft; later appends extend the index and overwrites keep last-draft-wins after retries.Adds a Node
universal-draft-lookupbenchmark (ancestor ref, own-ref, single distant read, plain-object controls at 0–1,024 child owners) plus runner/MCP registration, patch changesets, and a regression test for shared ancestor refs across keyed siblings, nested prepare/abort, and render-phase retry.Reviewed by Cursor Bugbot for commit 3942da5. Bugbot is set up for automated code reviews on this repo. Configure here.