Skip to content

Importer: tolerate duplicated mapping keys like the engine parser does #84

Description

@rebaserHEAD

Found during the quality-floor parity sweep (PR #83): Resources/Maps/Test/test_teg.yml in the Triad corpus fails import with YAMLException: duplicated mapping key (2492:7) (a Battery component carries the same field twice). Pre-existing, not a regression; it is the only import failure in the 435-file corpus.

The engine's YAML parser is last-wins on duplicate keys, js-yaml throws by default. So a file the game happily loads is one GRIMP refuses to open.

What needs doing:

  • Reproduce with a minimal fixture (two duplicate keys in one component; NO game content in the repo).
  • Evaluate json: true in the yaml.load options (js-yaml's duplicate-key compat switch) at the importer entry. Confirm last-wins matches engine behavior.
  • Check round-trip: the raw-line preservation layer keeps the original component text, so byte-exact export of the duplicated lines should survive; the parity sweep decides.
  • Sweep the corpus after: expected result is 0 import-failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions