perf: sort interactions at TanStack-beating latency, end to end (#457) - #479
Merged
Conversation
…build) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nt for #467 sortAuthority) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… changes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ueries A sort-only query change on an ungrouped model now bypasses the cooperative transition entirely: setQuery cancels any in-flight transition as superseded, rebuilds the root synchronously via rebuildRootForSortOnlyChange, and publishes with the same recipe as runTransitionSlice's completion block. Errors mirror failTransition's observable semantics (error status carrying the transition id, rejected finished, committed root untouched), including the reentrant-mutation mapping. Pre-existing tests updated for the deliberate behavior change (each asserted that a sort-only setQuery schedules cooperative work, but its subject is the cooperative machinery, so the query now changes a filter too — or, for the properties oracle, accounts the synchronous commit): - properties.test.ts "matches a fresh final model after superseded query catch-up": the revision oracle now accounts a sort-only first/second query committing synchronously before the concurrent mutations run. - retention.test.ts (3 tests): scheduler-ownership subjects; queries gain a filter change to stay on the cooperative path. - transitions.test.ts delta-journal + hostile-cancellation + 3 catch-up tests: same treatment; the supersede-between-removal-and-insertion test's replacement stays sort-only and now pins fast-path supersession of a mid-catch-up transition. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s are synchronous now (#457) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…identity Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…fail-closed pin Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…re-ingesting Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ild synchronously Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Vercel preview readyPreview: https://pretable-a8ib39q95-cacheplane.vercel.app Updated automatically by the |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #457. Three design cycles on one branch, each specced and measured (specs and plans under
docs/superpowers/).What this delivers, measured (S2 bench, like-for-like, same-run TanStack control)
partial ×3(never settles)completed ×3How, per cycle
Cycle 1 — synchronous sort fast path (row-model). A conservative query-delta classifier routes a sort-only
setQueryon ungrouped data to a synchronous rebuild: no cooperative slices (browser-measured: scheduler hops cost frames), O(n) balanced bulk tree construction from sorted entries. Error/supersede semantics mirror the cooperative path observable-for-observable.Cycle 2 — sort keys move to the plan; the journal learns "order-only".
CompiledRowMetadatalostsortKeys; each compiled plan owns a WeakMap sort-key store, so a sort-only change carries records and the rows HAMT by identity (rebuilding them was 86% of the transition cost). The change journal gained reset reason"reorder"(fail-closed for unaware consumers), layout-core gained a synchronousRowHeightIndex.reorder()over existing measurements, and the row-layout controller takes a permutation path instead of re-ingesting 50k rows.Cycle 3 — decorated entries + bulk mount. Tree entries carry their resolved sort keys (
{record, keys}) so comparisons are property reads — this recovered the grouped gate regression that per-comparison WeakMap resolution had introduced, and improved every comparator-hot path (hence the filter gains). Replacements over unmeasured bases (true mounts) build synchronously in one O(n) pass, eliminating the blank-mount window and the sort-during-ingest race; a reorder arriving mid-replacement now composes at finish instead of forcing a full re-ingest.Verification
pnpm apidrift-free (public surface change: the reset-reason union gains"reorder", core+react reports regenerated).reorderFallbackCount 0, no re-ingest frames) and the mount publishes in the activation pass.docs/superpowers/specs/*2026-08-1{7,8}*reference the scratchpad protocol; cycle-by-cycle numbers in the PR conversation on request.Merge checklist
pnpm bench:row-model:gate×3 ≤ 8ms — strong evidence already: min 7.8ms under load 12–16, better than the pre-branch best; the machine had no quiet window during final verification)🤖 Generated with Claude Code