Record a step result into both the live context and persistent state. ``record_step_result`` writes ``state.step_results`` under the run lock. On a resume run ``context.steps`` *is* that same dict, so that locked write is the only one needed; mirror into ``context.steps`` se
(
context: StepContext, state: RunState, step_id: str, data: dict[str, Any]
)
| 779 | |
| 780 | @staticmethod |
| 781 | def _record_result( |
| 782 | context: StepContext, state: RunState, step_id: str, data: dict[str, Any] |
| 783 | ) -> None: |
| 784 | """Record a step result into both the live context and persistent state. |
| 785 | |
| 786 | ``record_step_result`` writes ``state.step_results`` under the run lock. |
| 787 | On a resume run ``context.steps`` *is* that same dict, so that locked |
| 788 | write is the only one needed; mirror into ``context.steps`` separately |
| 789 | only when it is a distinct object (a fresh run), to avoid an unlocked |
| 790 | mutation of the shared dict that could race a concurrent ``save()``. |
| 791 | """ |
| 792 | if context.steps is not state.step_results: |
| 793 | context.steps[step_id] = data |
| 794 | state.record_step_result(step_id, data) |
| 795 | |
| 796 | def _execute_steps( |
| 797 | self, |
no test coverage detected