coerce_goal_status(
value: object,
) -> GoalStatus | None| Name | Type | Description |
|---|---|---|
value* | object | Raw value read from checkpoint state. |
Narrow a persisted goal-status value to a known GoalStatus.
A corrupt or forward-version checkpoint can carry an unexpected status
string (or a non-string). Coercing to None rather than passing the raw
value through keeps the GoalStatus Literal load-bearing on the read
path, so an unknown status is treated as "no goal status" instead of a
silently active goal. Resume/restore callers should log the discard separately
so it is surfaced rather than dropped.
The goal-state notice path does not use this helper: project_goal_state
normalizes separately, to keep goal_state_notice off this module's heavy
import chain. It fails closed the same way, degrading an unrecognized status
to paused so the notice cannot present a corrupt status as an actionable
goal, and logging the discard. Both read the vocabulary from
GOAL_STATUS_VALUES in goal_state_limits, so adding a member cannot make it
actionable in one place and unknown in the other.