Problem
_finalize_summary (episode.py:374-396) re-lists every field of EpisodeSummary by hand just to attach 5 reward-related fields. Any new field added to EpisodeSummary must also be added here, or it gets silently dropped on round-trip.
Proposal
Use dataclasses.replace:
return dataclasses.replace(
summary,
reward=reward,
reward_base=reward_base,
...,
)
Removes the manual field list and the implicit "add it in two places" coupling.
Acceptance criteria
Problem
_finalize_summary(episode.py:374-396) re-lists every field ofEpisodeSummaryby hand just to attach 5 reward-related fields. Any new field added toEpisodeSummarymust also be added here, or it gets silently dropped on round-trip.Proposal
Use
dataclasses.replace:Removes the manual field list and the implicit "add it in two places" coupling.
Acceptance criteria
_finalize_summaryusesdataclasses.replace.