test(governed): align reopen fake CAS with expected_revision contract (V2R2C2 hot-fix)
autonomy-smoke-tests pr82 PASS evidence_sha256=c16c68f86ee0c4e8cfd0af3f76078be45441ee151395fbde5800145c08e189b5
autonomy-unit-tests pr82 PASS evidence_sha256=168bb88573b44876966c64ec2dc2b9e030fc7635ca0b18538678f1c492c97ea2
campaign-approval-gate pr82 PASS evidence_sha256=0616d6aa11496391686dcbd658123e51d8d057e1f02661af7ef8512554e404d8
git-diff-check pr82 PASS evidence_sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
py-compile pr82 PASS evidence_sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
reconciliation-contract pr82 PASS evidence_sha256=8250e3e736db14432c421c46f995c201540e2b9c50958bdeb3ef7b057c4fd577
release-state-machine pr82 PASS evidence_sha256=b6c51b401d65a9c69435f8b86cecab752d65ded7188228aab3de3eb010990b60
secret-scan pr82 PASS evidence_sha256=f8ed9052d5ba0fbe8e52f171ea180fa353a89b4049cd3e1ed881736d0622c752
signer-validator-contract pr82 PASS evidence_sha256=775b7aa27d0c17f48b3feff20c836f14b6ed8ebcb90ec7e0b76d2a13c579268a
aios.owner-final-merge-authorization-v2 real v2 contract tests passed

This commit was merged in pull request #82.
This commit is contained in:
2026-09-12 15:29:18 +08:00
parent 5a4e952b39
commit beabd05396
+2 -1
View File
@@ -15,9 +15,10 @@ NOW=datetime(2026,9,12,3,10,tzinfo=timezone.utc)
class Sagas:
def __init__(self, root): self.root=root
def compare_and_set(self, candidate_id, *, expected_states, target, event, details):
def compare_and_set(self, candidate_id, *, expected_states, target, event, details, expected_revision):
p=self.root/"sagas"/f"{candidate_id}.json"; x=json.loads(p.read_text())
if x["state"] not in expected_states: raise RuntimeError("CAS")
if int(x.get("revision",0)) != expected_revision: raise RuntimeError("SagaConflict")
x["state"]=target; x["revision"]=int(x.get("revision",0))+1
x.setdefault("events",[]).append({"event":event,"details":details,"timestamp":"2026-09-12T03:10:00Z"})
p.write_text(json.dumps(x,sort_keys=True)); return x