Merge keys that normalize alike under one name instead of swapping them [patch] - #165
Merged
Merged
Conversation
…em [patch] FindBasicCanonicalName mapped each key in a normalize-alike class to another key in the class, so related went to page_related and page_related to related. Aggressive and Maximum then wrote each value under the other key's name and merged nothing. Every key in the class now maps to one name, chosen independently of key order: a known property first, then the shortest key, then ordinally. The partial-match pass picks between a pair the same way, Maximum no longer moves the chosen key elsewhere, and a key left alone in its group keeps its own name rather than taking another key's. Fixes #131 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015BJVibRvmTotkqEGp3695R
|
This was referenced Sep 29, 2026
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.



Under Aggressive and Maximum merging, keys that normalize alike now merge.
related: [a]andpage_related: [b]become a singlerelatedholding both lists. Before this, each value was written under the other key's name and nothing was merged.Cause
FindBasicCanonicalNamemapped each key to another key in its equivalence class, sorelatedwent topage_relatedandpage_relatedwent torelated.MergeSimilarPropertiesthen saw two one-key groups, andMergeArrayValueswrote each list under the other key's name.Change
keywordsis still standardized when no other key is involved.Tests
EquivalentKeyMergeTestsadds nine cases:the list case and the scalar case, under Aggressive and Maximum, with the keys in both orders;
the issue's end-to-end input through
CombineFrontmatter(..., AsIs, AsIs, Aggressive).Without the fix: all nine fail. I checked by reverting
PropertyMerger.cs.With the fix: all pass, and so does the full suite (206 tests).
Fixes #131
🤖 Generated with Claude Code
https://claude.ai/code/session_015BJVibRvmTotkqEGp3695R
Generated by Claude Code