carlos / platform Public

region HA P3b-2 ops: operator-chosen roll transaction id

roll --transaction lets the operator choose the transaction id, so the
fault harness can be armed with it before the roll (R10). Default
behaviour is unchanged; a reused or probe- id refuses before any AWS call.
claude agent, operated by paul@keymail.dev 23afd621d8922cf3da4f5a660fd39b860e68a826 parent 8603b49
5 files changed, +161 −20
  • docs/superpowers/notes/2026-11-05-region-ha-p3b2-operator.md +6 −1
  • docs/superpowers/notes/2026-11-05-region-ha-p3b2-standby-witness.md +24 −14
  • scripts/region-group-fault/README.md +26 −1
  • scripts/region-group-roll.py +16 −4
  • scripts/region_group_roll_test.py +89 −0

CI failed — run details

diff --git a/docs/superpowers/notes/2026-11-05-region-ha-p3b2-operator.md b/docs/superpowers/notes/2026-11-05-region-ha-p3b2-operator.md
index c99ebaf17..ae1e3d661 100644
--- a/docs/superpowers/notes/2026-11-05-region-ha-p3b2-operator.md
+++ b/docs/superpowers/notes/2026-11-05-region-ha-p3b2-operator.md
@@ -18,13 +18,18 @@ provider observation that must pass before the first roll.
python3 scripts/region-group-roll.py --config '<config.json>' plan \
--member '<iid-a>' --to-sha256 '<new-artifact-sha256>'
python3 scripts/region-group-roll.py --config '<config.json>' roll \
- --member '<iid-a>' --to-sha256 '<new-artifact-sha256>'
+ --member '<iid-a>' --to-sha256 '<new-artifact-sha256>' --transaction '<transaction>'
python3 scripts/region-group-roll.py --config '<config.json>' status \
--transaction '<transaction>'
python3 scripts/region-group-roll.py --config '<config.json>' resume \
--transaction '<transaction>'
```
+Use optional `roll --transaction` to choose an unused ID before arming the fault
+harness, so its marker matches the roll's permit. IDs use 1 to 80 ASCII letters,
+digits, underscores or hyphens and cannot start with `probe-`; an existing
+journal refuses reuse even after completion. Omit the flag to generate a UUID.
+
`plan` reads cloud state and root status and saves a local inspection log.
It does not prepare an artifact or change the group or box. A clean plan is
not signature verification: `roll` performs that preparation before lowering
diff --git a/docs/superpowers/notes/2026-11-05-region-ha-p3b2-standby-witness.md b/docs/superpowers/notes/2026-11-05-region-ha-p3b2-standby-witness.md
index aefada81b..d07426551 100644
--- a/docs/superpowers/notes/2026-11-05-region-ha-p3b2-standby-witness.md
+++ b/docs/superpowers/notes/2026-11-05-region-ha-p3b2-standby-witness.md
@@ -257,22 +257,32 @@ expiry and removal readbacks. Rehearse expiry before the disruptive roll.
The service needs no network, session or edge process; it never restarts or
terminates a member. Do not reboot during this witness.
-Arm the one-shot with `arm-fault` before the attended roll, using the selected
-iid, boot ID and the exact roll transaction:
+Choose an unused transaction ID, arm the one-shot through the client, then pass
+the same ID to the attended roll. The client invokes `fault.sh arm-fault` through
+the approved document. Read back the marker before starting the roll:
```sh
+tx="roll-$(python3 -c 'import uuid; print(uuid.uuid4().hex)')"
python3 scripts/region-group-fault/client.py --profile '<profile>' \
--region '<aws-region>' --document '<document>' --target '<iid-a>' arm-fault \
- --iid '<iid-a>' --boot '<boot-id>' --transaction '<transaction>' --minutes 35
+ --iid '<iid-a>' --boot '<boot-id>' --transaction "$tx" --minutes 35
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' status
+python3 scripts/region-group-roll.py --config '<config.json>' --attended-by '<operator>' roll \
+ --member '<iid-a>' --to-sha256 '<new-artifact-sha256>' --transaction "$tx"
```
-The current interfaces leave this ordering blocked: `roll` generates its
-transaction internally and immediately continues, while the harness needs
-that ID before the roll. Neither a caller-selected roll ID nor a preparation
-pause is exposed. The controller must resolve and rehearse this connection
-before the fault roll or Step 6; do not guess an ID, race the journal, edit a
-permit or weaken the match. The command above describes the required binding,
-not a claim that the current CLI can supply it in that order.
+`roll --transaction` resolves the transaction-binding blocker. Keep the chosen
+ID with the evidence for recovery. The controller still rehearses the sequence
+before the fault roll or Step 6. After every roll attempt, including failure,
+run these commands as soon as access returns:
+
+```sh
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' status
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' disarm
+```
`arm-fault` writes a root-only marker and `90-p3b2-fault.conf`; it does not
inject or restart. At edge pre-start, after apply's S3 verification, the worker
@@ -307,9 +317,9 @@ refusal and zero edge stops, restarts, binary changes or symlink repoints.
Compare process identity, binary/symlink state and service journal across each
attempt. Do not unmask the update units to make the attempt run.
-After resolving the Step 3 transaction-binding gap, read harness `status`,
+Using the Step 3 sequence, choose an unused transaction, read harness `status`,
arm `arm-fault` for that transaction and verify the marker before starting
-`roll` with `<iid-a>` and the pinned new digest. Record the old artifact,
+`roll --transaction <tx>` with `<iid-a>` and the pinned new digest. Record the old artifact,
process identity, member set and activity counters. Require signed preparation
and preserved host.env/certificate checks before minimum drops. Record only
hashes/metadata for secret-bearing files, never their contents.
@@ -408,8 +418,8 @@ a lost session, elapsed time or old launch receipt as fresh admission.
In a separately recorded roll that has completed apply but remains in Standby
before any Exit intent, use `rollback` with the same member and transaction.
-After resolving Step 3's transaction-binding gap, use the same client and
-identity arguments with `arm-pause` before this roll. Pause mode blocks public
+Choose a new transaction ID and use Step 3's client and identity arguments with
+`arm-pause` before `roll --transaction <tx>`. Pause mode blocks public
HTTPS only for user `carlos`, preserving root's SSM rollback channel. Confirm
connection mark `0xc350b205` is unused by other policy; marks can outlive table
removal. Verify the new process has closed admission and no Exit intent, then
diff --git a/scripts/region-group-fault/README.md b/scripts/region-group-fault/README.md
index c2a2ccfdb..be0565ab5 100644
--- a/scripts/region-group-fault/README.md
+++ b/scripts/region-group-fault/README.md
@@ -36,7 +36,32 @@ a failed roll. After expiry, read status and verify the table is absent.
Export the log, uninstall, then check the table, drop-in, expiry units,
installed directory and state directory are gone. Disable Branch H afterward.
-For Step 6, arm the pause before the roll. The new edge cannot reach public
+`roll --transaction` resolves the transaction-binding blocker: choose an unused
+ID, invoke `fault.sh arm-fault` through the client, then roll with that same ID.
+Read back the marker before rolling:
+
+```sh
+tx="roll-$(python3 -c 'import uuid; print(uuid.uuid4().hex)')"
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' arm-fault \
+ --iid '<iid-a>' --boot '<boot-id>' --transaction "$tx" --minutes 35
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' status
+python3 scripts/region-group-roll.py --config '<config.json>' --attended-by '<operator>' roll \
+ --member '<iid-a>' --to-sha256 '<new-artifact-sha256>' --transaction "$tx"
+```
+
+After the roll, including a failed attempt, run these as soon as access returns:
+
+```sh
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' status
+python3 scripts/region-group-fault/client.py --profile '<profile>' \
+ --region '<aws-region>' --document '<document>' --target '<iid-a>' disarm
+```
+
+For Step 6, choose a new ID and arm the pause with `arm-pause --transaction <tx>`
+before `roll --transaction <tx>`. The new edge cannot reach public
HTTPS, keeping admission closed before Exit intent. Use the existing operator's
rollback for the same transaction while root SSM works. Remove the pause when
ready to observe rollback readiness and perform the guarded return. Act within
diff --git a/scripts/region-group-roll.py b/scripts/region-group-roll.py
index a3ed09330..f0952cec0 100755
--- a/scripts/region-group-roll.py
+++ b/scripts/region-group-roll.py
@@ -83,6 +83,7 @@ TEXT = {
"member": "Exact instance ID to maintain.",
"sha": "Verified release artifact SHA256 for this architecture.",
"transaction": "Transaction ID from the saved journal.",
+ "roll_transaction": "Choose an unused transaction ID before arming the fault harness. The probe- prefix is reserved.",
"plan": "Read readiness and list refusals. Change no group or box state.",
"roll": "Roll one member to the named artifact.",
"rollback": "Restore this transaction's old artifact while in Standby.",
@@ -521,7 +522,10 @@ class State:
def create(self, header):
require(self.held and self.active_id() is None, "active")
- j = Journal(self.directory / (header["transaction"] + ".jsonl"), self.owner, create=True)
+ try:
+ j = Journal(self.directory / (header["transaction"] + ".jsonl"), self.owner, create=True)
+ except FileExistsError as exc:
+ raise Refusal(TEXT["record"]) from exc
header = dict(header)
if "kind" in header:
header["header"] = {"kind": header.pop("kind")}
@@ -946,11 +950,14 @@ class Operator:
self.say("journal", str(inspection))
return not refusals
- def roll(self, iid, digest):
+ def roll(self, iid, digest, transaction=None):
+ if transaction is not None:
+ require(isinstance(transaction, str) and TX.fullmatch(transaction) and
+ not transaction.startswith("probe-"), "record")
require(self.state.held and self.state.active_id() is None, "active")
# Journal even preflight sessions; a failed preflight has no AWS group
# writes, but its session count and evidence must still survive.
- tx = uuid.uuid4().hex
+ tx = uuid.uuid4().hex if transaction is None else transaction
self.j = self.state.create(dict(transaction=tx, config=self.c, iid=iid, new=digest,
attended_by=self.attended))
self.header = self.j.events[0]
@@ -1386,11 +1393,16 @@ def main(argv=None):
p.add_argument("--member", required=True, help=TEXT["member"])
if verb in {"plan", "roll"}:
p.add_argument("--to-sha256", required=True, help=TEXT["sha"])
+ if verb == "roll":
+ p.add_argument("--transaction", help=TEXT["roll_transaction"])
if verb in {"rollback", "resume", "status", "return", "abandon"}:
p.add_argument("--transaction", required=True, help=TEXT["transaction"])
args = parser.parse_args(argv)
journal = None
try:
+ if args.command == "roll" and args.transaction is not None:
+ require(TX.fullmatch(args.transaction) and
+ not args.transaction.startswith("probe-"), "record")
require(os.geteuid() == 0, "root")
require(sys.stdin.isatty() or bool(args.attended_by and args.attended_by.strip()), "attended_required")
config = validate_config(decode(Path(args.config).read_bytes()))
@@ -1409,7 +1421,7 @@ def main(argv=None):
journal = op.j
elif args.command == "roll":
try:
- op.roll(args.member, args.to_sha256)
+ op.roll(args.member, args.to_sha256, transaction=args.transaction)
finally:
journal = op.j
else:
diff --git a/scripts/region_group_roll_test.py b/scripts/region_group_roll_test.py
index 5bd60e7f1..9c4c64033 100644
--- a/scripts/region_group_roll_test.py
+++ b/scripts/region_group_roll_test.py
@@ -1010,6 +1010,95 @@ class RoundOneTests(unittest.TestCase):
self.assertEqual(before, {p.name: p.read_bytes() for p in self.store.directory.iterdir()})
+class RollTransactionTests(unittest.TestCase):
+ setUp = StandbyTests.setUp
+ engine = StandbyTests.engine
+ run_roll = StandbyTests.run_roll
+
+ def test_chosen_transaction_cli_reaches_journal_active_and_permit(self):
+ tx = "B6_fault-2026_11_05"
+ config = Path(self.tmp.name) / "config.json"
+ config.write_text(json.dumps(self.config))
+ op = self.engine()
+ observed = []
+
+ def after(name):
+ if name == "permit":
+ observed.append(self.store.read(self.store.active))
+ self.assertEqual(op.j.events[0]["transaction"], tx)
+ self.assertEqual(self.fake.boxes[IID]["permit"]["transaction"], tx)
+
+ self.fake.after = after
+ with patch.object(roll.os, "geteuid", return_value=0), \
+ patch.object(roll, "State", return_value=self.store), \
+ patch.object(roll, "AWS", return_value=self.fake), \
+ patch.object(roll, "Operator", return_value=op):
+ rc = roll.main(["--config", str(config), "--attended-by", "tester", "roll",
+ "--member", IID, "--to-sha256", NEW, "--transaction", tx])
+ self.assertEqual(rc, 0)
+ self.assertEqual(observed, [{"transaction": tx}])
+ with closing(self.store.load(tx)) as journal:
+ self.assertEqual(journal.events[0]["transaction"], tx)
+ self.assertIsNotNone(journal.last("done"))
+ self.assertIsNone(self.store.active_id())
+
+ def test_finished_transaction_refuses_without_calls_or_writes(self):
+ self.run_roll()
+ tx = next(self.store.directory.glob("*.jsonl")).stem
+ self.fake.calls.clear()
+ with self.store.lock():
+ before = {p.name: p.read_bytes() for p in self.store.directory.iterdir()}
+ with self.assertRaisesRegex(roll.Refusal, roll.TEXT["record"]):
+ self.engine().roll(IID, OLD, transaction=tx)
+ self.assertEqual(before, {p.name: p.read_bytes() for p in self.store.directory.iterdir()})
+ self.assertEqual(self.fake.calls, [])
+ self.assertFalse(self.store.active.exists())
+
+ def test_unfinished_transaction_refuses_without_calls_or_writes(self):
+ tx = "unfinished-roll"
+ with self.store.lock():
+ with closing(self.store.create(dict(transaction=tx, config=self.config))):
+ pass
+ before = {p.name: p.read_bytes() for p in self.store.directory.iterdir()}
+ with self.assertRaisesRegex(roll.Refusal, roll.TEXT["active"]):
+ self.engine().roll(IID, NEW, transaction=tx)
+ self.assertEqual(before, {p.name: p.read_bytes() for p in self.store.directory.iterdir()})
+ self.assertEqual(self.fake.calls, [])
+
+ def test_invalid_or_probe_transaction_refuses_before_state_access(self):
+ for tx in ("", "../escape", "has.dot", "space id", "x" * 81, "id\n", "caf\u00e9", "probe-", "probe-test", 42):
+ with self.subTest(transaction=tx), \
+ patch.object(self.store, "active_id", side_effect=AssertionError("state accessed")):
+ before = {p.name: p.read_bytes() for p in self.store.directory.iterdir()}
+ with self.assertRaisesRegex(roll.Refusal, roll.TEXT["record"]):
+ self.engine().roll(IID, NEW, transaction=tx)
+ self.assertEqual(before, {p.name: p.read_bytes() for p in self.store.directory.iterdir()})
+ self.assertEqual(self.fake.calls, [])
+
+ def test_cli_invalid_or_probe_transaction_refuses_before_config_or_state(self):
+ for tx in ("", "../escape", "x" * 81, "probe-test"):
+ with self.subTest(transaction=tx), \
+ patch.object(roll.os, "geteuid", side_effect=AssertionError("validation was late")), \
+ patch.object(roll.Path, "read_bytes", side_effect=AssertionError("config read")), \
+ patch.object(roll, "State") as state, patch.object(roll, "AWS") as aws, \
+ patch.object(roll.sys, "stderr", self.output):
+ self.assertEqual(roll.main([
+ "--config", "unused.json", "roll", "--member", IID,
+ "--to-sha256", NEW, "--transaction", tx]), 1)
+ state.assert_not_called()
+ aws.assert_not_called()
+ self.assertEqual(self.fake.calls, [])
+
+ def test_default_transaction_is_uuid_hex(self):
+ self.run_roll()
+ path, = self.store.directory.glob("*.jsonl")
+ self.assertRegex(path.stem, r"^[0-9a-f]{32}$")
+ with closing(self.store.load(path.stem)) as journal:
+ self.assertEqual(journal.events[0]["transaction"], path.stem)
+ self.assertEqual(self.fake.writes, ["prepare", "minimum", "enter", "permit", "apply",
+ "exit", "minimum", "revoke"])
+
+
class RoundTwoTests(unittest.TestCase):
setUp = StandbyTests.setUp
engine = StandbyTests.engine