Retire exercise_status: maturity is the only notion; add CLI tests (RBT-WP-0009-T01)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 295952@bnt-lap001 Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
parent
b89e8eaa74
commit
6d3414d8b7
29 changed files with 444 additions and 218 deletions
|
|
@ -60,6 +60,14 @@ def pass_gate(r, gid):
|
|||
R.gate_check(r, gid, i, confirm=True, manual_ok=True)
|
||||
|
||||
|
||||
def counts_towards_maturity(r) -> bool:
|
||||
"""Would this run be clean maturity evidence? (succeeded, no deviation, with an environment)"""
|
||||
from rtut import maturity as M
|
||||
r.data["outcome"] = "succeeded"
|
||||
r.data["context"] = {"project": "p", "environment": "rehearsal"}
|
||||
return M._evidence(r.pack, r.data.get("pack_digest"), [r])["clean_runs"] == 1
|
||||
|
||||
|
||||
# ---- datapoints -----------------------------------------------------------------------------------
|
||||
|
||||
def test_create_sets_datapoint_states(tmp_path):
|
||||
|
|
@ -165,15 +173,11 @@ def test_waiver_only_where_declared_with_reason_and_recorded(tmp_path):
|
|||
R.waive(r, "night-on-record", "try")
|
||||
|
||||
|
||||
def test_deviations_block_exercise_but_not_finalize(tmp_path):
|
||||
def test_deviations_keep_a_run_out_of_maturity(tmp_path):
|
||||
r = new(tmp_path)
|
||||
R.start(r, "warn", alt="sound-horn", override_reason="probe", acknowledge_risk=True)
|
||||
r.data["steps"]["warn"]["state"] = "failed"
|
||||
assert r.data["deviations"]
|
||||
with pytest.raises(R1.RunError, match="deviations"):
|
||||
for k in r.data["steps"]:
|
||||
r.data["steps"][k]["state"] = "done"
|
||||
R1.exercise_update(r)
|
||||
assert r.data["deviations"] and not counts_towards_maturity(r)
|
||||
assert counts_towards_maturity(new(tmp_path)) # the same without a deviation would count
|
||||
|
||||
|
||||
# ---- confirmation styles ------------------------------------------------------------------------------
|
||||
|
|
@ -264,10 +268,7 @@ def test_auto_confirm_push_through_records_deviation_and_moves_on(tmp_path):
|
|||
assert dev["kind"] == "push-through" and dev["mode"] == "auto-confirm" and dev["risk_acknowledged"] is False
|
||||
nxt = R.auto_confirm_tick(r, late) # continues to the manual-only step
|
||||
assert nxt["item"] == "close-log" and nxt["action"] == "awaiting-operator"
|
||||
with pytest.raises(R1.RunError, match="deviations"):
|
||||
for k in r.data["steps"]:
|
||||
r.data["steps"][k]["state"] = "done"
|
||||
R1.exercise_update(r)
|
||||
assert not counts_towards_maturity(r) # a pushed-through run is not evidence
|
||||
|
||||
|
||||
def test_auto_confirm_gate_push_through_and_stop(tmp_path):
|
||||
|
|
@ -460,8 +461,4 @@ def test_a_run_that_changed_a_used_value_never_counts_towards_maturity(tmp_path)
|
|||
r = new(tmp_path)
|
||||
do_step(r, "read-the-sky")
|
||||
R.set_datapoint(r, "weather", "clear", override_reason="changed my mind", acknowledge_risk=True)
|
||||
assert r.data["deviations"]
|
||||
with pytest.raises(R1.RunError, match="deviations"):
|
||||
for k in r.data["steps"]:
|
||||
r.data["steps"][k]["state"] = "done"
|
||||
R1.exercise_update(r)
|
||||
assert r.data["deviations"] and not counts_towards_maturity(r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue