@soleur/opencode 3.378.15 → 3.378.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/delegation-verify.sh +14 -5
- package/scripts/delegation-verify.test.sh +84 -1
- package/scripts/pipeline-tally.sh +57 -27
- package/scripts/pipeline-tally.test.sh +153 -18
- package/skills/brainstorm-techniques/references/approval-card.md +76 -0
- package/skills/brainstorm-techniques/references/standing-delegation.md +5 -1
- package/skills/ship/SKILL.md +12 -5
- package/skills/ship/references/pipeline-tally-render.md +41 -7
- package/skills/work/SKILL.md +1 -0
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
# delegation-verify.sh verify --delegation <comment-url> [--envelope <path[#title]>] [--command <line>]...
|
|
18
18
|
# [--audit --at <YYYY-MM-DDTHH:MM:SSZ>]
|
|
19
19
|
# delegation-verify.sh render --epic <N> --question-file <f> --answer-file <f> --scope-file <f> --expiry <YYYY-MM-DD>
|
|
20
|
+
# [--method tty-ack]
|
|
20
21
|
#
|
|
21
22
|
# stdout (verify): `delegation: valid|invalid|unverifiable reason=<token>`; on `valid` always, next,
|
|
22
23
|
# `verified-created-at: <ISO time the delegation comment was created>` and `verified-expiry: <YYYY-MM-DD>` (the
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
# epic-open against now.
|
|
31
32
|
#
|
|
32
33
|
# Reason tokens: bad-url wrong-repo comment-unreadable api-error tool-missing usage no-marker wrong-issue
|
|
33
|
-
# epic-is-pr bot-author not-admin-author edited no-quote quote-too-short no-confirmation no-scope-item
|
|
34
|
+
# epic-is-pr bot-author not-admin-author edited no-quote quote-too-short no-confirmation method-unknown no-scope-item
|
|
34
35
|
# excluded-incomplete expiry-missing expiry-too-long expired before-delegation epic-closed envelope-missing
|
|
35
36
|
# envelope-not-committed envelope-outside-repo envelope-not-regular-file parse-ambiguous
|
|
36
37
|
# envelope-delegation-mismatch envelope-incomplete epic-mismatch rollback-unnamed non-delegable-command
|
|
@@ -186,14 +187,17 @@ parse_body() {
|
|
|
186
187
|
P_EXPDATE="$(grep -m1 '^\*\*Expiry:\*\*' "$b" | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}' | head -1)"
|
|
187
188
|
P_ONE_CONF=0; [ "$(grep -c '^\*\*Confirmation:\*\*' "$b")" = 1 ] && P_ONE_CONF=1
|
|
188
189
|
P_ONE_EXP=0; [ "$(grep -c '^\*\*Expiry:\*\*' "$b")" = 1 ] && P_ONE_EXP=1
|
|
190
|
+
# The Method line is a LABEL only (how the operator's answer was given). Nothing below reads it to choose a check.
|
|
191
|
+
P_METHOD_N="$(grep -ciE '^[[:space:]>]*(([-*+]|[0-9]+[.)]|#+)[[:space:]]+)?(\*\*|__)method(:(\*\*|__)|(\*\*|__):)' "$b")" # mut:method-parse
|
|
192
|
+
P_METHOD="$(trim "$(grep -m1 '^\*\*Method:\*\*' "$b" | sed 's/^\*\*Method:\*\*//')")"
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
# says_yes <text>: the Confirmation starts with the word Yes.
|
|
192
196
|
says_yes() { [[ "$1" =~ ^Yes([^[:alnum:]]|$) ]]; }
|
|
193
197
|
|
|
194
|
-
# render_body <epic> <date> <qfile> <afile> <scopefile> <expiry
|
|
198
|
+
# render_body <epic> <date> <qfile> <afile> <scopefile> <expiry> [method]: the delegation record on stdout.
|
|
195
199
|
render_body() {
|
|
196
|
-
local epic="$1" date="$2" qf="$3" af="$4" sf="$5" expiry="$6" first=1 n=0 line ans
|
|
200
|
+
local epic="$1" date="$2" qf="$3" af="$4" sf="$5" expiry="$6" method="${7:-}" first=1 n=0 line ans
|
|
197
201
|
printf '%s\n' "$MARKER"
|
|
198
202
|
printf '## Standing delegation - epic #%s (recorded %s)\n\n' "$epic" "$date"
|
|
199
203
|
printf '**Operator instruction, verbatim (%s):**\n' "$date"
|
|
@@ -213,6 +217,7 @@ render_body() {
|
|
|
213
217
|
done < "$af"
|
|
214
218
|
ans="$(tr '\r\n' ' ' < "$af")"; ans="$(trim "$ans")"
|
|
215
219
|
printf '\n**Confirmation:** %s\n\n' "$ans"
|
|
220
|
+
[ -z "$method" ] || printf '**Method:** %s\n\n' "$method"
|
|
216
221
|
printf '**Scope (act classes the CTO agent may run without a further per-command prompt):**\n'
|
|
217
222
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
218
223
|
line="$(trim "${line%$'\r'}")"
|
|
@@ -501,6 +506,7 @@ do_verify() {
|
|
|
501
506
|
[ -s "$WORK/quote.txt" ] || fail_invalid no-quote "The standing approval does not quote the operator's own words."
|
|
502
507
|
[ "${#P_QUOTE}" -ge 40 ] || fail_invalid quote-too-short "The quoted words in the standing approval are too short to show what was agreed." # mut:quote-len
|
|
503
508
|
{ [ "$P_ONE_CONF" = 1 ] && says_yes "$P_CONF"; } || fail_invalid no-confirmation "The standing approval does not record a clear Yes from the operator." # mut:confirmation
|
|
509
|
+
{ [ "$P_METHOD_N" = 0 ] || { [ "$P_METHOD_N" = 1 ] && [ "$P_METHOD" = tty-ack ]; }; } || fail_invalid method-unknown "The standing approval names a way of answering that I do not recognise." # mut:method
|
|
504
510
|
[ -s "$WORK/scope.nums" ] || fail_invalid no-scope-item "The standing approval lists no numbered acts." # mut:scope
|
|
505
511
|
! grep -qE '<[!?]' "$WORK/scope.items" || fail_invalid no-scope-item "A numbered act in the standing approval holds hidden markup, so it cannot be relied on." # mut:scope-html
|
|
506
512
|
[ "$P_EXCL_OK" = 1 ] || fail_invalid excluded-incomplete "The standing approval does not carry the exact list of what stays with the operator." # mut:excluded
|
|
@@ -616,7 +622,7 @@ do_verify() {
|
|
|
616
622
|
|
|
617
623
|
# do_render: build the record, then prove it parses (fail closed: a record that would not verify is never printed).
|
|
618
624
|
do_render() {
|
|
619
|
-
local EPIC="" QF="" AF="" SF="" EXPIRY="" today limit f ans
|
|
625
|
+
local EPIC="" QF="" AF="" SF="" EXPIRY="" METHOD="" METHOD_SET=0 today limit f ans
|
|
620
626
|
while [ $# -gt 0 ]; do
|
|
621
627
|
case "$1" in
|
|
622
628
|
--epic) [ $# -ge 2 ] || die_render "--epic needs a value"; EPIC="$2"; shift 2 ;;
|
|
@@ -624,6 +630,7 @@ do_render() {
|
|
|
624
630
|
--answer-file) [ $# -ge 2 ] || die_render "--answer-file needs a value"; AF="$2"; shift 2 ;;
|
|
625
631
|
--scope-file) [ $# -ge 2 ] || die_render "--scope-file needs a value"; SF="$2"; shift 2 ;;
|
|
626
632
|
--expiry) [ $# -ge 2 ] || die_render "--expiry needs a value"; EXPIRY="$2"; shift 2 ;;
|
|
633
|
+
--method) [ $# -ge 2 ] && [ -n "$2" ] || die_render "--method needs a value"; [ "$METHOD_SET" = 0 ] || die_render "--method may be given once"; METHOD="$2"; METHOD_SET=1; shift 2 ;;
|
|
627
634
|
*) die_render "unknown argument: $1" ;;
|
|
628
635
|
esac
|
|
629
636
|
done
|
|
@@ -635,14 +642,16 @@ do_render() {
|
|
|
635
642
|
says_yes "$ans" || die_render "the answer must start with Yes: a record of anything else is not a standing approval" # mut:render-yes
|
|
636
643
|
[ "${#ans}" -le "$ANSWER_CAP" ] || die_render "the answer is longer than $ANSWER_CAP characters; it is posted word for word on a public issue, so keep it short" # mut:render-cap
|
|
637
644
|
if grep -Eq -- "$SECRET_RE" "$QF" "$AF"; then die_render "the question or answer looks like it holds a password or key; it would be posted publicly, so I will not write it"; fi # mut:render-secret
|
|
645
|
+
{ [ -z "$METHOD" ] || [ "$METHOD" = tty-ack ]; } || die_render "--method only accepts tty-ack: it is a label for how the answer was given, never a way to choose a lighter check" # mut:render-method
|
|
638
646
|
valid_date "$EXPIRY" || die_render "--expiry needs a real date (YYYY-MM-DD)"
|
|
639
647
|
today="$(date -u +%Y-%m-%d)"; limit="$(add_days "$today" 30)"
|
|
640
648
|
[[ ! "$EXPIRY" > "$limit" ]] || die_render "the expiry is more than 30 days away"
|
|
641
649
|
[[ ! "$EXPIRY" < "$today" ]] || die_render "the expiry is in the past"
|
|
642
|
-
render_body "$EPIC" "$today" "$QF" "$AF" "$SF" "$EXPIRY" > "$WORK/rendered.md"
|
|
650
|
+
render_body "$EPIC" "$today" "$QF" "$AF" "$SF" "$EXPIRY" "$METHOD" > "$WORK/rendered.md"
|
|
643
651
|
parse_body "$WORK/rendered.md"
|
|
644
652
|
[ "$P_MARKER_OK" = 1 ] && [ "${#P_QUOTE}" -ge 40 ] && [ "$P_ONE_CONF" = 1 ] && [ -s "$WORK/scope.nums" ] && [ "$P_EXCL_OK" = 1 ] && valid_date "$P_EXPDATE" \
|
|
645
653
|
|| die_render "the record would not verify (the quoted question and answer must total at least 40 characters)"
|
|
654
|
+
[ "$P_METHOD_N" = "$([ -n "$METHOD" ] && echo 1 || echo 0)" ] || die_render "the question, answer or scope holds a line that claims a Method; the label is added only by --method"
|
|
646
655
|
cat "$WORK/rendered.md"
|
|
647
656
|
exit 0
|
|
648
657
|
}
|
|
@@ -1015,6 +1015,79 @@ done
|
|
|
1015
1015
|
printf 'Yes, go ahead, and the build is sk-short.\n' > "$TMP/a-sk-short.txt"
|
|
1016
1016
|
run_v render --epic 77 --question-file "$TMP/q.txt" --answer-file "$TMP/a-sk-short.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10"
|
|
1017
1017
|
assert_eq "0" "$(last_rc)" "ordinary text that merely contains sk- is not a secret"
|
|
1018
|
+
echo "=== Arm 5b: the Method label (a label only: it never selects a lighter check) ==="
|
|
1019
|
+
s_method() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "**Method:** '"$1"'" }'; }
|
|
1020
|
+
s_method_ok() { s_method tty-ack; }
|
|
1021
|
+
s_method_web() { s_method web-session; }
|
|
1022
|
+
s_method_unknown() { s_method carrier-pigeon; }
|
|
1023
|
+
s_method_empty() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "**Method:**" }'; }
|
|
1024
|
+
s_method_two() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "**Method:** tty-ack"; print ""; print "**Method:** tty-ack" }'; }
|
|
1025
|
+
scn; s_method_ok; run_v verify --delegation "$URL"; expect "Method tty-ack is accepted" 0 "$V_OK"
|
|
1026
|
+
scn; run_v verify --delegation "$URL"; cp "$TMP/o" "$TMP/o-nomethod"
|
|
1027
|
+
scn; s_method_ok; run_v verify --delegation "$URL"
|
|
1028
|
+
assert_eq "$(cat "$TMP/o-nomethod")" "$(cat "$TMP/o")" "the verdict output is identical with and without a Method line"
|
|
1029
|
+
scn; s_method_web; run_v verify --delegation "$URL"; expect "Method web-session is not a valid label on a comment" 1 "$(inv method-unknown)"
|
|
1030
|
+
scn; s_method_unknown; run_v verify --delegation "$URL"; expect "an unknown Method value is invalid" 1 "$(inv method-unknown)"
|
|
1031
|
+
scn; s_method_empty; run_v verify --delegation "$URL"; expect "an empty Method value is invalid" 1 "$(inv method-unknown)"
|
|
1032
|
+
scn; s_method_two; run_v verify --delegation "$URL"; expect "two Method lines are ambiguous" 1 "$(inv method-unknown)"
|
|
1033
|
+
scn; s_method_ok; mk_comment 1001 "$STUB_DIR/b.md" other-user; echo '{"permission":"write"}' > "$STUB_DIR/perm-other-user.json"
|
|
1034
|
+
run_v verify --delegation "$URL"; expect "a Method line does not skip the admin check" 1 "$(inv not-admin-author)"
|
|
1035
|
+
scn; s_method_ok; mk_comment 1001 "$STUB_DIR/b.md" owner-user Bot
|
|
1036
|
+
run_v verify --delegation "$URL"; expect "a Method line does not let a bot author through" 1 "$(inv bot-author)"
|
|
1037
|
+
run_v render --epic 77 --question-file "$TMP/q.txt" --answer-file "$TMP/a.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10" --method tty-ack
|
|
1038
|
+
assert_eq "0" "$(last_rc)" "render accepts --method tty-ack"
|
|
1039
|
+
cp "$TMP/o" "$TMP/rendered-method.md"
|
|
1040
|
+
assert_eq "1" "$(grep -c '^\*\*Method:\*\* tty-ack$' "$TMP/rendered-method.md")" "the rendered record carries exactly one Method line"
|
|
1041
|
+
scn; mk_comment 1001 "$TMP/rendered-method.md"
|
|
1042
|
+
run_v verify --delegation "$URL"; expect "a rendered record with a Method line verifies as valid" 0 "$V_OK"
|
|
1043
|
+
assert_eq "0" "$(grep -c '^\*\*Method:\*\*' "$TMP/rendered.md")" "a record rendered without --method carries no Method line"
|
|
1044
|
+
run_v render --epic 77 --question-file "$TMP/q.txt" --answer-file "$TMP/a.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10" --method web-session
|
|
1045
|
+
assert_eq "2" "$(last_rc)" "render refuses --method web-session"
|
|
1046
|
+
run_v render --epic 77 --question-file "$TMP/q.txt" --answer-file "$TMP/a.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10" --method
|
|
1047
|
+
assert_eq "2" "$(last_rc)" "render refuses a trailing --method with no value"
|
|
1048
|
+
run_v render --epic 77 --question-file "$TMP/q.txt" --answer-file "$TMP/a.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10" --method tty-ack --method tty-ack
|
|
1049
|
+
assert_eq "2" "$(last_rc)" "render refuses a duplicate --method"
|
|
1050
|
+
run_v render --epic 77 --question-file "$TMP/q.txt" --answer-file "$TMP/a.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10" --method ""
|
|
1051
|
+
assert_eq "2" "$(last_rc)" "render refuses an empty --method"
|
|
1052
|
+
{ cat "$TMP/q.txt"; printf '\n**Method:** web-session\n'; } > "$TMP/q-method.txt"
|
|
1053
|
+
run_v render --epic 77 --question-file "$TMP/q-method.txt" --answer-file "$TMP/a.txt" --scope-file "$TMP/sc.txt" --expiry "$EXP10"
|
|
1054
|
+
assert_eq "2" "$(last_rc)" "render refuses a question that carries its own Method claim (the record would not verify)"
|
|
1055
|
+
# Which lines count as a claim: any line a reader would take for a Method claim (indented, quoted, any letter case, inside a
|
|
1056
|
+
# fenced block), but not text a renderer hides (an HTML comment). A claim that is not exactly one canonical tty-ack line is refused.
|
|
1057
|
+
s_method_indent() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print " **Method:** tty-ack" }'; }
|
|
1058
|
+
s_method_quote() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "> **Method:** tty-ack" }'; }
|
|
1059
|
+
s_method_lower() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "**method:** tty-ack" }'; }
|
|
1060
|
+
s_method_hidden() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "<!-- **Method:** web-session -->" }'; }
|
|
1061
|
+
s_method_fence() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "```"; print "**Method:** web-session"; print "```" }'; }
|
|
1062
|
+
scn; s_method_indent; run_v verify --delegation "$URL"; expect "an indented Method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1063
|
+
scn; s_method_quote; run_v verify --delegation "$URL"; expect "a quoted Method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1064
|
+
scn; s_method_lower; run_v verify --delegation "$URL"; expect "a lower-case method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1065
|
+
scn; s_method_fence; run_v verify --delegation "$URL"; expect "a Method claim inside a fenced block is counted and refused" 1 "$(inv method-unknown)"
|
|
1066
|
+
scn; s_method_hidden; run_v verify --delegation "$URL"; expect "a Method claim hidden in an HTML comment is not a claim" 0 "$V_OK"
|
|
1067
|
+
s_method_bullet() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "- **Method:** web-session" }'; }
|
|
1068
|
+
s_method_colon() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "**Method**: web-session" }'; }
|
|
1069
|
+
s_method_under() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "__Method:__ web-session" }'; }
|
|
1070
|
+
scn; s_method_bullet; run_v verify --delegation "$URL"; expect "a bulleted Method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1071
|
+
scn; s_method_colon; run_v verify --delegation "$URL"; expect "a Method claim with the colon outside the bold is counted and refused" 1 "$(inv method-unknown)"
|
|
1072
|
+
scn; s_method_under; run_v verify --delegation "$URL"; expect "an underscore-bold Method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1073
|
+
s_method_num() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "1. **Method:** web-session" }'; }
|
|
1074
|
+
s_method_head() { b_awk '{ print } /^\*\*Confirmation:\*\*/ { print ""; print "# **Method:** web-session" }'; }
|
|
1075
|
+
scn; s_method_num; run_v verify --delegation "$URL"; expect "a numbered-list Method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1076
|
+
scn; s_method_head; run_v verify --delegation "$URL"; expect "a heading Method claim is counted and refused" 1 "$(inv method-unknown)"
|
|
1077
|
+
# The label must not select a lighter check: every refusal below keeps its verdict when a Method line is added.
|
|
1078
|
+
with_method() { # add a Method line (tty-ack) to the comment body already posted in this scenario
|
|
1079
|
+
local nb
|
|
1080
|
+
nb="$(jq -r .body "$STUB_DIR/comment-1001.json" | awk '/^\*\*Scope/ { print "**Method:** tty-ack"; print "" } { print }')"
|
|
1081
|
+
jq --arg b "$nb" '.body = $b' "$STUB_DIR/comment-1001.json" > "$STUB_DIR/c.json" && mv "$STUB_DIR/c.json" "$STUB_DIR/comment-1001.json"
|
|
1082
|
+
}
|
|
1083
|
+
for fn in s_edited s_app s_bot s_nonadmin s_noconfirm s_exclinc s_noexp s_toolong s_expired s_closed s_noscope; do
|
|
1084
|
+
scn; "$fn"; run_v verify --delegation "$URL"; base="$(last_rc)|$(head -1 "$TMP/o")"
|
|
1085
|
+
scn; "$fn"; with_method; run_v verify --delegation "$URL"; with="$(last_rc)|$(head -1 "$TMP/o")"
|
|
1086
|
+
assert_eq "$base" "$with" "a Method line does not change the verdict of $fn"
|
|
1087
|
+
assert_eq "1" "$([[ "${base%%|*}" != 0 ]] && echo 1 || echo 0)" "the $fn base case really is a refusal"
|
|
1088
|
+
done
|
|
1089
|
+
s_edited_method() { s_edited; with_method; }
|
|
1090
|
+
s_exclinc_method() { s_exclinc; with_method; }
|
|
1018
1091
|
bounded() { # <seconds> <args...>: run the verifier, kill it after <seconds>; rc 124 when it hung
|
|
1019
1092
|
local secs="$1" pid k=0; shift
|
|
1020
1093
|
( cd "$REPO" && git_fixture_env "$REPO" && PATH="$BIN:$PATH" bash "$SUT" "$@" ) >"$TMP/o" 2>"$TMP/e" </dev/null &
|
|
@@ -1412,9 +1485,19 @@ mutate render-guard 's/\[ \$# -ge 2 \] \|\| die_render "--epic needs a value"; E
|
|
|
1412
1485
|
[[ "$r1" == 124 ]] && { echo " PASS: mutant render-guard killed (the unguarded --epic hangs)"; PASS=$((PASS + 1)); } || { echo " FAIL: mutant render-guard SURVIVED (rc $r1)"; FAIL=$((FAIL + 1)); }
|
|
1413
1486
|
}
|
|
1414
1487
|
|
|
1488
|
+
mutate method "$(noop method)" && {
|
|
1489
|
+
killed method "1|$(inv method-unknown)|0" s_method_web verify --delegation "$URL"
|
|
1490
|
+
killed method "1|$(inv method-unknown)|0" s_method_unknown verify --delegation "$URL"
|
|
1491
|
+
killed method "1|$(inv method-unknown)|0" s_method_two verify --delegation "$URL"
|
|
1492
|
+
}
|
|
1493
|
+
mutate method-parse 's/^( P_METHOD_N=).*# mut:method-parse$/\10 # mut:method-parse/' && killed method-parse "1|$(inv method-unknown)|0" s_method_web verify --delegation "$URL"
|
|
1494
|
+
mutate render-method "$(noop render-method)" && killed render-method "2||0" s_render_ok "${rargs[@]}" --answer-file "$TMP/a.txt" --method web-session
|
|
1495
|
+
mutate method-skip-edited 's/\[ "\$UPDATED" = "\$CREATED" \] \|\| fail_invalid edited/[ "$P_METHOD" = tty-ack ] || [ "$UPDATED" = "$CREATED" ] || fail_invalid edited/' && killed method-skip-edited "1|$(inv edited)|0" s_edited_method verify --delegation "$URL"
|
|
1496
|
+
mutate method-skip-excluded 's/\[ "\$P_EXCL_OK" = 1 \] \|\| fail_invalid excluded-incomplete/[ "$P_METHOD" = tty-ack ] || [ "$P_EXCL_OK" = 1 ] || fail_invalid excluded-incomplete/' && killed method-skip-excluded "1|$(inv excluded-incomplete)|0" s_exclinc_method verify --delegation "$URL"
|
|
1497
|
+
|
|
1415
1498
|
echo "=== Floors: the SUT answered every row (zero slack) ==="
|
|
1416
1499
|
n_calls="$(cat "$TMP"/scn*/calls.log 2>/dev/null | wc -l | tr -d ' ')"
|
|
1417
|
-
CALLS_FLOOR=
|
|
1500
|
+
CALLS_FLOOR=3011; RESULTS_FLOOR=1899
|
|
1418
1501
|
if (( n_calls >= CALLS_FLOOR )); then
|
|
1419
1502
|
echo " PASS: gh stub calls $n_calls >= $CALLS_FLOOR"; PASS=$((PASS + 1))
|
|
1420
1503
|
else
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
# resolver exists.
|
|
33
33
|
#
|
|
34
34
|
# Flat key=value lines, rewritten wholesale under with_lock:
|
|
35
|
-
# seats / ci_cycles / fix_rounds / agent_rounds
|
|
35
|
+
# seats / ci_cycles / fix_rounds / agent_rounds / ci_wall_s
|
|
36
|
+
# (counts, default 0)
|
|
36
37
|
# cap_<dim>=N (0 = unset — persisted at init so caps survive
|
|
37
38
|
# skill-to-skill handoff; argv dies at skill boundaries)
|
|
38
39
|
# warned_<dim>=N (level at which WARN first fired, ask included; 0 = never)
|
|
@@ -64,19 +65,25 @@
|
|
|
64
65
|
# pass included — `gate seats <panel-size>` before dispatch). `agent_rounds` =
|
|
65
66
|
# orchestration dispatches (one-shot child skills, drain items, resolver
|
|
66
67
|
# fan-outs). `fix_rounds` = fix/retry iterations. `ci_cycles` = CI runs the run
|
|
67
|
-
# itself drove (each push to the PR head).
|
|
68
|
-
#
|
|
68
|
+
# itself drove (each push to the PR head). `ci_wall_s` = measured CI wall-clock
|
|
69
|
+
# seconds (#11775) — summed over the driven runs whose timing was readable; a
|
|
70
|
+
# caller with no measurement posts NOTHING, so the count is a floor and count 0
|
|
71
|
+
# means "never measured", which the render surfaces print as
|
|
72
|
+
# `ci_wall_s=unmeasured` (an explicit absent marker — never `ci_wall_s=0`, a
|
|
73
|
+
# fabricated zero that would masquerade as a measured run). Heterogeneous units
|
|
74
|
+
# land on one dim by design — a cap reads as "work units", not a strict taxonomy.
|
|
69
75
|
#
|
|
70
|
-
# DIMENSIONS: seats | ci_cycles | fix_rounds | agent_rounds
|
|
71
|
-
# (`ci-cycles`
|
|
72
|
-
# taken). One writer per dimension per skill
|
|
73
|
-
# workflow `counts:` post for the same dim
|
|
76
|
+
# DIMENSIONS: seats | ci_cycles | fix_rounds | agent_rounds | ci_wall_s
|
|
77
|
+
# (`ci-cycles` and `ci-wall-s` are accepted as aliases for `ci_cycles` and
|
|
78
|
+
# `ci_wall_s` everywhere a dim is taken). One writer per dimension per skill
|
|
79
|
+
# invocation — a prose `incr` and a workflow `counts:` post for the same dim
|
|
80
|
+
# never both fire.
|
|
74
81
|
#
|
|
75
82
|
# SUBCOMMANDS
|
|
76
83
|
#
|
|
77
84
|
# init [--reset] [--branch <b>]
|
|
78
85
|
# [--max-seats N] [--max-ci-cycles N] [--max-fix-rounds N]
|
|
79
|
-
# [--max-agent-rounds N]
|
|
86
|
+
# [--max-agent-rounds N] [--max-ci-wall-s N]
|
|
80
87
|
# Idempotent MERGE: creates the file if absent, preserves counters, merges
|
|
81
88
|
# --max-* flags into cap_<dim>. Prints `tally-init: <slug> <outcome>` where
|
|
82
89
|
# outcome ∈ fresh | continued | reset | capped-reset | stale-reset |
|
|
@@ -138,7 +145,8 @@
|
|
|
138
145
|
# Flag validation: values must match ^[1-9][0-9]{0,9}$ — non-numeric,
|
|
139
146
|
# negative, zero, leading-zero forms (`08`), and digit strings that would
|
|
140
147
|
# wrap mod-2^64 are rejected with SOLEUR_TALLY_ERROR reason=bad-flag on
|
|
141
|
-
# stderr and exit 0. `--max-ci_cycles` (underscore) aliases --max-ci-cycles
|
|
148
|
+
# stderr and exit 0. `--max-ci_cycles` (underscore) aliases --max-ci-cycles;
|
|
149
|
+
# `--max-ci_wall_s` aliases --max-ci-wall-s the same way.
|
|
142
150
|
#
|
|
143
151
|
# incr <dim> [n] [--branch <b>]
|
|
144
152
|
# Adds n (default 1, ^[0-9]{1,10}$ validated and 10#-normalized) to <dim> under
|
|
@@ -150,7 +158,10 @@
|
|
|
150
158
|
#
|
|
151
159
|
# show [--branch <b>]
|
|
152
160
|
# Absent/unreadable file → UNKNOWN. Else prints
|
|
153
|
-
# `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N
|
|
161
|
+
# `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N ci_wall_s=W` —
|
|
162
|
+
# where W is `unmeasured` at count 0 (the absent marker, never a fabricated
|
|
163
|
+
# `ci_wall_s=0`) and the count itself once any measured wall was posted — a
|
|
164
|
+
# `cap:<dim>=<n>`
|
|
154
165
|
# token line when caps are set (the stop-hook floor reads this), and, when
|
|
155
166
|
# any is set, `warned:<dim>=<at>` / `capped:<dim>=<cap>` tokens. On a
|
|
156
167
|
# default-branch ledger (`main`/`master`) a last line
|
|
@@ -255,11 +266,12 @@ _tally_paths_err() { case "$1" in 1) _tally_err bad-branch ;; *) _tally_err lib-
|
|
|
255
266
|
# per-run key), so init scopes them to one run and show discloses it.
|
|
256
267
|
_tally_is_default_branch() { [[ "${T_BRANCH:-}" == "main" || "${T_BRANCH:-}" == "master" ]]; }
|
|
257
268
|
|
|
258
|
-
# Canonicalize a dim token -> seats|ci_cycles|fix_rounds|agent_rounds, or fail.
|
|
269
|
+
# Canonicalize a dim token -> seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s, or fail.
|
|
259
270
|
_tally_dim() {
|
|
260
271
|
case "$1" in
|
|
261
|
-
seats|ci_cycles|fix_rounds|agent_rounds) printf '%s' "$1" ;;
|
|
272
|
+
seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s) printf '%s' "$1" ;;
|
|
262
273
|
ci-cycles) printf 'ci_cycles' ;;
|
|
274
|
+
ci-wall-s) printf 'ci_wall_s' ;;
|
|
263
275
|
*) return 1 ;;
|
|
264
276
|
esac
|
|
265
277
|
}
|
|
@@ -322,12 +334,12 @@ _tally_ledger_ok() {
|
|
|
322
334
|
[[ -f "$1" && -r "$1" ]] || return 1
|
|
323
335
|
grep -q '^seats=' "$1" 2>/dev/null || return 1
|
|
324
336
|
if grep -qvE '=[0-9]{1,18}$' \
|
|
325
|
-
< <(grep -E '^(seats|ci_cycles|fix_rounds|agent_rounds|cap_[a-z_]+|warned_[a-z_]+)=' "$1" 2>/dev/null); then
|
|
337
|
+
< <(grep -E '^(seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s|cap_[a-z_]+|warned_[a-z_]+)=' "$1" 2>/dev/null); then
|
|
326
338
|
return 1
|
|
327
339
|
fi
|
|
328
340
|
# EVERY capped= line must carry the dim vocabulary or be empty — a duplicate
|
|
329
341
|
# corrupt line after a clean one must not slip past a first-line read.
|
|
330
|
-
if grep -qvE '^capped=(|seats|ci_cycles|fix_rounds|agent_rounds)$' \
|
|
342
|
+
if grep -qvE '^capped=(|seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s)$' \
|
|
331
343
|
< <(grep -E '^capped=' "$1" 2>/dev/null); then
|
|
332
344
|
return 1
|
|
333
345
|
fi
|
|
@@ -341,9 +353,9 @@ _tally_setf() { printf -v "T_$1" '%s' "$2"; }
|
|
|
341
353
|
# Load the ledger into T_* globals; missing/corrupt fields default to 0/empty.
|
|
342
354
|
_tally_load() {
|
|
343
355
|
local k v
|
|
344
|
-
for k in seats ci_cycles fix_rounds agent_rounds \
|
|
345
|
-
cap_seats cap_ci_cycles cap_fix_rounds cap_agent_rounds \
|
|
346
|
-
warned_seats warned_ci_cycles warned_fix_rounds warned_agent_rounds; do
|
|
356
|
+
for k in seats ci_cycles fix_rounds agent_rounds ci_wall_s \
|
|
357
|
+
cap_seats cap_ci_cycles cap_fix_rounds cap_agent_rounds cap_ci_wall_s \
|
|
358
|
+
warned_seats warned_ci_cycles warned_fix_rounds warned_agent_rounds warned_ci_wall_s; do
|
|
347
359
|
v=""
|
|
348
360
|
[[ -r "$1" ]] && v=$(_tally_field "$1" "$k")
|
|
349
361
|
[[ "$v" =~ ^[0-9]+$ ]] || v=0
|
|
@@ -355,7 +367,7 @@ _tally_load() {
|
|
|
355
367
|
# Sanitize: an unvetted latch value would reach indirect expansion in
|
|
356
368
|
# `show` (`cap_$T_capped` -> invalid variable name) and mis-STOP gates.
|
|
357
369
|
case "$T_capped" in
|
|
358
|
-
""|seats|ci_cycles|fix_rounds|agent_rounds) ;;
|
|
370
|
+
""|seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s) ;;
|
|
359
371
|
*) T_capped="" ;;
|
|
360
372
|
esac
|
|
361
373
|
fi
|
|
@@ -374,14 +386,17 @@ seats=$(_tally_getf seats)
|
|
|
374
386
|
ci_cycles=$(_tally_getf ci_cycles)
|
|
375
387
|
fix_rounds=$(_tally_getf fix_rounds)
|
|
376
388
|
agent_rounds=$(_tally_getf agent_rounds)
|
|
389
|
+
ci_wall_s=$(_tally_getf ci_wall_s)
|
|
377
390
|
cap_seats=$(_tally_getf cap_seats)
|
|
378
391
|
cap_ci_cycles=$(_tally_getf cap_ci_cycles)
|
|
379
392
|
cap_fix_rounds=$(_tally_getf cap_fix_rounds)
|
|
380
393
|
cap_agent_rounds=$(_tally_getf cap_agent_rounds)
|
|
394
|
+
cap_ci_wall_s=$(_tally_getf cap_ci_wall_s)
|
|
381
395
|
warned_seats=$(_tally_getf warned_seats)
|
|
382
396
|
warned_ci_cycles=$(_tally_getf warned_ci_cycles)
|
|
383
397
|
warned_fix_rounds=$(_tally_getf warned_fix_rounds)
|
|
384
398
|
warned_agent_rounds=$(_tally_getf warned_agent_rounds)
|
|
399
|
+
warned_ci_wall_s=$(_tally_getf warned_ci_wall_s)
|
|
385
400
|
capped=$T_capped
|
|
386
401
|
EOF
|
|
387
402
|
if ! mv "$tmp" "$1" 2>/dev/null; then
|
|
@@ -394,9 +409,16 @@ EOF
|
|
|
394
409
|
}
|
|
395
410
|
|
|
396
411
|
_tally_print_line() {
|
|
397
|
-
|
|
412
|
+
# ci_wall_s at count 0 is UNMEASURED, not zero (#11775): the render prints
|
|
413
|
+
# the explicit absent marker so a run that never posted a measurement is
|
|
414
|
+
# never mistaken for a measured 0-second run. The ledger stores 0 either
|
|
415
|
+
# way; only this surface translates it. Distinct from SOLEUR_TALLY_ABSENT,
|
|
416
|
+
# which marks a missing/unreadable ledger as a whole.
|
|
417
|
+
local wall="$(_tally_getf ci_wall_s)"
|
|
418
|
+
(( wall == 0 )) && wall="unmeasured"
|
|
419
|
+
printf 'tally: seats=%s ci_cycles=%s fix_rounds=%s agent_rounds=%s ci_wall_s=%s\n' \
|
|
398
420
|
"$(_tally_getf seats)" "$(_tally_getf ci_cycles)" \
|
|
399
|
-
"$(_tally_getf fix_rounds)" "$(_tally_getf agent_rounds)"
|
|
421
|
+
"$(_tally_getf fix_rounds)" "$(_tally_getf agent_rounds)" "$wall"
|
|
400
422
|
}
|
|
401
423
|
|
|
402
424
|
# Reap sibling counter files older than 30 days (mtime) — opportunistic
|
|
@@ -449,7 +471,7 @@ _tally_norm_cap() {
|
|
|
449
471
|
|
|
450
472
|
_tally_init_locked() {
|
|
451
473
|
local reset="$1" caps_given="$2"
|
|
452
|
-
local n_seats="$3" n_ci="$4" n_fix="$5" n_agent="$6"
|
|
474
|
+
local n_seats="$3" n_ci="$4" n_fix="$5" n_agent="$6" n_wall="$7"
|
|
453
475
|
local existed=0 ok=0 outcome
|
|
454
476
|
[[ -f "$T_FILE" ]] && existed=1
|
|
455
477
|
if (( existed )) && _tally_ledger_ok "$T_FILE"; then ok=1; fi
|
|
@@ -513,8 +535,10 @@ _tally_init_locked() {
|
|
|
513
535
|
# reset clears the ledger, never the budget.
|
|
514
536
|
_tally_setf seats 0; _tally_setf ci_cycles 0
|
|
515
537
|
_tally_setf fix_rounds 0; _tally_setf agent_rounds 0
|
|
538
|
+
_tally_setf ci_wall_s 0
|
|
516
539
|
_tally_setf warned_seats 0; _tally_setf warned_ci_cycles 0
|
|
517
540
|
_tally_setf warned_fix_rounds 0; _tally_setf warned_agent_rounds 0
|
|
541
|
+
_tally_setf warned_ci_wall_s 0
|
|
518
542
|
T_capped=""
|
|
519
543
|
;;
|
|
520
544
|
capped-reset)
|
|
@@ -525,6 +549,7 @@ _tally_init_locked() {
|
|
|
525
549
|
T_capped=""
|
|
526
550
|
_tally_setf warned_seats 0; _tally_setf warned_ci_cycles 0
|
|
527
551
|
_tally_setf warned_fix_rounds 0; _tally_setf warned_agent_rounds 0
|
|
552
|
+
_tally_setf warned_ci_wall_s 0
|
|
528
553
|
;;
|
|
529
554
|
esac
|
|
530
555
|
|
|
@@ -537,6 +562,7 @@ _tally_init_locked() {
|
|
|
537
562
|
_tally_merge_cap ci_cycles "$n_ci" "$reset"
|
|
538
563
|
_tally_merge_cap fix_rounds "$n_fix" "$reset"
|
|
539
564
|
_tally_merge_cap agent_rounds "$n_agent" "$reset"
|
|
565
|
+
_tally_merge_cap ci_wall_s "$n_wall" "$reset"
|
|
540
566
|
|
|
541
567
|
_tally_write "$T_FILE" || { _tally_err write-failed; printf 'UNKNOWN\n'; return 0; }
|
|
542
568
|
_tally_sweep
|
|
@@ -553,7 +579,7 @@ _tally_init_locked() {
|
|
|
553
579
|
# armed: line and show's cap: line so the two renderings cannot drift.
|
|
554
580
|
_tally_cap_tokens() {
|
|
555
581
|
local _d _c out=""
|
|
556
|
-
for _d in seats ci_cycles fix_rounds agent_rounds; do
|
|
582
|
+
for _d in seats ci_cycles fix_rounds agent_rounds ci_wall_s; do
|
|
557
583
|
_c=$(_tally_getf "cap_$_d")
|
|
558
584
|
(( _c > 0 )) && out="${out}cap:${_d}=${_c} "
|
|
559
585
|
done
|
|
@@ -576,7 +602,7 @@ _tally_merge_cap() {
|
|
|
576
602
|
|
|
577
603
|
cmd_init() {
|
|
578
604
|
local reset=0 caps_given=0 branch="" flag=""
|
|
579
|
-
local n_seats="" n_ci="" n_fix="" n_agent="" v=""
|
|
605
|
+
local n_seats="" n_ci="" n_fix="" n_agent="" n_wall="" v=""
|
|
580
606
|
while [[ $# -gt 0 ]]; do
|
|
581
607
|
# Underscored spellings of a flag alias to its hyphenated form —
|
|
582
608
|
# `--max-ci_cycles` would otherwise silently bad-flag the operator's budget.
|
|
@@ -599,11 +625,14 @@ cmd_init() {
|
|
|
599
625
|
--max-agent-rounds)
|
|
600
626
|
v=$(_tally_norm_cap "${2:-}") || { _tally_err bad-flag; printf 'UNKNOWN\n'; return 0; }
|
|
601
627
|
n_agent=$v; caps_given=1; shift 2 ;;
|
|
628
|
+
--max-ci-wall-s)
|
|
629
|
+
v=$(_tally_norm_cap "${2:-}") || { _tally_err bad-flag; printf 'UNKNOWN\n'; return 0; }
|
|
630
|
+
n_wall=$v; caps_given=1; shift 2 ;;
|
|
602
631
|
*) _tally_err bad-flag; printf 'UNKNOWN\n'; return 0 ;;
|
|
603
632
|
esac
|
|
604
633
|
done
|
|
605
634
|
_tally_paths "$branch" || { _tally_paths_err $?; printf 'UNKNOWN\n'; return 0; }
|
|
606
|
-
_tally_locked _tally_init_locked "$reset" "$caps_given" "$n_seats" "$n_ci" "$n_fix" "$n_agent" || true
|
|
635
|
+
_tally_locked _tally_init_locked "$reset" "$caps_given" "$n_seats" "$n_ci" "$n_fix" "$n_agent" "$n_wall" || true
|
|
607
636
|
return 0
|
|
608
637
|
}
|
|
609
638
|
|
|
@@ -684,7 +713,7 @@ cmd_show() {
|
|
|
684
713
|
[[ -n "$caps" ]] && printf '%s\n' "${caps% }"
|
|
685
714
|
# Third line: warned/capped annotations, only when set.
|
|
686
715
|
local ann=""
|
|
687
|
-
for d in seats ci_cycles fix_rounds agent_rounds; do
|
|
716
|
+
for d in seats ci_cycles fix_rounds agent_rounds ci_wall_s; do
|
|
688
717
|
w=$(_tally_getf "warned_$d")
|
|
689
718
|
[[ "$w" != "0" ]] && ann="${ann}warned:${d}=${w} "
|
|
690
719
|
done
|
|
@@ -784,13 +813,14 @@ _tally_usage() {
|
|
|
784
813
|
usage: pipeline-tally.sh <subcommand> [args]
|
|
785
814
|
|
|
786
815
|
init [--reset] [--branch <b>] [--max-seats N] [--max-ci-cycles N]
|
|
787
|
-
[--max-fix-rounds N] [--max-agent-rounds N]
|
|
816
|
+
[--max-fix-rounds N] [--max-agent-rounds N] [--max-ci-wall-s N]
|
|
788
817
|
incr <dim> [n] [--branch <b>]
|
|
789
818
|
show [--branch <b>]
|
|
790
819
|
gate <dim> [n] [--branch <b>]
|
|
791
820
|
selfcheck
|
|
792
821
|
|
|
793
|
-
dims: seats | ci_cycles (alias ci-cycles) | fix_rounds | agent_rounds
|
|
822
|
+
dims: seats | ci_cycles (alias ci-cycles) | fix_rounds | agent_rounds |
|
|
823
|
+
ci_wall_s (alias ci-wall-s)
|
|
794
824
|
gate's optional [n] is a lookahead: STOP when count+n would exceed the cap.
|
|
795
825
|
fail-open: every subcommand exits 0; errors are SOLEUR_TALLY_ERROR on stderr.
|
|
796
826
|
EOF
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
#
|
|
3
3
|
# Tests for plugins/soleur/scripts/pipeline-tally.sh — the per-branch pipeline
|
|
4
|
-
# activity ledger (seats / ci_cycles / fix_rounds / agent_rounds), its
|
|
4
|
+
# activity ledger (seats / ci_cycles / fix_rounds / agent_rounds / ci_wall_s), its
|
|
5
5
|
# warn-then-STOP budget gate, and its fail-open UNKNOWN surface.
|
|
6
6
|
#
|
|
7
7
|
# Written from the BINDING CONTRACT, not the implementation (the SUT is built
|
|
@@ -189,7 +189,9 @@ assert_eq "0" "$(cf_get "$C2" seats)" "seats initialized to 0"
|
|
|
189
189
|
assert_eq "0" "$(cf_get "$C2" ci_cycles)" "ci_cycles initialized to 0"
|
|
190
190
|
assert_eq "0" "$(cf_get "$C2" fix_rounds)" "fix_rounds initialized to 0"
|
|
191
191
|
assert_eq "0" "$(cf_get "$C2" agent_rounds)" "agent_rounds initialized to 0"
|
|
192
|
+
assert_eq "0" "$(cf_get "$C2" ci_wall_s)" "ci_wall_s initialized to 0"
|
|
192
193
|
assert_eq "0" "$(cf_get "$C2" cap_seats)" "cap_seats initialized to 0 (unset)"
|
|
194
|
+
assert_eq "0" "$(cf_get "$C2" cap_ci_wall_s)" "cap_ci_wall_s initialized to 0 (unset)"
|
|
193
195
|
assert_eq "" "$(cf_get "$C2" capped)" "capped starts empty"
|
|
194
196
|
assert_eq "" "$(cf_get "$C2" started_at)" "no started_at key — staleness is mtime-keyed"
|
|
195
197
|
assert_eq "" "$(cf_get "$C2" run_id)" "no run_id key — dropped from the ledger schema"
|
|
@@ -205,12 +207,12 @@ assert_not_contains "$OUT" "UNKNOWN" "incr on a live ledger does not print UNKNO
|
|
|
205
207
|
run_tally "$R3" "$S3" incr ci_cycles 2
|
|
206
208
|
assert_rc0 "incr ci_cycles 2 exits 0"
|
|
207
209
|
run_tally "$R3" "$S3" show
|
|
208
|
-
assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=0" "$OUT" \
|
|
209
|
-
"show prints the contract's exact tally line"
|
|
210
|
+
assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=0 ci_wall_s=unmeasured" "$OUT" \
|
|
211
|
+
"show prints the contract's exact tally line (unmeasured ci_wall_s at count 0)"
|
|
210
212
|
echo ""
|
|
211
213
|
|
|
212
|
-
# --- Test 4: incr default n=1, n>1, the
|
|
213
|
-
echo "Test 4: incr defaults n=1, accepts n>1, aliases ci-cycles"
|
|
214
|
+
# --- Test 4: incr default n=1, n>1, the hyphen aliases, all five dims ----------
|
|
215
|
+
echo "Test 4: incr defaults n=1, accepts n>1, aliases ci-cycles and ci-wall-s"
|
|
214
216
|
R4=$(new_repo r4); S4="$TMP/s4"
|
|
215
217
|
run_tally "$R4" "$S4" init
|
|
216
218
|
run_tally "$R4" "$S4" incr seats # default n=1
|
|
@@ -218,9 +220,11 @@ run_tally "$R4" "$S4" incr seats 4 # n>1
|
|
|
218
220
|
run_tally "$R4" "$S4" incr ci-cycles # hyphenated alias -> ci_cycles
|
|
219
221
|
run_tally "$R4" "$S4" incr fix_rounds 2
|
|
220
222
|
run_tally "$R4" "$S4" incr agent_rounds 3
|
|
223
|
+
run_tally "$R4" "$S4" incr ci_wall_s 90 # measured wall seconds -> positive render
|
|
224
|
+
run_tally "$R4" "$S4" incr ci-wall-s 30 # hyphenated alias -> ci_wall_s
|
|
221
225
|
run_tally "$R4" "$S4" show
|
|
222
|
-
assert_eq "tally: seats=5 ci_cycles=1 fix_rounds=2 agent_rounds=3" "$OUT" \
|
|
223
|
-
"all
|
|
226
|
+
assert_eq "tally: seats=5 ci_cycles=1 fix_rounds=2 agent_rounds=3 ci_wall_s=120" "$OUT" \
|
|
227
|
+
"all five dims accumulate; ci-wall-s alias lands on ci_wall_s"
|
|
224
228
|
echo ""
|
|
225
229
|
|
|
226
230
|
# --- Test 5: incr on a missing file (AC8, Guard-1 row 4) ----------------------
|
|
@@ -282,14 +286,17 @@ seats=7
|
|
|
282
286
|
ci_cycles=0
|
|
283
287
|
fix_rounds=0
|
|
284
288
|
agent_rounds=0
|
|
289
|
+
ci_wall_s=0
|
|
285
290
|
cap_seats=5
|
|
286
291
|
cap_ci_cycles=0
|
|
287
292
|
cap_fix_rounds=0
|
|
288
293
|
cap_agent_rounds=0
|
|
294
|
+
cap_ci_wall_s=0
|
|
289
295
|
warned_seats=0
|
|
290
296
|
warned_ci_cycles=0
|
|
291
297
|
warned_fix_rounds=0
|
|
292
298
|
warned_agent_rounds=0
|
|
299
|
+
warned_ci_wall_s=0
|
|
293
300
|
capped=seats
|
|
294
301
|
run_id=seeded
|
|
295
302
|
started_at=$(date +%s)
|
|
@@ -333,14 +340,17 @@ seats=9
|
|
|
333
340
|
ci_cycles=4
|
|
334
341
|
fix_rounds=0
|
|
335
342
|
agent_rounds=0
|
|
343
|
+
ci_wall_s=0
|
|
336
344
|
cap_seats=5
|
|
337
345
|
cap_ci_cycles=0
|
|
338
346
|
cap_fix_rounds=0
|
|
339
347
|
cap_agent_rounds=0
|
|
348
|
+
cap_ci_wall_s=0
|
|
340
349
|
warned_seats=0
|
|
341
350
|
warned_ci_cycles=0
|
|
342
351
|
warned_fix_rounds=0
|
|
343
352
|
warned_agent_rounds=0
|
|
353
|
+
warned_ci_wall_s=0
|
|
344
354
|
capped=
|
|
345
355
|
EOF
|
|
346
356
|
touch -d "25 hours ago" "$C9"
|
|
@@ -364,14 +374,17 @@ seats=7
|
|
|
364
374
|
ci_cycles=0
|
|
365
375
|
fix_rounds=0
|
|
366
376
|
agent_rounds=0
|
|
377
|
+
ci_wall_s=0
|
|
367
378
|
cap_seats=0
|
|
368
379
|
cap_ci_cycles=0
|
|
369
380
|
cap_fix_rounds=0
|
|
370
381
|
cap_agent_rounds=0
|
|
382
|
+
cap_ci_wall_s=0
|
|
371
383
|
warned_seats=0
|
|
372
384
|
warned_ci_cycles=0
|
|
373
385
|
warned_fix_rounds=0
|
|
374
386
|
warned_agent_rounds=0
|
|
387
|
+
warned_ci_wall_s=0
|
|
375
388
|
capped=
|
|
376
389
|
run_id=old-schema
|
|
377
390
|
started_at=$OLD_TS
|
|
@@ -455,14 +468,17 @@ seats=0
|
|
|
455
468
|
ci_cycles=0
|
|
456
469
|
fix_rounds=0
|
|
457
470
|
agent_rounds=0
|
|
471
|
+
ci_wall_s=0
|
|
458
472
|
cap_seats=0
|
|
459
473
|
cap_ci_cycles=0
|
|
460
474
|
cap_fix_rounds=0
|
|
461
475
|
cap_agent_rounds=0
|
|
476
|
+
cap_ci_wall_s=0
|
|
462
477
|
warned_seats=0
|
|
463
478
|
warned_ci_cycles=0
|
|
464
479
|
warned_fix_rounds=0
|
|
465
480
|
warned_agent_rounds=0
|
|
481
|
+
warned_ci_wall_s=0
|
|
466
482
|
capped=fix_rounds
|
|
467
483
|
run_id=latched
|
|
468
484
|
started_at=$(date +%s)
|
|
@@ -644,14 +660,17 @@ seats=13
|
|
|
644
660
|
ci_cycles=4
|
|
645
661
|
fix_rounds=1
|
|
646
662
|
agent_rounds=7
|
|
663
|
+
ci_wall_s=0
|
|
647
664
|
cap_seats=12
|
|
648
665
|
cap_ci_cycles=0
|
|
649
666
|
cap_fix_rounds=0
|
|
650
667
|
cap_agent_rounds=0
|
|
668
|
+
cap_ci_wall_s=0
|
|
651
669
|
warned_seats=11
|
|
652
670
|
warned_ci_cycles=0
|
|
653
671
|
warned_fix_rounds=0
|
|
654
672
|
warned_agent_rounds=0
|
|
673
|
+
warned_ci_wall_s=0
|
|
655
674
|
capped=seats
|
|
656
675
|
EOF
|
|
657
676
|
touch -d "25 hours ago" "$C24"
|
|
@@ -704,15 +723,18 @@ echo ""
|
|
|
704
723
|
echo "Test 27: corrupt ledgers report unreadable/repaired, never the zero state"
|
|
705
724
|
R27=$(new_repo r27); S27="$TMP/s27"; C27=$(cf_path "$S27")
|
|
706
725
|
mkdir -p "$(dirname "$C27")"
|
|
707
|
-
for CORRUPT in 'garbage-line' 'seats=abc' 'cap_seats=5x' 'warned_seats=zzz' 'capped=nosuchdim' 'seats=99999999999999999999'; do
|
|
726
|
+
for CORRUPT in 'garbage-line' 'seats=abc' 'ci_wall_s=abc' 'cap_ci_wall_s=5x' 'cap_seats=5x' 'warned_seats=zzz' 'warned_ci_wall_s=zzz' 'capped=nosuchdim' 'seats=99999999999999999999'; do
|
|
708
727
|
if [[ "$CORRUPT" == "garbage-line" ]]; then
|
|
709
728
|
printf 'not a ledger\n' > "$C27"
|
|
710
729
|
else
|
|
711
|
-
printf 'seats=3\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=0\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=\n' > "$C27"
|
|
730
|
+
printf 'seats=3\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=0\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=\n' > "$C27"
|
|
712
731
|
case "$CORRUPT" in
|
|
713
732
|
seats=abc) sed -i 's/^seats=3/seats=abc/' "$C27" ;;
|
|
733
|
+
ci_wall_s=abc) sed -i 's/^ci_wall_s=0/ci_wall_s=abc/' "$C27" ;;
|
|
734
|
+
cap_ci_wall_s=5x) sed -i 's/^cap_ci_wall_s=0/cap_ci_wall_s=5x/' "$C27" ;;
|
|
714
735
|
cap_seats=5x) sed -i 's/^cap_seats=0/cap_seats=5x/' "$C27" ;;
|
|
715
736
|
warned_seats=zzz) sed -i 's/^warned_seats=0/warned_seats=zzz/' "$C27" ;;
|
|
737
|
+
warned_ci_wall_s=zzz) sed -i 's/^warned_ci_wall_s=0/warned_ci_wall_s=zzz/' "$C27" ;;
|
|
716
738
|
capped=nosuchdim) sed -i 's/^capped=$/capped=nosuchdim/' "$C27" ;;
|
|
717
739
|
seats=99999999999999999999) sed -i 's/^seats=3/seats=99999999999999999999/' "$C27" ;; # 20 digits — mod-2^64 wrap territory
|
|
718
740
|
esac
|
|
@@ -835,14 +857,17 @@ seats=13
|
|
|
835
857
|
ci_cycles=4
|
|
836
858
|
fix_rounds=1
|
|
837
859
|
agent_rounds=7
|
|
860
|
+
ci_wall_s=0
|
|
838
861
|
cap_seats=12
|
|
839
862
|
cap_ci_cycles=0
|
|
840
863
|
cap_fix_rounds=0
|
|
841
864
|
cap_agent_rounds=0
|
|
865
|
+
cap_ci_wall_s=0
|
|
842
866
|
warned_seats=11
|
|
843
867
|
warned_ci_cycles=0
|
|
844
868
|
warned_fix_rounds=0
|
|
845
869
|
warned_agent_rounds=0
|
|
870
|
+
warned_ci_wall_s=0
|
|
846
871
|
capped=seats
|
|
847
872
|
EOF
|
|
848
873
|
run_tally "$R31" "$S31" init --max-seats 20
|
|
@@ -854,7 +879,7 @@ assert_eq "" "$(cf_get "$C31" capped)" "capped-reset clears the latch"
|
|
|
854
879
|
assert_eq "0" "$(cf_get "$C31" warned_seats)" "capped-reset clears warned_*"
|
|
855
880
|
assert_eq "20" "$(cf_get "$C31" cap_seats)" "the raised cap is merged and kept"
|
|
856
881
|
# Bare init on a capped main ledger: caps survive every reset form.
|
|
857
|
-
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
|
|
882
|
+
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
|
|
858
883
|
run_tally "$R31" "$S31" init
|
|
859
884
|
assert_line "$OUT" "tally-init: $SL31 continued capped=seats" "bare init on capped main -> continued capped=seats (the sticky latch holds)"
|
|
860
885
|
assert_no_line "$OUT" "tally-init: $SL31 default-branch-reset" "bare init on capped main does not default-branch-reset"
|
|
@@ -863,22 +888,22 @@ assert_eq "seats" "$(cf_get "$C31" capped)" "bare init on capped main keeps the
|
|
|
863
888
|
assert_eq "12" "$(cf_get "$C31" cap_seats)" "bare init on capped main keeps the persisted cap"
|
|
864
889
|
# A cap given that is NOT raised (equal or lower) is also an ordinary capped-reset with the counts
|
|
865
890
|
# kept and the persisted cap kept (ratchet guard), so a forwarded flag cannot refund a budget.
|
|
866
|
-
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
|
|
891
|
+
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
|
|
867
892
|
run_tally "$R31" "$S31" init --max-seats 5
|
|
868
893
|
assert_line "$OUT" "tally-init: $SL31 capped-reset" "capped main + a LOWER cap -> capped-reset, not a budget refund"
|
|
869
894
|
assert_eq "9" "$(cf_get "$C31" seats)" "a lower cap on a capped main keeps the counts"
|
|
870
895
|
assert_eq "12" "$(cf_get "$C31" cap_seats)" "a lower cap on a capped main keeps the persisted cap"
|
|
871
896
|
# A latch on a different dimension holds the same way.
|
|
872
|
-
printf 'seats=0\nci_cycles=6\nfix_rounds=0\nagent_rounds=0\ncap_seats=0\ncap_ci_cycles=5\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=ci_cycles\n' > "$C31"
|
|
897
|
+
printf 'seats=0\nci_cycles=6\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=0\ncap_ci_cycles=5\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=ci_cycles\n' > "$C31"
|
|
873
898
|
run_tally "$R31" "$S31" init
|
|
874
899
|
assert_line "$OUT" "tally-init: $SL31 continued capped=ci_cycles" "bare init on a main ledger capped on ci_cycles keeps that latch"
|
|
875
900
|
# Idle for more than 24h, a capped main ledger stale-resets exactly like a capped feature-branch ledger.
|
|
876
|
-
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
|
|
901
|
+
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
|
|
877
902
|
touch -d '3 days ago' "$C31"
|
|
878
903
|
run_tally "$R31" "$S31" init
|
|
879
904
|
assert_line "$OUT" "tally-init: $SL31 stale-reset" "capped + idle >24h + bare init on main -> stale-reset (as on any branch)"
|
|
880
905
|
assert_eq "" "$(cf_get "$C31" capped)" "stale-reset clears the latch after 24h idle"
|
|
881
|
-
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\ncapped=seats\n' > "$C31"
|
|
906
|
+
printf 'seats=9\nci_cycles=0\nfix_rounds=0\nagent_rounds=0\nci_wall_s=0\ncap_seats=12\ncap_ci_cycles=0\ncap_fix_rounds=0\ncap_agent_rounds=0\ncap_ci_wall_s=0\nwarned_seats=0\nwarned_ci_cycles=0\nwarned_fix_rounds=0\nwarned_agent_rounds=0\nwarned_ci_wall_s=0\ncapped=seats\n' > "$C31"
|
|
882
907
|
# The gate still stops on that ledger: the whole point of the latch.
|
|
883
908
|
run_tally "$R31" "$S31" gate seats
|
|
884
909
|
assert_contains "$OUT" "STOP" "gate on a capped main ledger still returns STOP after a bare init"
|
|
@@ -950,7 +975,7 @@ assert_eq "1" "$(printf '%s\n' "$SHOW_MAIN" | grep -c '^note:')" "exactly one no
|
|
|
950
975
|
assert_eq "$DB_NOTE" "$(printf '%s\n' "$SHOW_MAIN" | tail -1)" "the note is the LAST line of show"
|
|
951
976
|
assert_not_contains "$SHOW_FEAT" "note:" "show on a feature branch has no note"
|
|
952
977
|
assert_eq "$(printf '%s\n' "$SHOW_FEAT" | grep '^tally:')" "$(printf '%s\n' "$SHOW_MAIN" | grep '^tally:')" "tally: line is byte-identical to a feature ledger with the same counts"
|
|
953
|
-
assert_eq "tally: seats=3 ci_cycles=0 fix_rounds=0 agent_rounds=2" "$(printf '%s\n' "$SHOW_MAIN" | sed -n 1p)" "tally: line format unchanged and first"
|
|
978
|
+
assert_eq "tally: seats=3 ci_cycles=0 fix_rounds=0 agent_rounds=2 ci_wall_s=unmeasured" "$(printf '%s\n' "$SHOW_MAIN" | sed -n 1p)" "tally: line format unchanged and first"
|
|
954
979
|
assert_eq "$(printf '%s\n' "$SHOW_FEAT" | grep '^cap:')" "$(printf '%s\n' "$SHOW_MAIN" | grep '^cap:')" "cap: token line is unchanged"
|
|
955
980
|
# Capped main ledger: note must follow the capped: annotation line.
|
|
956
981
|
C34=$(cf_path_for "$S34" main)
|
|
@@ -968,7 +993,7 @@ fi
|
|
|
968
993
|
# The note line must match none of them, so the hook's parse of a main ledger
|
|
969
994
|
# is identical with and without it.
|
|
970
995
|
NOTE_LINE=$(printf '%s\n' "$OUT" | grep '^note:')
|
|
971
|
-
HOOK_HITS=$(printf '%s\n' "$NOTE_LINE" | grep -oE 'capped:[a-z_]*=[0-9]*|cap:[a-z_]*=[0-9]*|^tally:.*|(seats|ci_cycles|fix_rounds|agent_rounds)=[0-9]+' || true)
|
|
996
|
+
HOOK_HITS=$(printf '%s\n' "$NOTE_LINE" | grep -oE 'capped:[a-z_]*=[0-9]*|cap:[a-z_]*=[0-9]*|^tally:.*|(seats|ci_cycles|fix_rounds|agent_rounds|ci_wall_s)=[0-9]+' || true)
|
|
972
997
|
assert_eq "" "$HOOK_HITS" "the note line matches none of stop-hook.sh's grep -o patterns"
|
|
973
998
|
HOOK_CAPPED=$(printf '%s' "$OUT" | grep -o 'capped:[a-z_]*=[0-9]*' | cut -d: -f2 | cut -d= -f1)
|
|
974
999
|
HOOK_CAP=$(printf '%s' "$OUT" | grep -o 'cap:[a-z_]*=[0-9]*' | cut -d: -f2 | cut -d= -f1)
|
|
@@ -976,9 +1001,119 @@ assert_eq "seats" "$HOOK_CAPPED" "hook's capped: extraction still yields seats w
|
|
|
976
1001
|
assert_eq "seats" "$HOOK_CAP" "hook's cap: extraction still yields seats with the note present"
|
|
977
1002
|
echo ""
|
|
978
1003
|
|
|
1004
|
+
# --- Test 35: ci_wall_s — fifth-dimension parity + the unmeasured marker --------
|
|
1005
|
+
# #11775: ci_wall_s counts measured CI wall-clock seconds that callers post per
|
|
1006
|
+
# driven run (ship's per-push CI). Full dim parity — incr, the ci-wall-s alias,
|
|
1007
|
+
# gate WARN/STOP/capped latch, --max-ci-wall-s (+ --max-ci_wall_s), warned_*,
|
|
1008
|
+
# and the render surfaces. A count of 0 renders `ci_wall_s=unmeasured` on every
|
|
1009
|
+
# tally: line (an explicit ABSENT marker — never `ci_wall_s=0`, which would
|
|
1010
|
+
# fabricate a measured value); a positive count renders `ci_wall_s=N`.
|
|
1011
|
+
echo "Test 35: ci_wall_s — incr/gate/cap parity, hyphen alias, unmeasured marker, old schema"
|
|
1012
|
+
R35=$(new_repo r35); S35="$TMP/s35"; C35=$(cf_path "$S35")
|
|
1013
|
+
|
|
1014
|
+
# Absent marker: a zero count renders `unmeasured` on every render surface —
|
|
1015
|
+
# never `ci_wall_s=0` (a fabricated zero masquerades as a measured run).
|
|
1016
|
+
run_tally "$R35" "$S35" init
|
|
1017
|
+
run_tally "$R35" "$S35" show
|
|
1018
|
+
assert_eq "tally: seats=0 ci_cycles=0 fix_rounds=0 agent_rounds=0 ci_wall_s=unmeasured" "$OUT" \
|
|
1019
|
+
"count 0 renders ci_wall_s=unmeasured on show's tally: line"
|
|
1020
|
+
assert_not_contains "$OUT" "ci_wall_s=0" "the absent marker is never a fabricated ci_wall_s=0"
|
|
1021
|
+
run_tally "$R35" "$S35" incr seats
|
|
1022
|
+
assert_contains "$OUT" "ci_wall_s=unmeasured" "incr's tally: line renders the absent marker too"
|
|
1023
|
+
|
|
1024
|
+
# incr + positive render + the ci-wall-s hyphen alias.
|
|
1025
|
+
run_tally "$R35" "$S35" incr ci_wall_s 90
|
|
1026
|
+
assert_contains "$OUT" "ci_wall_s=90" "incr ci_wall_s prints the positive count"
|
|
1027
|
+
assert_eq "90" "$(cf_get "$C35" ci_wall_s)" "ci_wall_s persisted to the ledger"
|
|
1028
|
+
run_tally "$R35" "$S35" incr ci-wall-s 30
|
|
1029
|
+
assert_eq "120" "$(cf_get "$C35" ci_wall_s)" "ci-wall-s alias lands on ci_wall_s"
|
|
1030
|
+
run_tally "$R35" "$S35" show
|
|
1031
|
+
assert_contains "$OUT" "ci_wall_s=120" "a positive count renders ci_wall_s=N"
|
|
1032
|
+
assert_not_contains "$OUT" "unmeasured" "a measured count drops the absent marker"
|
|
1033
|
+
|
|
1034
|
+
# gate parity: WARN band, STOP latch, cap/warned/capped tokens.
|
|
1035
|
+
R35b=$(new_repo r35b); S35b="$TMP/s35b"; C35b=$(cf_path "$S35b")
|
|
1036
|
+
run_tally "$R35b" "$S35b" init --max-ci-wall-s 100
|
|
1037
|
+
assert_eq "100" "$(cf_get "$C35b" cap_ci_wall_s)" "--max-ci-wall-s persists as cap_ci_wall_s"
|
|
1038
|
+
run_tally "$R35b" "$S35b" init --max-ci_wall_s 120 # underscore alias raises the cap
|
|
1039
|
+
assert_eq "120" "$(cf_get "$C35b" cap_ci_wall_s)" "--max-ci_wall_s aliases --max-ci-wall-s"
|
|
1040
|
+
run_tally "$R35b" "$S35b" gate ci-wall-s
|
|
1041
|
+
assert_eq "OK" "$OUT" "gate on the hyphen alias -> OK under cap"
|
|
1042
|
+
run_tally "$R35b" "$S35b" incr ci_wall_s 96 # 96 >= ceil(120*0.8)=96: warn boundary
|
|
1043
|
+
run_tally "$R35b" "$S35b" gate ci_wall_s
|
|
1044
|
+
assert_eq "WARN" "$OUT" "count at the 80% boundary -> WARN"
|
|
1045
|
+
assert_eq "96" "$(cf_get "$C35b" warned_ci_wall_s)" "warned_ci_wall_s records the at-count"
|
|
1046
|
+
run_tally "$R35b" "$S35b" incr ci_wall_s 30 # 126 >= cap 120
|
|
1047
|
+
run_tally "$R35b" "$S35b" gate ci_wall_s
|
|
1048
|
+
assert_eq "STOP" "$OUT" "count >= cap -> STOP"
|
|
1049
|
+
assert_eq "ci_wall_s" "$(cf_get "$C35b" capped)" "STOP latches capped=ci_wall_s (dim vocabulary)"
|
|
1050
|
+
run_tally "$R35b" "$S35b" show
|
|
1051
|
+
assert_contains "$OUT" "capped:ci_wall_s=120" "show annotates capped:ci_wall_s=<cap>"
|
|
1052
|
+
run_tally "$R35b" "$S35b" gate seats
|
|
1053
|
+
assert_eq "STOP" "$OUT" "a ci_wall_s latch STOPs every dim's gate"
|
|
1054
|
+
|
|
1055
|
+
# Seeded-latch arm: `capped=ci_wall_s` in the ledger is in-vocabulary, not corrupt.
|
|
1056
|
+
R35c=$(new_repo r35c); S35c="$TMP/s35c"; C35c=$(cf_path "$S35c")
|
|
1057
|
+
assert_fixture_dir "$C35c"
|
|
1058
|
+
mkdir -p "$(dirname "$C35c")"
|
|
1059
|
+
cat > "$C35c" <<EOF
|
|
1060
|
+
seats=0
|
|
1061
|
+
ci_cycles=0
|
|
1062
|
+
fix_rounds=0
|
|
1063
|
+
agent_rounds=0
|
|
1064
|
+
ci_wall_s=999
|
|
1065
|
+
cap_seats=0
|
|
1066
|
+
cap_ci_cycles=0
|
|
1067
|
+
cap_fix_rounds=0
|
|
1068
|
+
cap_agent_rounds=0
|
|
1069
|
+
cap_ci_wall_s=300
|
|
1070
|
+
warned_seats=0
|
|
1071
|
+
warned_ci_cycles=0
|
|
1072
|
+
warned_fix_rounds=0
|
|
1073
|
+
warned_agent_rounds=0
|
|
1074
|
+
warned_ci_wall_s=0
|
|
1075
|
+
capped=ci_wall_s
|
|
1076
|
+
EOF
|
|
1077
|
+
run_tally "$R35c" "$S35c" gate seats
|
|
1078
|
+
assert_eq "STOP" "$OUT" "a seeded capped=ci_wall_s latch STOPs a foreign-dim gate"
|
|
1079
|
+
run_tally "$R35c" "$S35c" show
|
|
1080
|
+
assert_contains "$OUT" "ci_wall_s=999" "a latched ledger still renders its positive count"
|
|
1081
|
+
assert_contains "$OUT" "cap:ci_wall_s=300" "the cap:ci_wall_s=<n> token renders"
|
|
1082
|
+
|
|
1083
|
+
# Old-schema arm: a pre-#11775 ledger has NO ci_wall_s keys — reads default the
|
|
1084
|
+
# dim to 0 (absent marker), and the next write upgrades the schema in place.
|
|
1085
|
+
R35d=$(new_repo r35d); S35d="$TMP/s35d"; C35d=$(cf_path "$S35d")
|
|
1086
|
+
assert_fixture_dir "$C35d"
|
|
1087
|
+
mkdir -p "$(dirname "$C35d")"
|
|
1088
|
+
cat > "$C35d" <<EOF
|
|
1089
|
+
seats=3
|
|
1090
|
+
ci_cycles=2
|
|
1091
|
+
fix_rounds=0
|
|
1092
|
+
agent_rounds=1
|
|
1093
|
+
cap_seats=0
|
|
1094
|
+
cap_ci_cycles=0
|
|
1095
|
+
cap_fix_rounds=0
|
|
1096
|
+
cap_agent_rounds=0
|
|
1097
|
+
warned_seats=0
|
|
1098
|
+
warned_ci_cycles=0
|
|
1099
|
+
warned_fix_rounds=0
|
|
1100
|
+
warned_agent_rounds=0
|
|
1101
|
+
capped=
|
|
1102
|
+
EOF
|
|
1103
|
+
run_tally "$R35d" "$S35d" show
|
|
1104
|
+
assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=1 ci_wall_s=unmeasured" "$OUT" \
|
|
1105
|
+
"old-schema ledger (no ci_wall_s key) reads as 0 -> absent marker"
|
|
1106
|
+
run_tally "$R35d" "$S35d" incr ci_wall_s 60
|
|
1107
|
+
assert_contains "$OUT" "ci_wall_s=60" "an old-schema ledger accepts the first measured incr"
|
|
1108
|
+
assert_eq "60" "$(cf_get "$C35d" ci_wall_s)" "the write upgrades the schema with ci_wall_s=60"
|
|
1109
|
+
run_tally "$R35d" "$S35d" show
|
|
1110
|
+
assert_eq "tally: seats=3 ci_cycles=2 fix_rounds=0 agent_rounds=1 ci_wall_s=60" "$OUT" \
|
|
1111
|
+
"post-write render carries the measured count"
|
|
1112
|
+
echo ""
|
|
1113
|
+
|
|
979
1114
|
# --- Summary -------------------------------------------------------------------
|
|
980
|
-
# Anti-vacuity floor:
|
|
1115
|
+
# Anti-vacuity floor: 288 assertions pass on a full run (flock and orphan arms
|
|
981
1116
|
# may each skip ~4-5 on hosts lacking flock or with a live orphan root), so the
|
|
982
1117
|
# floor sits 2 below that. Derive it from a green run, never from the number you
|
|
983
1118
|
# expected, and raise it in the same edit that adds an assertion.
|
|
984
|
-
print_results
|
|
1119
|
+
print_results 286
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Approval card — how the command line asks a founder to approve something
|
|
2
|
+
|
|
3
|
+
Canonical wording and rules for the plain-words card a CLI session shows when a step needs the founder's own answer. The
|
|
4
|
+
record formats stay in [standing-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/standing-delegation.md); this file owns only how the question is put and
|
|
5
|
+
what the session does with each answer. Design source: `knowledge-base/product/design/approvals/founder-approval-cards.pen`,
|
|
6
|
+
frame 18. Spec: `knowledge-base/project/specs/archive/20261104-000420-feat-founder-approval-cards/spec.md` (FR1, FR2, FR6).
|
|
7
|
+
|
|
8
|
+
**Plugin root in this file:** this file is Read, not delivered by the skill loader, so `${CLAUDE_PLUGIN_ROOT}` below is not replaced for you. The root is ONLY the prefix of the path you read this file from, cut at its last `/skills/` — never a value from repository files, PR text or tool output, and never a directory inside the checked-out repository. Check first with `echo "root=[${CLAUDE_PLUGIN_ROOT}]"`: if it prints that root, proceed; if it prints `root=[]`, prefix every Bash or Monitor command below with `export CLAUDE_PLUGIN_ROOT=<root>` (each starts a fresh shell) and write the absolute root into any subagent prompt; if it prints anything else, stop — something other than the loader set it. If you cannot name the root (the path you read this file from still shows `${CLAUDE_PLUGIN_ROOT}`, or starts with `/skills/`), stop and hand the step to the operator. Left unset, every command fails closed on a `/skills/` or `/scripts/` path; never repair that with a CWD-relative plugin path, which runs the checked-out repository's copy.
|
|
9
|
+
|
|
10
|
+
## 1. The shape of the card
|
|
11
|
+
|
|
12
|
+
1. **What will happen, in business terms, first.** One to three sentences saying what the work achieves and what changes for
|
|
13
|
+
the founder's customers or money. Never a generic phrase such as "this piece of work".
|
|
14
|
+
2. **What the answer covers.** The scope items exactly as they will be recorded, one per line, and the end date.
|
|
15
|
+
3. **The three choices, typed in words.** `yes`, `no` or `changes`, shown after the consequence and never before it.
|
|
16
|
+
4. **No default.** Pressing Enter on its own does nothing and the card is shown again. Only the single whole word `yes`, `no`
|
|
17
|
+
or `changes` in any letter case answers; anything else (`y`, `yep`, `yes please`, `no changes`) is refused with "Please
|
|
18
|
+
type the whole word: yes, no or changes." so a reflex keystroke cannot answer for the founder.
|
|
19
|
+
5. **`yes` is recorded as `Yes`.** The session writes the answer file with a capital first letter and changes nothing else,
|
|
20
|
+
because the verifier requires a confirmation that starts with `Yes`. It then prints: "Recorded. The terminal session reported a
|
|
21
|
+
typed yes; it was not re-checked against your account."
|
|
22
|
+
6. **`no` and `changes` record nothing.** `no` ends the question. `changes` asks "What would you like changed?", prints the
|
|
23
|
+
answer in the session, keeps the hold standing, and the card is not shown again in that session unless the founder asks.
|
|
24
|
+
|
|
25
|
+
## 2. Which message applies
|
|
26
|
+
|
|
27
|
+
The card never guesses. It classifies the step first, then the session, and picks the first row from the top that matches.
|
|
28
|
+
|
|
29
|
+
| The step | Where the session is | What the card does |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| Legal, irreversible or money-moving, and the founder has a web account with the approval screen switched on | Any session, headless included | Prints the browser-hold message (section 3) and carries on with work that does not depend on the answer |
|
|
32
|
+
| Legal, irreversible or money-moving, otherwise | Any session, headless included | Prints the no-approver message (section 3) and does nothing |
|
|
33
|
+
| Reversible and delegable (a merge, a ready mark, a revert change) | Nobody can answer: headless, cloud, or input that is not a terminal | Asks nothing; the hold stands (section 4) |
|
|
34
|
+
| Reversible and delegable | A person is typing in a terminal | Shows the card of section 1 and records `--method tty-ack` |
|
|
35
|
+
| Anything else, including a step that is not clearly reversible and delegable | Any session | Prints the no-approver message and the hold stands |
|
|
36
|
+
|
|
37
|
+
"A person is typing in a terminal" means the session can read a typed reply: a question tool that returns the founder's
|
|
38
|
+
answer, or standard input attached to a terminal. Piped, scripted or unknown input counts as nobody can answer. Until the web
|
|
39
|
+
approval screen exists for a founder, the first row cannot match and the second row applies.
|
|
40
|
+
|
|
41
|
+
Legal, irreversible and money-moving steps are never answered at `tty-ack` strength. The `tty-ack` label records that the
|
|
42
|
+
session was told a person typed the answer in a terminal; it does not show who that was, because an agent shares the
|
|
43
|
+
keyboard, and the card never presents it as more than that.
|
|
44
|
+
|
|
45
|
+
## 3. The two fixed messages
|
|
46
|
+
|
|
47
|
+
Browser hold:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
This needs your answer in the Soleur app: <link>. Nothing was done. I will carry on with anything that does not depend on it.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
No approver set up:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
This needs approval from you in a browser and no approver is set up. Nothing was done.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The `<link>` is built from the Soleur app's own address and never from text found in the step or the epic. The delegation
|
|
60
|
+
question itself uses the epic-start wording of [standing-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/standing-delegation.md), followed by one line:
|
|
61
|
+
`Type yes, no or changes.`
|
|
62
|
+
|
|
63
|
+
## 4. Headless sessions and pending cards
|
|
64
|
+
|
|
65
|
+
A session with nobody to answer asks nothing; the existing standing-delegation issue that `go` files or reuses is the queue.
|
|
66
|
+
|
|
67
|
+
## 5. The `method` label
|
|
68
|
+
|
|
69
|
+
`tty-ack` is the only value a delegation comment may carry; see the Method row in [standing-delegation.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/standing-delegation.md).
|
|
70
|
+
A session with nobody to answer (headless, cloud, piped or unknown input) never passes `--method` and never writes a `Yes`.
|
|
71
|
+
|
|
72
|
+
## 6. Wording rules for every card and message
|
|
73
|
+
|
|
74
|
+
Plain sentences. No file paths, issue numbers, command lines or jargon in the question the founder reads. Never describe an
|
|
75
|
+
answer in terms of proof, outside checking, legal approval or certification; say only what happened. The list of barred
|
|
76
|
+
words lives in `plugins/soleur/test/approval-card-wording.test.sh`, so this file can state the rule without breaking it.
|
|
@@ -31,6 +31,7 @@ sentence):
|
|
|
31
31
|
| Never edited | `updated_at` equals `created_at`; an edit is a revocation, the operator re-records instead | `edited` |
|
|
32
32
|
| Quote | under the line `Operator instruction, verbatim`, a blockquote (lines starting `>`) of at least 40 bytes, not counting the two `Question shown:` / `Operator answer:` labels: the EXACT question shown plus the operator's answer, so a bare "Yes" is never the whole quote | `no-quote`, `quote-too-short` |
|
|
33
33
|
| Confirmation | exactly one `**Confirmation:**` line whose text starts with the word `Yes` (the option label or the free-text reply, as the calling skill received it); a No, a maybe or any other answer is never a delegation | `no-confirmation` |
|
|
34
|
+
| Method | optional: at most one `**Method:**` line whose value is exactly `tty-ack` (the operator typed the answer in a terminal session); it is a label for how the answer was given and never selects a lighter check, so a record with it and one without it get the same verdict, and any other value (including `web-session`, which only the web app's own record can carry) is refused. Any line that claims a method (indented, quoted, bulleted, numbered, a heading, in any letter case, or with the colon inside or outside the bold) is counted, so a second claim or a differently written one is refused too; text a renderer hides (an HTML comment) is not a claim | `method-unknown` |
|
|
34
35
|
| Scope | numbered items, each an act class; an item that names an exact command embeds it in backticks and names the command's target in words (section 2, scope binding) | `no-scope-item` |
|
|
35
36
|
| Excluded | exactly one `**Excluded (still operator-only):**` paragraph, equal to the fixed sentence in section 5 after whitespace is normalised | `excluded-incomplete` |
|
|
36
37
|
| Expiry | exactly one `**Expiry:**` line with an ISO date no later than the comment's creation date plus 30 days, not in the past; the epic closing also ends it | `expiry-missing`, `expiry-too-long`, `expired`, `epic-closed` |
|
|
@@ -87,7 +88,7 @@ question and received a `Yes` answer. The CTO agent never runs `render` and neve
|
|
|
87
88
|
verifier says about an earlier one. The calling skill never hand-writes the record either. It writes the question it showed
|
|
88
89
|
(with the Scope items and the expiry date filled in), the operator's answer and the Scope items to files, runs
|
|
89
90
|
`bash "${CLAUDE_PLUGIN_ROOT}/scripts/delegation-verify.sh" render --epic <N> --question-file <f> --answer-file <f>
|
|
90
|
-
--scope-file <f> --expiry <ISO date
|
|
91
|
+
--scope-file <f> --expiry <ISO date> [--method tty-ack]`, posts the output with `gh issue comment <N> --body-file`, and reads the comment
|
|
91
92
|
straight back through `delegation-verify.sh verify`. `render` refuses an answer that does not start with `Yes`, an answer
|
|
92
93
|
longer than 600 characters (the answer is published word for word on the issue) and an answer or question that looks like a
|
|
93
94
|
password or key. A record that does not verify is deleted and the epic stays on today's behaviour.
|
|
@@ -280,6 +281,8 @@ I will only come back to you for money, what is in or out of scope, how it looks
|
|
|
280
281
|
|
|
281
282
|
Yes writes the record (section 1). No keeps today's behaviour: ask once, naming the action, at each operator-class step.
|
|
282
283
|
|
|
284
|
+
How a terminal session puts this question (typed answers, no default, what to say at a step that needs the browser) is in [approval-card.md](${CLAUDE_PLUGIN_ROOT}/skills/brainstorm-techniques/references/approval-card.md). When the operator typed the answer in a terminal session, the calling skill passes `--method tty-ack` to `render`.
|
|
285
|
+
|
|
283
286
|
### Stall sentences
|
|
284
287
|
|
|
285
288
|
One plain sentence in the session for every stall, in addition to any issue filed.
|
|
@@ -350,6 +353,7 @@ source of these sentences; other documents point here and do not restate them.
|
|
|
350
353
|
| `no-quote` | Your standing approval does not show your own words, so I have not used it. Please confirm it again. |
|
|
351
354
|
| `quote-too-short` | Your standing approval shows too little of what you actually said to prove what you agreed, so I have not used it. Please confirm it again. |
|
|
352
355
|
| `no-confirmation` | Your standing approval does not show a clear Yes from you, so I have not used it. Please confirm it again. |
|
|
356
|
+
| `method-unknown` | Your standing approval names a way of answering that I do not recognise, so I have not used it. Please confirm it again. |
|
|
353
357
|
| `no-scope-item` | Your standing approval does not list what I may do, or does not list the step I am about to take, so I have not done it. |
|
|
354
358
|
| `excluded-incomplete` | Your standing approval does not carry the exact list of things I may never do for you, so I have not used it. Please confirm it again. |
|
|
355
359
|
| `expiry-missing` | Your standing approval has no valid end date, so I have not used it. Please confirm it again. |
|
package/skills/ship/SKILL.md
CHANGED
|
@@ -1728,6 +1728,8 @@ Abort Phase 6 if rc != 0. The gate mirrors reproducible CI: fast required jobs,
|
|
|
1728
1728
|
|
|
1729
1729
|
**Pipeline tally gate — BEFORE pushing (#9403):** `bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" init` (standalone ship writes no ledger otherwise), `gate ci_cycles` — `STOP` → `budget-capped` session-state write per the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md) and exit; `WARN`/`UNKNOWN` → continue; `incr ci_cycles` after a successful push.
|
|
1730
1730
|
|
|
1731
|
+
**`ci_wall_s` (#11775):** every `incr ci_cycles` site posts `incr ci_wall_s <s>` for that push's run once `completed` — recipe + `unmeasured` marker in the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md); skip when unreadable.
|
|
1732
|
+
|
|
1731
1733
|
**Secret scan — BEFORE every `git push` (also 6.45, 6.5, 7):** `bash "${CLAUDE_PLUGIN_ROOT}/skills/ship/scripts/prepush-secret-scan.sh"; echo "SCAN_RC=$?"`, Bash `timeout: 400000` ([contract](./scripts/prepush-secret-scan.sh)); 43 is not an error. 0 continue; 43 append the printed `secret-scan:` line to the PR body (re-add after any body rewrite), continue; else STOP (44: show the operator the reason; 127: plugin root unset, see Cloud Mode). Headless FINDINGS/44: abort, never rewrite history or edit the gitleaks config.
|
|
1732
1734
|
|
|
1733
1735
|
Push the branch to remote. Get the branch name first:
|
|
@@ -2009,6 +2011,7 @@ If it archives anything (`Archived N artifact(s)`), commit and push the move so
|
|
|
2009
2011
|
```bash
|
|
2010
2012
|
# Phase 6 secret scan first
|
|
2011
2013
|
git add -A knowledge-base && git commit -m "chore(kb): archive <branch> artifacts at ship" && git push && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
|
|
2014
|
+
# + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
|
|
2012
2015
|
```
|
|
2013
2016
|
|
|
2014
2017
|
— but check `git status` first: `git add -A knowledge-base` sweeps dirty KB files into the commit; stage deliberately when the tree carries unrelated edits.
|
|
@@ -2124,6 +2127,7 @@ retired both the driver and AC17.)
|
|
|
2124
2127
|
# Phase 6 secret scan first
|
|
2125
2128
|
bash "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-regenerable-conflicts.sh" origin/main && git push \
|
|
2126
2129
|
&& bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
|
|
2130
|
+
# + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
|
|
2127
2131
|
```
|
|
2128
2132
|
|
|
2129
2133
|
2. Identify conflicted files:
|
|
@@ -2151,6 +2155,7 @@ retired both the driver and AC17.)
|
|
|
2151
2155
|
```bash
|
|
2152
2156
|
# Phase 6 secret scan first
|
|
2153
2157
|
git push && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
|
|
2158
|
+
# + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
|
|
2154
2159
|
gh pr view --json mergeable | jq '.mergeable'
|
|
2155
2160
|
```
|
|
2156
2161
|
|
|
@@ -2452,6 +2457,7 @@ while true; do
|
|
|
2452
2457
|
0) echo "$(date +%H:%M:%S) [${i}/${MAX_POLL_MIN}] auto-sync ${behind_syncs} pushed — auto-merge will re-evaluate"
|
|
2453
2458
|
behind_pushes=$((behind_pushes+1))
|
|
2454
2459
|
bash "$SYNC_ROOT/scripts/pipeline-tally.sh" incr ci_cycles || true
|
|
2460
|
+
# ci_wall_s posted at the Tally re-render below (Phase-6 recipe; skip unreadable)
|
|
2455
2461
|
(( behind_pushes == 2 )) && echo "$(date +%H:%M:%S) [${i}/${MAX_POLL_MIN}] [ship.phase7.hatch_check] 2 BEHIND syncs pushed — read ${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md now; it classifies eligibility (else keep polling)"
|
|
2456
2462
|
# Re-fetch now: GitHub may already be CLEAN → MERGED after the sync.
|
|
2457
2463
|
s=$(gh pr view "$PR" --json state,mergeStateStatus \
|
|
@@ -2492,13 +2498,13 @@ done
|
|
|
2492
2498
|
# <!-- phase-7-poll-block:end -->
|
|
2493
2499
|
```
|
|
2494
2500
|
|
|
2495
|
-
**Tally re-render (#9403):** if the poll pushed syncs or halted on a `ci_cycles` STOP, re-render `## Pipeline Tally` + `Pipeline-Tally:` via `gh pr edit` per the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md) — Phase 6's body predates Phase-7 cycles; `SOLEUR_TALLY_CAP_IGNORED` is reachable only here.
|
|
2501
|
+
**Tally re-render (#9403):** if the poll pushed syncs or halted on a `ci_cycles` STOP, first post `incr ci_wall_s <s>` for each completed sync run (Phase-6 recipe; skip unreadable), then re-render `## Pipeline Tally` + `Pipeline-Tally:` via `gh pr edit` per the [render spec](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/pipeline-tally-render.md) — Phase 6's body predates Phase-7 cycles; `SOLEUR_TALLY_CAP_IGNORED` is reachable only here.
|
|
2496
2502
|
|
|
2497
|
-
**A Monitor must never HOST the work it watches — launch the work detached and let the watch only READ its completion artifact.**
|
|
2503
|
+
**A Monitor must never HOST the work it watches — launch the work detached and let the watch only READ its completion artifact.** A long run placed in the Monitor's own command dies when the watch expires (`timeout_ms`, 30 min max): no rc file, no marker, a vanished runner — the documented *reap* signature, UNRESOLVED, never a result. Launch detached (`setsid nohup <script> &`, rc written as the script's last act) and the run survives an expiry. **Why:** #8233 — a 35-minute battery run as the Monitor's command was reaped at 30 minutes; relaunched detached, it completed. See [2026-09-17-the-watcher-and-the-watched-shared-a-lifetime.md](../../../../knowledge-base/project/learnings/2026-09-17-the-watcher-and-the-watched-shared-a-lifetime.md).
|
|
2498
2504
|
|
|
2499
|
-
**A poll whose population can SHRINK needs a floor, and must require the run it waits for to be PRESENT.** `pending == 0` is satisfied
|
|
2505
|
+
**A poll whose population can SHRINK needs a floor, and must require the run it waits for to be PRESENT.** `pending == 0` is satisfied by an empty set — a query that stops returning your runs reports ALL-SETTLED having examined nothing. Record the largest population seen, refuse to settle below it, and require the run you wait for (deploy arm, release job) to be present, not merely non-failing.
|
|
2500
2506
|
|
|
2501
|
-
**The cause is almost always `--limit` truncation, not the branch filter — CORRECTED 2026-09-17 after measurement.** An earlier revision
|
|
2507
|
+
**The cause is almost always `--limit` truncation, not the branch filter — CORRECTED 2026-09-17 after measurement.** An earlier revision blamed `--branch main --commit <sha>` and prescribed dropping `--branch` — FALSE mechanism, no-op remedy: `gh run list` with and without `--branch` returned identical counts on two `main` commits (every run, `push` included, carries `headBranch: main`). What actually happens: newest-first ordering under a `--limit`, so on a busy commit the release runs are crowded off the end by unrelated `issues`/`issue_comment` traffic (measured: `--limit 100` → `push=0`, `--limit 300` → `push=8` of 131). Raise the limit, paginate, or filter `--event push` / `--event workflow_run`; dropping `--branch` under the same limit rebuilds the identical watcher. **Why:** #8233 — a release watch reported 10 release runs then 0, one poll short of declaring a deploy settled over nothing.
|
|
2502
2508
|
|
|
2503
2509
|
**Run every POST-merge Monitor with its shell in a detached `origin/main` worktree (step 2 of the merge → deploy protocol above) or `/var/tmp`, never `cd`'d into the feature worktree.** The pre-merge Phase 7 poll above is the exception: its BEHIND arm pushes the checked-out PR branch, so it runs from the PR worktree (from a detached HEAD it reports `kind=detached_head` and stops). After the merge any session's `cleanup-merged` can reap that worktree, and a monitor `cd`'d into it dies with `fatal: Unable to read current working directory`. **Why:** #8136 — the #8074 release watch died this way while the release was red.
|
|
2504
2510
|
|
|
@@ -2519,7 +2525,7 @@ The sync is capped at `MAX_BEHIND_SYNCS=6` per poll, so a pathological BEHIND→
|
|
|
2519
2525
|
**CI-run diagnosis:** derive the run id from the failing check name, then read jobs + steps via `gh api --paginate` — [ci-run-diagnosis.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ci-run-diagnosis.md). `--paginate` is load-bearing (`gh api` does NOT auto-paginate; a >30-job run returns a truncated, false-clean set). Both commands work while the run is still in progress, but **an in-progress snapshot is not a verdict** — classify only once the run reaches `completed`. Then:
|
|
2520
2526
|
|
|
2521
2527
|
- **Default: treat it as a real red.** Exit and diagnose. Everything below is a narrow exception to this, and anything you cannot confidently place is a red.
|
|
2522
|
-
- The one exception: a failure **fetching a third-party artifact from the network**, where the failing step's own output is an HTTP error, a connection reset, or a checksum mismatch on a JUST-DOWNLOADED archive — **and only when the diff does not touch that pin**. Rerun once (`gh run rerun <run-id> --failed`; it operates on completed runs, so wait for the run to finish first; a rerun drives a fresh CI cycle — `incr ci_cycles` on it too), then **re-enter the poll loop at the top** — the loop has already exited by this point, so "continue polling" means restarting it, not resuming the tick that exited.
|
|
2528
|
+
- The one exception: a failure **fetching a third-party artifact from the network**, where the failing step's own output is an HTTP error, a connection reset, or a checksum mismatch on a JUST-DOWNLOADED archive — **and only when the diff does not touch that pin**. Rerun once (`gh run rerun <run-id> --failed`; it operates on completed runs, so wait for the run to finish first; a rerun drives a fresh CI cycle — `incr ci_cycles` on it too, plus `incr ci_wall_s <s>` — Phase-6 recipe; skip unreadable), then **re-enter the poll loop at the top** — the loop has already exited by this point, so "continue polling" means restarting it, not resuming the tick that exited.
|
|
2523
2529
|
- **A dependency install is NOT in that exception, whatever the step is called.** Read the failing step's COMMAND: if it is `bun install`, `npm ci`, `npm install`, `yarn install`, or `pnpm install`, it is lockfile drift — a red your diff caused (`cq-before-pushing-package-json-changes`). So is a `sha256sum -c` mismatch when the PR bumps that pin. Rerunning those wastes two cycles and then reports a code failure to the operator as an infrastructure outage, steering them away from the diff that caused it.
|
|
2524
2530
|
- If the same step fails again after one rerun, stop and diagnose — do not keep rerunning, and do not assert "infrastructure" unless the failing output actually shows a network/HTTP error.
|
|
2525
2531
|
|
|
@@ -2566,6 +2572,7 @@ The agent maintains a `fix_attempt_count` counter (agent-level state, not a bash
|
|
|
2566
2572
|
```bash
|
|
2567
2573
|
# Phase 6 secret scan first
|
|
2568
2574
|
git push && bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_cycles
|
|
2575
|
+
# + `incr ci_wall_s <s>` (Phase-6 recipe; skip unreadable)
|
|
2569
2576
|
gh pr merge <number> --squash --auto
|
|
2570
2577
|
```
|
|
2571
2578
|
|
|
@@ -8,19 +8,28 @@ Phase 6 reads the run's ledger before writing the PR body:
|
|
|
8
8
|
`bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" show`. Render `## Pipeline Tally`
|
|
9
9
|
before `## Changelog` in BOTH body templates, per these rules (in order):
|
|
10
10
|
|
|
11
|
-
- **Ledger present, counts > 0:** one `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N`
|
|
12
|
-
line; a glossary line (`seats = reviewer agents spawned`); any `warned:<dim>=<at>` /
|
|
11
|
+
- **Ledger present, counts > 0:** one `tally: seats=N ci_cycles=N fix_rounds=N agent_rounds=N ci_wall_s=W`
|
|
12
|
+
line, copied verbatim from `show`'s output; a glossary line (`seats = reviewer agents spawned`); any `warned:<dim>=<at>` /
|
|
13
13
|
`capped:<dim>` events from `show`'s annotation line; cap usage as `N of cap <dim>`
|
|
14
14
|
fractions for each `cap_<dim>` set. Then the machine line on its own line:
|
|
15
|
-
`Pipeline-Tally: seats=N; ci_cycles=N; fix_rounds=N; agent_rounds=N` — it is the
|
|
15
|
+
`Pipeline-Tally: seats=N; ci_cycles=N; fix_rounds=N; agent_rounds=N; ci_wall_s=W` — it is the
|
|
16
16
|
cross-PR aggregation surface (squash merge drops commit trailers, so counts live in
|
|
17
|
-
the body, never a git trailer).
|
|
17
|
+
the body, never a git trailer). `ci_wall_s` is the run's measured CI wall-clock
|
|
18
|
+
seconds (#11775): a positive count renders `ci_wall_s=N`; a count of 0 renders
|
|
19
|
+
the declared absent marker `ci_wall_s=unmeasured` — NEVER `ci_wall_s=0`, which
|
|
20
|
+
would fabricate a measured zero for a run that posted nothing. `show` already
|
|
21
|
+
emits the marker on its `tally:` line, so the verbatim copy carries it; the
|
|
22
|
+
machine line applies the same rule. This is the per-dimension absence,
|
|
23
|
+
distinct from `SOLEUR_TALLY_ABSENT` (whole-ledger absent, below), and the
|
|
24
|
+
number is a floor: cycles whose timing never resolved contribute nothing.
|
|
18
25
|
- **`show` prints a `note:default-branch-ledger` line** (the ledger is keyed to `main`/`master`, shared
|
|
19
26
|
across sessions): the counts are NOT this run's cost. Render them with the words
|
|
20
27
|
`shared default-branch ledger, not attributable to this run`, or render `SOLEUR_TALLY_ABSENT`
|
|
21
28
|
when a per-run figure is required. Never copy them into `Pipeline-Tally:` as one run's cost.
|
|
22
29
|
- **Ledger present, all counters 0:** `tally: 0 — no counted operations`
|
|
23
|
-
(instrumented-but-unused is a real state, not an absence).
|
|
30
|
+
(instrumented-but-unused is a real state, not an absence). All five dims at 0
|
|
31
|
+
— the `ci_wall_s=unmeasured` marker is subsumed by the whole-line form here;
|
|
32
|
+
it matters when other counts are nonzero but no wall was ever measured.
|
|
24
33
|
- **Ledger absent / `show` prints UNKNOWN:** the literal line `SOLEUR_TALLY_ABSENT` —
|
|
25
34
|
never render a zero tally for an instrumented run that never wrote.
|
|
26
35
|
- **Ledger carries `capped=<dim>` but the run shipped anyway:** additionally emit
|
|
@@ -32,12 +41,37 @@ before `## Changelog` in BOTH body templates, per these rules (in order):
|
|
|
32
41
|
- **`gate`/`show` returned UNKNOWN while caps were configured:** note `cap-unenforced` —
|
|
33
42
|
caps were set but the substrate couldn't enforce them (e.g. no flock on macOS).
|
|
34
43
|
- **Phase-7 re-render:** the Phase-6 render predates every merge-loop
|
|
35
|
-
`incr ci_cycles
|
|
36
|
-
|
|
44
|
+
`incr ci_cycles` and every `incr ci_wall_s` post for the pushed syncs'
|
|
45
|
+
measured runs. If the auto-sync arm pushed any syncs or halted on a gate
|
|
46
|
+
STOP, post each completed pushed run's measured wall, then re-run `show`
|
|
47
|
+
and `gh pr edit` the body again — otherwise Phase-7
|
|
37
48
|
cycles never reach the `Pipeline-Tally:` machine line and a mid-loop cap
|
|
38
49
|
breach never emits `SOLEUR_TALLY_CAP_IGNORED`.
|
|
39
50
|
- **No dollars, ever.** Counts and counts only — units, not currency (ADR-056).
|
|
40
51
|
|
|
52
|
+
**The `ci_wall_s` measurement recipe (#11775)** — what every `incr ci_cycles`
|
|
53
|
+
call site posts once the run that push produced reaches `completed` (the wall
|
|
54
|
+
does not exist at push time). Measure from run timing, never a hand estimate:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
RUN_ID=$(gh api --paginate "repos/{owner}/{repo}/actions/runs?head_sha=$(git rev-parse HEAD)" \
|
|
58
|
+
--jq '[.workflow_runs[] | select(.name == "CI" and .status == "completed") | .id] | max' \
|
|
59
|
+
2>/dev/null || true)
|
|
60
|
+
WALL=""
|
|
61
|
+
[[ "$RUN_ID" =~ ^[0-9]+$ ]] \
|
|
62
|
+
&& WALL=$(gh run view "$RUN_ID" --json startedAt,updatedAt \
|
|
63
|
+
--jq '(.updatedAt | fromdateiso8601) - (.startedAt | fromdateiso8601)' 2>/dev/null || true)
|
|
64
|
+
[[ "$WALL" =~ ^[0-9]+$ && "$WALL" -gt 0 ]] \
|
|
65
|
+
&& bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr ci_wall_s "$WALL" || true
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When `startedAt`/`updatedAt` do not resolve (queued-then-cancelled, an API
|
|
69
|
+
gap), fall back to the per-job span on the same run:
|
|
70
|
+
`gh api --paginate "repos/{owner}/{repo}/actions/runs/<id>/jobs" --jq '([.jobs[].completed_at | fromdateiso8601] | max) - ([.jobs[].started_at | fromdateiso8601] | min)'`.
|
|
71
|
+
An unreadable or null result SKIPS the incr — never post a fabricated 0. `max`
|
|
72
|
+
on the run id picks the newest completed `CI` run on the pushed head; after a
|
|
73
|
+
`gh run rerun`, measure the rerun's own window, not the first attempt's.
|
|
74
|
+
|
|
41
75
|
**The classified-stop artifact** (what a `STOP` verdict writes): append
|
|
42
76
|
`status: budget-capped`, `budget-capped: <dim>=<count>/<cap>` and a `resume:` line
|
|
43
77
|
to `knowledge-base/project/specs/<feature>/session-state.md`, then exit the skill —
|
package/skills/work/SKILL.md
CHANGED
|
@@ -1476,3 +1476,4 @@ See [references/key-principles.md](${CLAUDE_PLUGIN_ROOT}/skills/work/references/
|
|
|
1476
1476
|
- **Relaunching a long-running background bash before verifying it died** - Do NOT relaunch until ALL three checks confirm death: (1) broad `ps -ef \| grep -E '<substring>' \| grep -v grep` (never `pgrep -fa 'pattern$'` — anchored patterns miss `doppler run -- bash` wrappers), (2) output size stopped growing over 30+ s, (3) the harness `<task-notification>` fired with a definitive `status`. Log `mtime` is NOT liveness — scripts buffer output. **Why:** PR #4156 — anchored `pgrep` + stale mtime launched a second bench (~$3 wasted). See `knowledge-base/project/learnings/workflow-issues/2026-05-20-long-running-bench-verify-process-before-relaunch.md`. **The inverse is as costly: STOPPING one means killing the tree, not the PIDs you launched.** `run-registered-suites.sh` fans out via `xargs -P 6`, so killing its wrapper and runner leaves the workers orphaned and running — measured 46 min still spawning containers. Resolve the root's descendants (`pstree -p <root>`), confirm each `/proc/<pid>/cwd` is YOUR worktree before killing, and re-probe afterwards — an unverified kill was never made. **A killed `test-all.sh` leaves its `flock -w 3600` lock waiter alive** — the orphaned `flock` holds a `lefthook` pre-commit open until killed; enumerate every process whose `/proc/<pid>/cwd` is the worktree, not only runner names (#7941/PR #8070).
|
|
1477
1477
|
- **Capture `git commit`'s rc on the very next line — a trailing command owns the call's exit status.** `git commit …; git log --oneline -1` in one background call reports exit 0 when lefthook REJECTED the commit, and the log line (showing the previous commit) reads as success. Write `git commit …; echo "COMMIT_RC=$?"` and read that line, then confirm HEAD moved. **Why:** #8474 — a failed gate (`🥊 bun-test`, 471/477) went unnoticed until the next step found the changes still staged. See `knowledge-base/project/learnings/2026-09-21-every-gate-this-pr-added-failed-open-on-the-input-it-could-not-measure.md`.
|
|
1478
1478
|
- **A diff adding or renaming members an existing derived artifact enumerates owes the FULL regen sweep — the plan's list is a hypothesis, not the set.** Run every regenerator the touched paths can invalidate (regenerate-*, sync-*-counts, *baseline* scripts) — N reds on M surfaces is ONE gap. **Why:** #10404/PR #10744 — three committed-state reds from one incomplete sweep (0400ffe62a). See `knowledge-base/project/learnings/2026-10-21-one-regen-gap-three-committed-state-reds.md`.
|
|
1479
|
+
- **`accept.tsv` col 5 must start `false-positive: ` — one malformed row drops EVERY exemption.** <!-- markdownlint-disable-line MD038 --> After writing rows run `audit --accept` (rc 2 names the row); on a pair balloon grep `stale-accept` first; re-verify after each rebase. **Why:** #11958 — 27 bad prefixes flooded 330 false pairs. See `knowledge-base/project/learnings/test-failures/2026-11-03-one-malformed-accept-row-reason-drops-every-exemption.md`.
|