Blink parity: break outer list opener for nested arrays; gate to 0.6% - #135
Open
TomasVotruba wants to merge 2 commits into
Open
TomasVotruba wants to merge 2 commits into
TomasVotruba wants to merge 2 commits into
Conversation
When ArrayListItemNewline expands a single-line associative array that is the last element of an enclosing list array, it now also puts the list's opener on its own line, matching ECS. Upstream, ArrayOpenerAndCloserNewline expands the nested array with two inserts that shift the list's stored end position, so it treats the list as indexed when placing the opener (but not the earlier-run closer); an already-multiline nested array shifts nothing and is left alone.
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.
Cracks the largest remaining mautic parity cluster. Measured drop: 36 to 25 differing files of 4527 (0.55%), 11 files fixed with zero regressions.
The cluster
A single-line list array whose last element is an associative array:
ECS expands the nested associative array and then also breaks the outer list opener onto its own line:
blink previously broke only the nested array and left the outer opener inline.
Root cause
The outer break is an emergent position-staleness effect in ECS's
ArrayOpenerAndCloserNewlineFixer: expanding the nested associative array shifts the enclosing list's stored end position, so the opener is later evaluated against a stale end that lands inside the nested array (which carries=>), while the closer was evaluated before the shift. Opener breaks, closer does not.The fix
Implemented in
ArrayListItemNewline(it runs first and fully expands the nested array beforeArrayOpenerAndCloserNewlinesees it, so the "was single-line?" signal only exists here). When it expands a pristine single-line associative array that is the last element of an enclosing list (first element not an array, opener not already broken), it also breaks the list's opener. An already-multiline inner array takes a different branch and the outer is left alone, matching ECS.Gate
MAX_DIFF_PERCENTlowered 0.8 to 0.6; actual is 0.55% (25 of 4527).Unit tests cover the outer-opener break and the already-multiline no-break case. Full blink suite, go vet and golangci-lint green; strict rector-src 1:1 gate stays 0-diff.