carlos / platform Public

scripts: document test follows the drain's --peers form

The operator document's drain now carries the verb's acknowledgement
list (--peers=, held-floor-capability). The test admits the new bracket
class (ASCII ranges and . _ , with - last; one shell argument), asserts
the superseded script's plain "drain <txn>" is refused and the peered
form accepted, rebuilds the negative cases on the peered form, and adds
peers injection cases (space, quote, dollar, semicolon, flag order,
missing flag).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 63d90dc1fcb2a5c01073e394210101a47c049b80 parent 0d9ad31
1 file changed, +40 −10
  • scripts/region_group_document_test.py +40 −10

CI failed — run details

Intent

Human

<task-notification> <task-id>buuhm5e1y</task-id> <tool-use-id>toolu_011QfntiymMUEcK2c4zn68mo</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a99cbe46-f458-4f72-8b8a-294aae9cdf21/tasks/buuhm5e1y.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on the merged tip" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bbhlezk68</task-id> <tool-use-id>toolu_013QXAxWrt87t2Ric6iCog7e</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a99cbe46-f458-4f72-8b8a-294aae9cdf21/tasks/bbhlezk68.output</output-file> <status>completed</status> <summary>Background command "Astra round 3 (background)" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 101 g CO₂e (13,045,901 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on held-floor-capability, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/scripts/region_group_document_test.py b/scripts/region_group_document_test.py
index 8cf4ea76e..afd540678 100644
--- a/scripts/region_group_document_test.py
+++ b/scripts/region_group_document_test.py
@@ -61,6 +61,17 @@ def tearDownModule():
_go_builder.stop()
+PEERS = "--peers=adi,g-0123456789abcdef0,box.b_1"
+
+
+def with_peers(command, peers=None):
+ """The group verb's drain: the plain drain command with its acknowledgement list."""
+ flag = PEERS if peers is None else "--peers=" + peers
+ out = command.replace("group-maintenance drain ", "group-maintenance drain " + flag + " ", 1)
+ assert out != command
+ return out
+
+
class DocumentPatternTests(unittest.TestCase):
def setUp(self):
self.tool = pattern()
@@ -86,30 +97,45 @@ class DocumentPatternTests(unittest.TestCase):
self.assertAccepted(command, harness=True)
def test_planned_handover_forms(self):
- # Region HA section 25: drain, fence-clear and the edge stop the roll
- # tool sends for replace, remove and the drained roll.
+ # Region HA section 25: drain, fence-clear and the edge stop the group
+ # verb sends for replace, remove and the drained roll. The drain now
+ # carries the verb's acknowledgement list (--peers=, held-floor-capability);
+ # the superseded script's plain "drain <txn>" is refused by the document,
+ # as a member on this release would refuse it without a list.
for transaction in ("a", "t6_held-1", "A_9-" * 20):
for verb in ("drain", "drain-cancel", "fence-clear"):
command = frames.roll.AWS.remote_command(dict(verb=verb, transaction=transaction), NONCE)
with self.subTest(verb=verb, transaction=transaction):
+ if verb == "drain":
+ self.assertRefused(command)
+ self.assertRefused(command, harness=True)
+ command = with_peers(command)
self.assertAccepted(command)
self.assertAccepted(command, harness=True)
self.assertAccepted(frames.roll.AWS.remote_command({"verb": "edge-stop"}, NONCE))
- drain = frames.roll.AWS.remote_command(dict(verb="drain", transaction="t6"), NONCE)
+ drain = with_peers(frames.roll.AWS.remote_command(dict(verb="drain", transaction="t6"), NONCE))
+ self.assertAccepted(with_peers(frames.roll.AWS.remote_command(dict(verb="drain", transaction="t6"), NONCE), ""))
+ D = PEERS + " t6"
clear = frames.roll.AWS.remote_command(dict(verb="fence-clear", transaction="t6"), NONCE)
cancel = frames.roll.AWS.remote_command(dict(verb="drain-cancel", transaction="t6"), NONCE)
stop = frames.roll.AWS.remote_command({"verb": "edge-stop"}, NONCE)
bad = {
- "leading dash": drain.replace("drain t6", "drain -t6"),
+ "leading dash": drain.replace(D, PEERS + " -t6"),
"cancel without bound": drain.replace(
- "/usr/bin/timeout --signal=TERM --kill-after=30s 3600s /opt/carlos/carlos system group-maintenance drain t6",
+ "/usr/bin/timeout --signal=TERM --kill-after=30s 3600s /opt/carlos/carlos system group-maintenance drain " + D,
"/opt/carlos/carlos system group-maintenance drain --cancel t6 && " + STATUS),
- "cancel under the drain bound": drain.replace("drain t6", "drain --cancel t6 && " + STATUS),
+ "cancel under the drain bound": drain.replace(D, "--cancel t6 && " + STATUS),
"cancel without status": cancel.replace(" && " + STATUS, ""),
"cancel dash": cancel.replace("--cancel t6", "--cancel -t6"),
"cancel two transactions": cancel.replace("--cancel t6", "--cancel t6 t7"),
- "two transactions": drain.replace("drain t6", "drain t6 t7"),
- "long transaction": drain.replace("drain t6", "drain " + "a" * 81),
+ "two transactions": drain.replace(D, D + " t7"),
+ "long transaction": drain.replace(D, PEERS + " " + "a" * 81),
+ "peers with a space": drain.replace(PEERS, "--peers=adi box-b"),
+ "peers with a quote": drain.replace(PEERS, "--peers=adi'b"),
+ "peers with a dollar": drain.replace(PEERS, "--peers=adi$(id)"),
+ "peers with a semicolon": drain.replace(PEERS, "--peers=adi;id"),
+ "peers flag after the transaction": drain.replace(D, "t6 " + PEERS),
+ "no peers flag": drain.replace(PEERS + " ", ""),
"drain without timeout": drain.replace("/usr/bin/timeout --signal=TERM --kill-after=30s 3600s ", ""),
"drain longer bound": drain.replace("3600s", "3601s"),
"fence-clear without status": clear.replace(" && " + STATUS, ""),
@@ -121,7 +147,7 @@ class DocumentPatternTests(unittest.TestCase):
"other property": stop.replace("--property=ActiveState", "--property=Environment"),
}
for addition in ("; id", " && id", " | sh"):
- bad["drain " + repr(addition)] = drain.replace("drain t6", "drain t6" + addition)
+ bad["drain " + repr(addition)] = drain.replace(D, D + addition)
bad["stop " + repr(addition)] = stop.replace("carlos-edge.service)", "carlos-edge.service" + addition + ")")
for label, command in bad.items():
with self.subTest(case=label):
@@ -296,7 +322,11 @@ class DocumentPatternTests(unittest.TestCase):
elif char == "[":
end = source.index("]", index)
self.assertIn(source[index:end + 1], (
- "[0-9a-f]", "[A-Za-z0-9+/=]", "[A-Za-z0-9_-]", "[A-Za-z0-9_]", "[1-9]", "[1-5]", "[0-9]"))
+ "[0-9a-f]", "[A-Za-z0-9+/=]", "[A-Za-z0-9_-]", "[A-Za-z0-9_]", "[1-9]", "[1-5]", "[0-9]",
+ # The drain's acknowledgement list (held-floor-capability):
+ # ASCII ranges and literal . _ , with - last; no space,
+ # quote, semicolon or dollar, so it stays one argument.
+ "[A-Za-z0-9._,-]"))
index = end
elif char == "{":
end = source.index("}", index)