Fix matching updates (#26)#27
Closed
brainiac-five wants to merge 1 commit intomasterfrom
Closed
Conversation
* fix: matching updates (#26) * add: matching KVS update tests
f529138 to
7b7269b
Compare
|
Force push fixed test prompts (deleted " - ok" / " - returns error" from |
This was referenced Feb 27, 2026
Collaborator
Author
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.
fix: matching updates (Save Error after Repeat Put #26)
add: matching KVS update tests
Explanation of the Fix
An update that is an exact key-and-value match with an existing node should return that existing node rather than
nil, because the return value fromupdate()is (across some nesting update functions across class layers) expected to be the new node (that in this special case is an old node) and assigned topm.ninSwarmPot.Update()inmode.goproximity-order-trie/pkg/elements/mode.go
Line 132 in 4c39490
and to
rootinIndex.Update()inindex.goproximity-order-trie/index.go
Line 101 in 4c39490
Imperfection of this PR
In hindsight this PR should probably better add tests to
index_test.goinstead ofkvs_test.gobut the tests added tokvs_test.gotrack how the bug was found (and reported in #26 / branchissue/26); and because of where the fix is (inpkg/elements/ops.go), the issue would appear to get tested equally well for regression in either suite.Regarding Added Tests
Three of the tests that are being added by this PR were failing without the fix. See branch
issue/26. But not all of them, because they were made to help pinpoint the exact picture of the bug, including what works although it looks similar to the failing scenarios. See issue #26.