fix(gates): ABANDON needs a numeric id; indented ABANDON counts, malformed ones error

This commit is contained in:
bchanot committed 2026-11-21 02:24:46 +01:00
1 parent 23c580249e
commit 5bba6ce4db
2 files changed
+59 -2

No files matched your search

+4 -2
View File
@@ -107,8 +107,10 @@ _absorb() { # _absorb <raw-line> <lineno>
elif [[ "$1" =~ ^[0-9] ]]; then
_err "malformed criterion label at line $2 (want \`N. text\`)"
_CUR=-1
elif [[ "$1" =~ ^ABANDON:[[:space:]]*([0-9]+)?[[:space:]]*(.*)$ ]]; then
_ABANDON_ID+=("${BASH_REMATCH[1]}"); _ABANDON_WHY+=("${BASH_REMATCH[2]}")
elif [[ "$1" =~ ^[[:space:]]*ABANDON:[[:space:]]*([0-9]+)([[:space:]]+(.*))?$ ]]; then
_ABANDON_ID+=("${BASH_REMATCH[1]}"); _ABANDON_WHY+=("${BASH_REMATCH[3]}")
elif [[ "$1" =~ ^[[:space:]]*ABANDON: ]]; then
_err "malformed ABANDON at line $2 (want \`ABANDON: N reason\`)"
elif [[ "$1" =~ ^(CHECK|EXPECT|EVIDENCE): ]]; then
_err "unindented ${BASH_REMATCH[1]}: at line $2"
elif [[ "$1" =~ ^[[:space:]]+(CHECK|EXPECT|EVIDENCE):(.*)$ ]]; then
+55
View File
@@ -302,6 +302,61 @@ gate "abandonment naming nothing" run "unknown criterion" 2 <<'EOF'
ABANDON: 9 names a criterion that does not exist
EOF
gate "abandonment id 1b is malformed" run "malformed ABANDON" 2 <<'EOF'
## ACCEPTANCE CRITERIA
1. green
CHECK: echo "M"
EXPECT: M
EVIDENCE: pending
2. manual
ABANDON: 1b moved after renumber
EOF
gate "abandonment id 1.1 is malformed" run "malformed ABANDON" 2 <<'EOF'
## ACCEPTANCE CRITERIA
1. green
CHECK: echo "M"
EXPECT: M
EVIDENCE: pending
2. manual
ABANDON: 1.1 moved after renumber
EOF
gate "abandonment without id is malformed" run "malformed ABANDON" 2 <<'EOF'
## ACCEPTANCE CRITERIA
1. green
CHECK: echo "M"
EXPECT: M
EVIDENCE: pending
2. manual
ABANDON: upstream offline
EOF
gate "indented malformed abandonment" run "malformed ABANDON" 2 <<'EOF'
## ACCEPTANCE CRITERIA
1. green
CHECK: echo "M"
EXPECT: M
EVIDENCE: pending
2. manual
ABANDON: 1b moved
EOF
gate "indented abandonment counts" run "GATES — VERDICT: ABANDONED(1)" 3 <<'EOF'
## ACCEPTANCE CRITERIA
1. green
CHECK: echo "M"
EXPECT: M
EVIDENCE: pending
2. manual
ABANDON: 2 upstream offline
EOF
echo "── usage ──"
# usage <label> <expected-substring> <argv...>