src.dackar.outage.policy¶
Shared regulatory / LCO decision policy for the outage pipeline.
Stage F (option feasibility) and Stage G (decision status) both reason about the
LCO action-level clock and regulatory constraints. Previously each stage kept
its own copy of the relevant LCO-status sets, and the two drifted — the cause of
the unknown → DEFER gap (an undetermined clock was treated as safe in Stage
F but unsafe in Stage G). This module is the single source of truth for that
policy so the two stages cannot disagree.
- LCO clock status vocabulary (produced by Stage A
lco_clock_status): not_applicable no LCO in effect. normal clock running, deadline beyond the current shift (known). urgent clock running, action needed this shift. critical clock running, immediate action required. expired action-level deadline already passed. unknown clock running but the deadline was NOT supplied.
Two distinct policy questions, two distinct sets:
LCO_ACTIVE_STATUSES — the clock is actively running, so deferring the work out of this outage is NOT feasible. Includes
normal(a known future deadline still forbids deferral) andunknown(running clock, treat as unsafe).LCO_FAIL_CLOSED_STATUSES — the decision must fail closed: no PROCEED or MONITOR, escalate for review instead. Excludes
normal(a known, non-imminent deadline does not by itself force escalation) but includesunknown(an undetermined deadline is treated as unsafe).
unknown is deliberately in BOTH: a running clock with no supplied deadline
is the conservative/unsafe case for either question.
Attributes¶
Functions¶
|
Return the normalised (lower-case) lco_clock_status, or '' when absent. |
|
True when the LCO clock is running (deferral not feasible). |
|
True when the decision must fail closed (escalate, never PROCEED/MONITOR). |
|
Return a machine code naming WHY a decision escalated. |
|
Map an escalation_reason code to a human-readable clause. |
Module Contents¶
- src.dackar.outage.policy.lco_status(intake_result)[source]¶
Return the normalised (lower-case) lco_clock_status, or ‘’ when absent.
- Parameters:
intake_result (Mapping[str, Any])
- Return type:
str
- src.dackar.outage.policy.is_lco_active(intake_result)[source]¶
True when the LCO clock is running (deferral not feasible).
- Parameters:
intake_result (Mapping[str, Any])
- Return type:
bool
- src.dackar.outage.policy.is_fail_closed(intake_result, schedule_impact=None)[source]¶
True when the decision must fail closed (escalate, never PROCEED/MONITOR).
- Fail-closed conditions:
the LCO action-level clock is in a fail-closed status (expired/critical/urgent/unknown), OR
any regulatory constraint is present, OR
critical-path impact could not be computed (Stage E set
cp_impact.cp_impact_unavailablebecause the duration was unknown) — “couldn’t compute CP impact” must not read as “no CP impact”.
- Parameters:
intake_result (Mapping[str, Any])
schedule_impact (Optional[Mapping[str, Any]])
- Return type:
bool
- src.dackar.outage.policy.escalation_reason(intake_result, schedule_impact=None, *, option_type=None, cp_drag_hours=None, cp_escalate_threshold_hours=None, no_options=False)[source]¶
Return a machine code naming WHY a decision escalated.
Checked in the same priority order the decision uses, so the executive summary can state the actual cause instead of always blaming CP drag:
no_options | regulatory_constraint | lco_clock_<status> | cp_impact_unavailable | cp_drag_threshold | escalate_option | unknown
- Parameters:
intake_result (Mapping[str, Any])
schedule_impact (Optional[Mapping[str, Any]])
option_type (Optional[str])
cp_drag_hours (Optional[float])
cp_escalate_threshold_hours (Optional[float])
no_options (bool)
- Return type:
str