Skip to content

CombineFrontmatter silently removes repeated items from every list, even when no keys are being merged #142

Description

@matt-edmondson

What's wrong

PropertyMerger groups every key, including singleton groups (PropertyMerger.cs:47-52), and runs each group through MergePropertyGroup. Any list value is routed to MergeArrayValues (line 158). That method collects items into a HashSet<object> (line 175), which drops duplicates within a single list, not just duplicates across the lists being merged.

Failure scenario

Input document, one frontmatter block, no colliding keys:

---
steps: [mix, wait, mix]
scores: [1, 1, 2]
---

With CombineFrontmatter under the default (Conservative) strategy, the output is:

steps: [mix, wait]
scores: [1, 2]

With FrontmatterMergeStrategy.None, both lists are preserved. Ordered lists that can legitimately repeat values (recipe steps, scores, playlists, repeated authors/contributors, and so on) lose data just from normalizing a single-block document. Nothing is being merged, so the user gets no warning.

Suggested fix / acceptance criteria

  • Pass single-key groups through unchanged, since there is nothing to merge.
  • When several keys really are merged, append the lists in order. Drop an item only if it already came from a different source list (or don't dedupe at all). Never dedupe within one list.
  • Tests:
    • A singleton steps: [mix, wait, mix] round-trips unchanged through CombineFrontmatter.
    • Merging tags: [a, a] with tag: [b] keeps both a entries.

Activity

  1. matt-edmondson commented on Sep 27, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions