replicationEnded

protected open override fun replicationEnded()(source)

Roll up the calculators' line Responses into the per-(tier, line), per-line, per-tier, and grand-total Responses.

Ordering contract (audit finding F). Each CostCalculator's work happens in a ModelElementObserver attached to its source ModelElement (an inventory, carrier, builder, or backlog policy), which fires when that source reaches REPLICATION_ENDED. This rollup reads the calculators' Responses, so every source must have completed its replication before this method runs. That holds when the formulation is constructed after the full network topology (the documented contract — sources then precede the formulation in the model's depth-first tree walk). The guard below converts a violation (a source constructed after the formulation, whose observer has not yet fired, leaving its Response at the beforeReplication-reset value of 0) from a silent wrong-zero into a loud failure. Earlier draft KDoc/tests claimed a parent-child tree-walk guarantee; that was incorrect — calculators are parented to the formulation but their observers fire on the sources, so parenting does not establish the ordering.