Repository navigation
Conversation
…ext/Prev, Verify ref copy - Cursor.Upsert's in-place path kept the old key when the new one compared equal and reported the new key as PrevKey; it now replaces the key and reports the real previous one. Tested with keys compared by id and an augmentation that depends on the key. - The interval augmentation started from the zero endpoint as its bound: wrong for negative endpoints and a panic for comparators that cannot take the zero value. subtreeBound now has an explicit unset state and findUpperBound reports emptiness. Tested with pointer endpoints and negative spans in the property test. - interval.Iterator.Next and Prev end an overlap scan, as the seeks do. - Verify copies only the fields the Updater reads instead of the whole node, whose reference count another goroutine may be changing atomically. A race test verifies a snapshot while the original is cloned, written and cleared. - SeekWhere's documented contract now matches its single-descent algorithm: the predicate must be exact for spans. The aug package doc states that maps must not be copied by value and that keys, values and augmentations are shallow-copied. Each new test fails on v0.2.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ints and TieBreak, config copy, Verify equality - A split, merge or rebalance recomputes the restructured node and reports a change upward, so shape-dependent augmentations (node counts, heights) stay correct, including the merge caused by deleting an absent key. Tested with a node-counting Updater; on v0.2.0 the reviewer's degree-2 example leaves the root at 3 instead of 4. - Reference counts are int64. - An interval whose end is not after its start is a point, so leaf matching and subtree pruning agree wherever it sits; reversed intervals are points too. Tested alone in a leaf, after many splits, and reversed. - interval.Bounds.TieBreak replaces CompareIntervals and is consulted only for equal start keys, since overlap searches require start order. Tested with a tie-breaker preferring ends. - LowLevelIterator.Config returns a copy. - Verify compares augmentations with the Updater's Equal when it implements Equaler; MonoidUpdater forwards the Monoid's. Tested with a NaN-propagating maximum. - interval.Cursor, FreeList and NewFreeList are nameable; the package documents its overlap cost honestly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 of 4 tasks
Owner
Author
|
Folded into #5, which contains these commits and the API pass on top. |
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
Fixes for both rounds of review findings on
v0.2.0. Each behavioural fix has a test; the ones that could be run againstv0.2.0in a worktree fail there.Round one
Cursor.Upsertwith a distinct but equal key replaced only the value and reported the new key asPrevKey. Fixed; tested with id-compared keys and a key-dependent aggregate.Next/Prevon an interval iterator now end an overlap scan.Verifycopied the atomic reference count non-atomically. It copies only what the Updater reads; a race test verifies a snapshot during clone-and-clear.SeekWherecontract tightened to what the single descent needs; ownership docs for value copies and shallow-copied keys, values and augmentations.Round two
Updaterdoc states the contract. Onv0.2.0the reviewer's degree-2 example leaves the root count at 3 instead of 4.Bounds.TieBreakreplacesCompareIntervalsand is consulted only for equal starts, since overlap searches require start order. Breaking change.LowLevelIterator.Configreturns a copy.Verifyuses the Updater'sEqualerwhen present (NaN-safe aggregates).interval.Cursor,interval.FreeList,interval.NewFreeListare nameable; the overlap cost is documented as O(log n) plus the ancestors of the k matches, up to O(k log(n/k)) when scattered.Test plan
go test -race ./...on Go 1.26.8 and 1.27.1v0.2.0: cursor equal-key, pointer endpoints, overlap-after-step, Verify race and structural augmentation all fail there as expected🤖 Generated with Claude Code