refactor: unify sync and async prolly engine#24
Merged
Conversation
forhappy
marked this pull request as ready for review
July 20, 2026 01:21
Resolve the async-first architecture against current main, retain shared lineage optimizations, and add evidence-based ready paths for native sync reads and version operations. Remove the replay round cap in favor of a progress invariant so large async workloads preserve correctness.
Contributor
Author
|
Updated PR #24 with current main and resolved all merge conflicts in 2dd0ee7. Verification:
Rust performance regression verification, lower elapsed time is better:
Version operation verification:
The version workload also exposed a fixed 256-round async replay correctness limit for sparse multi-level edits. The cap is now replaced by a no-progress invariant, and native sync lineage batch/merge uses the canonical ready writer while retaining lineage in the shared engine. |
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
ProllyEngine<S: AsyncStore>the sole production owner of ordered-tree algorithmsAsyncProlly<S>and a ready-only synchronous adapter throughProlly<S>NodePublicationcontract across sync, async, remote, wrapper, transaction, and foreign-store boundariesturso-cloud-syncCargo featureArchitecture outcome
ProllyEngine<S: AsyncStore>is now the canonical core.AsyncProlly<S>uses it directly.Prolly<S>uses the same engine throughSyncStoreAsAsync; ready-only means its internal futures must complete on their first poll, not that the facade is read-only.Reads, range traversal, mutations, builders, diff/merge, proofs, order statistics, sessions, manifests/hints, snapshots, garbage collection, transactions, and versioned maps share the async-first services. Stored nodes are validated for CID, format, and structure before cache admission.
Bounded-cache scans now use adaptive admission in that shared engine. A cold scan still admits validated nodes and warms the cache. A scan opened over existing decoded read nodes, or following a non-empty single/batch point read in the same borrowed or owned session, reuses cache hits but does not admit one-pass continuation misses after the seek path. Disabled and unbounded caches retain their existing semantics.
NodePublicationsupplies stable semantic context to every store family. Default implementations preserve the existing batch or combined node-plus-hint behavior. Unknown origins use the conservative general path. The first measured override is Turso: onlyPointUpsertuses deferred transaction acquisition; general publications, named-root compare-and-swap, and coordinated commits remain immediate.Correctness
The publication design and plan are in
docs/superpowers/specs/2026-07-19-point-publication-intent-design.mdanddocs/superpowers/plans/2026-07-19-point-publication-intent.md. The cache design and plan are indocs/superpowers/specs/2026-07-19-scan-resistant-node-cache-design.mdanddocs/superpowers/plans/2026-07-19-scan-resistant-node-cache.md.Latest local performance evidence
The universal-publication comparison uses baseline
a2f4e7a3066d2259783c8d815b45c0461c77b06band engine candidate81357948363fdb51dbc201ae5ba1a7377bb297e0. Later commits contain benchmark tooling, generated evidence, inventory, and documentation.@electric-sql/pglitewas not installed; it is not reported as a passFocused Turso point-publication paired medians:
The worst focused non-target paired median latency change was +4.07%; the worst non-target p95 change was +4.82%.
The broad screen uses five alternating pairs with three samples per revision/pair. Every flagged group was preselected for one complete 20-pair, three-sample confirmation with no early stopping. The authoritative composed result replaces all 25 flagged groups and retains the other 83 screen groups. Its 5 us median and 10 us p95 resolution floors apply only to the broad local-adapter gate, not to focused or foundation acceptance.
Full publication method and artifacts:
performance-results/node-publication-local-adapters-2026-07-19/findings.md.Five-million-record cache re-evaluation
The final rebuilt
prolly_compare --records 5000000 --phase fresh --workload randomrun validated every operation. Compared with the pre-cache-change run:The write result remains inside observed run-to-run variance, point reads remain stable, and the large scan improves materially. Small-cache regression tests directly verify zero scan-driven eviction of primed point paths, including same-session single reads, batch reads, owned sessions, and the native async path.
Scale-run boundary
The earlier async-first scale matrix in
performance-results/sqlite-turso-local-async-first-final-r2-2026-07-18/completed all 10K-through-2M sizes, 432 measurement cells, and 36 fixtures. It remains earlier scale evidence.A new full-scale follow-up for the universal-publication candidate was stopped at the requester's direction after 504 data rows. That partial output is outside the repository and is not used by any completed-result claim or acceptance gate.
Fresh verification
cargo fmt --all -- --checkwasm32-unknown-unknowncheckscargo test --workspace --all-features: 497 core unit tests plus every integration binary passed; one explicitly ignored long stress testcargo test --doc --workspace --all-features: 74 passedStrict binding
check --releaseis not green: the repository-wide contract still contains 2,589 planned mappings. This PR does not claim that broader binding-release backlog is complete.Benchmark boundaries
push(), orpull()were usedScope and integration status
This PR now contains 71 commits through
7a77cbbeagainstmain. The latest cache commits are:200df59b— design adaptive scan-resistant cache admission7a77cbbe— implement and verify bounded scan resistanceThe final publication-evidence commits remain:
bbfcc6fa— harden paired sampling and fixed confirmations98c075fa— refresh the public binding inventory97236b89— record normalized local performance evidenceThe PR is open and currently conflicts with
main. Resolve that integration conflict before review/merge without weakening the correctness gates or reintroducing duplicate algorithm paths.