Simplify rename pairing and index scoping - #6150
Merged
ilyakuz-db merged 1 commit intoAug 3, 2026
Merged
Conversation
ilyakuz-db
force-pushed
the
configsync/split-list-write-back-simplify
branch
from
August 3, 2026 17:21
c70f16e to
6f09c49
Compare
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.
Cleanup pass on top of #6138, kept separate so the changes are reviewable on their own. Behaviour-preserving: no golden files change, all 22
config-remote-syncacceptance directories pass unchanged.Changes
Resolve the removed element once per rename candidate.
sameElementApartFromKey,sameFieldsApartFromKeyandmultiBlockElementeach re-ranresolveSelectorson the same remove path and re-did the sameAsAny().(map[string]any)cast andwithoutKeystrip. They now take the already-strippedoldFieldsmap, resolved once per remove inpairRenames. Drops three near-identical resolve-and-cast preambles and the O(removes x adds) re-resolution — a run renaming N elements went from ~3N tree walks to N.scopedParenthelper for index bookkeeping.scope + resolvedPath.Parent().String()was spelled out at four call sites inResolveChangesplusadjustArrayIndex. Forgetting that prefix is exactly the cross-block index-shift bug the parent PR fixes, so it is now one named function rather than a string concat to remember.blocksDefiningSequence: drop the O(n^2) dedup. The loop iteratedsortedBlocks()(already distinct by map key) while re-checking!slices.Contains(blocks, block)on every matching location, so a block could never be appended twice anyway. Replaced with a singleslices.ContainsFuncover the locations.Tests
Ran the full
config-remote-syncacceptance suite plus the package unit tests;./task lint-qreports 0 Go issues.