Skip to content

stack/09 yaml reader - #325

Merged
amis92 merged 9 commits into
mainfrom
stack/09-yaml-reader
Jul 31, 2026
Merged

stack/09 yaml reader#325
amis92 merged 9 commits into
mainfrom
stack/09-yaml-reader

Conversation

@amis92

@amis92 amis92 commented Jul 31, 2026

Copy link
Copy Markdown
Member

Stack created with GitHub Stacks CLIGive Feedback 💬

@amis92
amis92 force-pushed the stack/09-yaml-reader branch from 4682b52 to 0486c31 Compare July 31, 2026 05:34
Base automatically changed from stack/08-spec-conformance to main July 31, 2026 05:40
@amis92
amis92 force-pushed the stack/09-yaml-reader branch from 0486c31 to edae468 Compare July 31, 2026 05:40
amis92 and others added 9 commits July 31, 2026 07:41
Adds WarHub.ArmouryModel.Source.Yaml with YamlBattleScribeReader.ReadSourceNode
and YamlToXmlConverter, converting a YAML representation model into the XML
shape expected by the existing BattleScribe deserializer. Covered by a single
TDD test parsing a minimal gameSystem YAML document into a GamesystemNode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…eader

Address code review findings on the YAML-to-XML converter: unguarded YAML
node casts now throw YamlBattleScribeFormatException naming the offending
key instead of raw InvalidCastException; invalid XML attribute/element
names (spaces, colons like xml:lang) now throw the same instead of raw
XmlException; scalar keys that are XML child text elements per the XSD
(comment, description, customNotes, readme) are now emitted as child
elements instead of attributes, fixing silent data loss on deserialize;
removed a fabricated "associations" collection mapping with no XSD/model
backing; dropped the unused FluentAssertions test dependency; sharpened
the raw-string round-trip test with an unquoted ambiguous scalar; and
noted that multi-document YAML streams are intentionally unsupported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…, strict mode)

Add two new test cases to YamlBattleScribeReaderTests:
- ReadSourceNode_preserves_modifiers_costs_constraints_and_text: validates
  that a real-world catalogue fragment with modifiers, conditionGroups,
  costs, constraints, profiles with $text characteristics, and comment
  are all correctly parsed and preserved.
- ReadSourceNode_throws_on_unknown_collection_key: verifies that the
  reader strictly validates collection keys and throws
  YamlBattleScribeFormatException for unknown collections.

Both tests pass; all 6 tests in the suite pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KcYK8hmTmXi8eLWpg9LGKJ
- Add StringComparison.Ordinal to Assert.Contains calls at lines 169 and 189
- Add missing assertions for condition group Type, constraint properties (Field, Value, Id), and entry Comment

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KcYK8hmTmXi8eLWpg9LGKJ
Add Wh40kDataIntegrationTests, a theory over every *.yaml file in
WH40K11E_DATA (wh40k-11e on branch json-to-yaml), plus a sanity check that
the loaded root has a non-empty Name and at least one populated child
collection (catches loads that "succeed" but are structurally hollow due
to a scalar key that silently missed the attribute/TextElementNames
paths).

Extend YamlToXmlConverter to handle two real-data collection keys absent
from Catalogue.xsd: `associations` -> `association` (a documented
NewRecruit extension, object-shaped items, added to ItemElementNames) and
`alias` (a scalar-list Rule extension with no XSD precedent, handled via
a new RepeatedTextElementNames mechanism since its items aren't mappings).

Also extend ModifierKind (replace, ceil, floor) and ConditionGroupKind
(count) - real-data enum literals missing from wham's hand-written enums
and from the bundled (stale) Catalogue.xsd. Purely additive, no
exhaustive switches over these enums exist within this build's dependency
graph.

All 47 wh40k-11e files load successfully; largest file (Imperium - Space
Marines.yaml, 4.4 MB) loads in ~372ms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds SetupFromFiles to SpecRosterEngineAdapter so specs/fixtures can drive the
wham roster engine from real .cat/.gst (XML) or .yaml data files instead of
inline protocol data, using YamlBattleScribeReader for YAML and
DeserializeSourceNodeAuto for XML. Mirrors Setup's post-compilation wiring
(_catalogCompilation, _coreEngine, _state) exactly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…taSource)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…upFromFiles parse errors

Every_wh40k11e_file_loads now uses [Theory(SkipTestWithoutData = true)]
so a clean CI run without WH40K11E_DATA skips the integration cases
instead of hard-failing on empty MemberData.

SpecRosterEngineAdapter.SetupFromFiles wraps per-file parsing so any
parse failure (YAML or XML) is rethrown as an InvalidOperationException
naming the offending file, with the original exception preserved as
InnerException. Adds a regression test asserting the second (malformed)
file's name appears in the thrown message.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Picks up the New Recruit console host + public Docker image publishing
work (feat/muster-support), needed by Muster's engine adapter chain.
@amis92
amis92 force-pushed the stack/09-yaml-reader branch from edae468 to a0e3cbb Compare July 31, 2026 05:41
@amis92
amis92 merged commit 0487205 into main Jul 31, 2026
2 checks passed
@amis92
amis92 deleted the stack/09-yaml-reader branch July 31, 2026 05:49
amis92 added a commit that referenced this pull request Jul 31, 2026
`[Unreleased]` had been empty since 0.14.0 (28 Feb) even though several
changes had landed. Brings it up to date with everything currently on `main`:

- the roster-engine stack (#315-#322) and the YAML reader (#325)
- the NewRecruit format additions (#308) and the MSBuild targets file (#313)
- the zipped-datafile fix (#324) and the dependency bump (#327)
- the `prepend` documentation and tests (#326), crediting @The4D6 for the
  original contribution in #221

The `NodeFactory.Force` breaking change is called out explicitly with the
migration, since it lands in the shipped `WarHub.ArmouryModel.Source` package.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant