Keep repeated items within a list when merging properties - #144
Merged
Merged
Conversation
MergeArrayValues collected every list into one HashSet, so it removed duplicates inside a single list as well as across the lists being merged. Because even singleton keys go through it, CombineFrontmatter under the default Conservative strategy turned steps: [mix, wait, mix] into [mix, wait] on a document with nothing to merge. Lists are now appended in order, and an item is dropped only when an earlier list in the same merge already supplied it. Fixes #142 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMqfUfzWj2Gmdz1EqYdnLe
|
This was referenced Sep 27, 2026
This was referenced Sep 28, 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.



Fixes #142
What was wrong
PropertyMerger.MergeArrayValuesput every list into oneHashSet<object>. That removed duplicates across the lists being merged, as intended, but it also removed them within a single list. Every key goes through the merger, singleton groups included, soCombineFrontmatterwith the default Conservative strategy turnedsteps: [mix, wait, mix]into[mix, wait]on a single-block document where nothing was being merged.Change
Lists are now appended in order. An item is dropped only when an earlier list in the same merge already supplied it. Repeats inside one list are always kept. The approach follows the issue's acceptance criteria.
tags: [a, a, c]merged withtag: [b, c, b]givestags: [a, a, c, b, b]:cfromtagis dropped becausetagsalready supplied it.Singleton list keys still take their canonical name, as before (for example
tag→tags). This PR changes only which list items survive.Tests
PropertyMergerTestsgains three tests:MergeSimilarProperties.CombineFrontmatterround-tripssteps: [mix, wait, mix]andscores: [1, 1, 2]from a single block.With the fix reverted, all 3 new tests fail. With the fix, the full suite passes: 156/156.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KMqfUfzWj2Gmdz1EqYdnLe
Generated by Claude Code