* fix(#2962): enable nullglob in for-glob shell blocks for zsh portability Workflow shell blocks are fenced bash but execute in the user's login shell (zsh on macOS). zsh's nomatch default aborts the WHOLE block on an unmatched glob in a for-list (not just skipping the command), silently bypassing every statement after it — including the verify-phase decision-coverage gate, whose optional *-CONTEXT.md lookup used the unsafe for-list form so the DECISION_RESULT= assignment on the next line never ran under zsh. Fix: prepend a portable nullglob shim to every bash block containing a for-glob loop: shopt -s nullglob 2>/dev/null; setopt NULL_GLOB 2>/dev/null Each command no-ops (stderr suppressed) in the shell that doesn't recognize it; the matching shell enables nullglob so an unmatched glob expands to nothing and the loop body is skipped cleanly. Verified locally: both zsh and bash now reach end-of-block (rc=0) on a no-match glob; bash matched-case behavior unchanged. 14 blocks across 7 files: verify-phase.md (4, incl. the decision-coverage gate), review.md, execute-phase.md, resume-project.md, complete-milestone.md, audit-milestone.md, gsd-integration-checker.md, gsd-plan-checker.md (3). Closes the zsh bypass of the #2770 fix. * chore(#2962): add changeset fragment * chore(#2962): backfill changeset PR number 3087 --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -1486,12 +1486,13 @@ Copy failure must NOT block phase completion.
|
||||
After `update_roadmap`, moves todos whose `resolves_phase` matches to `completed/`.
|
||||
|
||||
```bash
|
||||
shopt -s nullglob 2>/dev/null; setopt NULL_GLOB 2>/dev/null
|
||||
PHASE_NUM="${PHASE_NUMBER}"
|
||||
PENDING_DIR=".planning/todos/pending"
|
||||
COMPLETED_DIR=".planning/todos/completed"
|
||||
mkdir -p "$COMPLETED_DIR"
|
||||
|
||||
# "05"=="5" (#2576).
|
||||
#2576
|
||||
normalize_phase_num() {
|
||||
local p="${1//\"/}"; printf '%s' "$p" | sed 's/^0*\([0-9]\)/\1/'
|
||||
}
|
||||
@@ -1500,7 +1501,6 @@ PHASE_NUM_NORM=$(normalize_phase_num "$PHASE_NUM")
|
||||
CLOSED=()
|
||||
for TODO_FILE in "$PENDING_DIR"/*.md; do
|
||||
[ -f "$TODO_FILE" ] || continue
|
||||
# resolves_phase from first frontmatter block
|
||||
RP=$(awk '/^---/{c++;next} c==1 && /^resolves_phase:/{print $2;exit} c==2{exit}' "$TODO_FILE" 2>/dev/null || true)
|
||||
RP_NORM=$(normalize_phase_num "$RP")
|
||||
if [ -n "$RP_NORM" ] && [ "$RP_NORM" = "$PHASE_NUM_NORM" ]; then
|
||||
|
||||
Reference in New Issue
Block a user