Active user attribute set, latest activities, guarded changes to used values, artefact links, durations and averages; irreversible showcase step
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 3s
Work Records / validate (push) Has been cancelled

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:
tegwick 2026-09-29 15:50:56 +02:00
parent 6716cee921
commit 8d62c1fbe8
22 changed files with 1025 additions and 35 deletions

View file

@ -426,3 +426,42 @@ def test_captures_and_pasted_verification_work_for_v02_runs(tmp_path):
R1.add_capture(r, "read-the-sky", "Weather tonight - fog.", "echo ...")
res = R1.verify_pasted(r, "read-the-sky", "Weather tonight - fog.")
assert res["passed"] and r.data["steps"]["read-the-sky"]["captures"][0]["output"].startswith("Weather")
# ---- changing datapoints after steps used them ------------------------------------------------------------------------
def test_changing_an_unused_datapoint_is_free_and_a_used_one_is_a_recorded_deviation(tmp_path):
r = new(tmp_path, values={"weather": "fog"})
assert R.set_datapoint(r, "weather", "clear") == "set" and r.data["deviations"] == [] # nobody used it yet
do_step(r, "read-the-sky") # uses weather
assert R.datapoint_users(r, "weather") == ["read-the-sky"]
with pytest.raises(R.RunError, match="already used by read-the-sky"):
R.set_datapoint(r, "weather", "storm")
with pytest.raises(R.RunError, match="acknowledge"):
R.set_datapoint(r, "weather", "storm", override_reason="the forecast changed")
assert r.data["params"]["weather"] == "clear" # refused: nothing changed
R.set_datapoint(r, "weather", "storm", override_reason="the forecast changed", acknowledge_risk=True)
assert r.data["params"]["weather"] == "storm"
dev = r.data["deviations"][0]
assert dev["kind"] == "changed-after-use" and dev["item"] == "weather" and "read-the-sky" in dev["unmet"][0] and "'clear'" in dev["unmet"][0]
assert dev["reason"] == "the forecast changed" and dev["risk_acknowledged"] is True
assert R.set_datapoint(r, "weather", "storm") == "set" and len(r.data["deviations"]) == 1 # the same value is not a change
def test_used_datapoints_cannot_be_changed_in_auto_confirm_mode(tmp_path):
r = new(tmp_path, mode="auto-confirm")
R.auto_confirm_tick(r); R.auto_confirm_tick(r)
r.data["steps"]["read-the-sky"]["state"] = "done"
with pytest.raises(R.RunError, match="take over"):
R.set_datapoint(r, "weather", "clear", override_reason="x", acknowledge_risk=True)
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)