Skip to content

Roster-level costs drop cost types only reachable via entryLinks #310

Description

@amis92

Summary

Roster-level costs in the engine's mapped state omit any cost type whose only references come from entries reached via entryLink. Discovered by muster golden-roster fixtures against real BSData/wh40k-11e data: a Necrons roster with a linked Detachment shows correct selection-level costs but an incomplete roster-level total set.

Mechanism (code-verified on feat/yaml-reader @ c980b14; also present on main)

  1. EntryResolver.AddEntryOrFlatten (src/WarHub.ArmouryModel.RosterEngine/EntryResolver.cs:~182, non-group branch) stores Symbol = entry — the link container — instead of the resolved target entry.
  2. StateMapper.CollectReferencedCostTypes (RosterEngine.Spec/StateMapper.cs:~416-429) walks symbol.Costs on those stored symbols; the link container has no costs, so the cost type is never marked referenced.
  3. StateMapper.ComputeRosterCosts (~324-347) gates roster-cost emission on referencedCostTypeIds.Contains(...) → the cost type is dropped from roster totals.

Expected vs actual

  • Expected: roster costs include every cost type referenced by any resolved selection (e.g. pts totals from linked entries).
  • Actual: cost types referenced only through entryLinked entries are absent from roster-level costs (selection-level values are correct).

Fix options

a. Store the resolved target symbol (resolved) in AddEntryOrFlatten's non-group branch, or
b. Make CollectReferencedCostTypes traverse through link symbols to their targets.

Repro fixture: BSData/wh40k-11e branch amis92:muster-fixtures, tests/rosters/necrons-single-unit-cost.yaml (assertion moved to selection level as a workaround; see file comment).

🤖 Generated with Claude Code

https://claude.ai/code/session_01KcYK8hmTmXi8eLWpg9LGKJ

Metadata

Metadata

Assignees

No one assigned

    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