Skip to content

fix: correct phase label slug generation for phases 9+#101

Merged
snipcodeit merged 2 commits intomainfrom
issue/100-bug-phase-label-slugs-truncated-to-empty
Mar 1, 2026
Merged

fix: correct phase label slug generation for phases 9+#101
snipcodeit merged 2 commits intomainfrom
issue/100-bug-phase-label-slugs-truncated-to-empty

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Phase label slugs for phases 9+ were being truncated to empty strings because `head -c 40` always exits 0 even on empty input, preventing the `||` fallback from firing
  • Bash-only `${VAR,,}` lowercase syntax caused `bad substitution` errors in ZSH, silently producing malformed slugs like `phase:9-` instead of `phase:9-daily-engagement`
  • Fixed by replacing the broken `|| head -c 40` pattern with an explicit `if [ -z ]` guard and replacing `${VAR,,}` with POSIX-compatible `tr '[:upper:]' '[:lower:]'`

Closes #100

Changes

  • `commands/project.md` — fixed PHASE_SLUG (line 339) and ISSUE_SLUG (line 378) generation logic
  • `.claude/commands/mgw/project.md` — mirrored identical fix to the deployed command copy

Test Plan

  • Run `/mgw:project` on a milestone with 9 or more phases
  • Verify that phase labels are created with full slugs (e.g., `phase:9-daily-engagement`) rather than truncated ones (e.g., `phase:9-`)
  • Verify the command works correctly in ZSH (not just bash)

Stephen Miller added 2 commits March 1, 2026 13:18
…oject.md

- Replace || fallback with explicit if [ -z ] guard (head -c 40 exits 0 on empty)
- Replace ${VAR,,} bash-only lowercasing with POSIX tr '[:upper:]' '[:lower:]'
- Add tr -cd 'a-z0-9-' to strip non-slug characters from fallback path
…s/mgw/project.md

- Apply identical fix as commands/project.md (files are mirrors)
- Replace || fallback with explicit if [ -z ] guard
- Replace ${VAR,,} bash-only syntax with POSIX tr '[:upper:]' '[:lower:]'
- Add tr -cd 'a-z0-9-' to strip non-slug characters from fallback path
@github-actions github-actions bot added the slash-commands Changes to slash command files label Mar 1, 2026
@snipcodeit
Copy link
Owner Author

Detailed Testing Procedure

Prerequisites

  • A GitHub milestone with 9 or more phases defined
  • Shell: ZSH (to verify POSIX compatibility fix)

Steps to Reproduce the Bug (before fix)

  1. Run `/mgw:project` on a repo with a milestone containing phases 9+
  2. Observe that phase labels are created as `phase:9-` (empty slug suffix) instead of `phase:9-daily-engagement`

Steps to Verify the Fix

  1. Checkout this branch: `git checkout issue/100-bug-phase-label-slugs-truncated-to-empty`
  2. Run `/mgw:project` in ZSH on a milestone with 9+ phases
  3. Check generated labels in GitHub — each should have a full descriptive slug (e.g., `phase:9-daily-engagement`, `phase:10-review`)
  4. Confirm no `bad substitution` errors appear in the output

Root Cause Verification

The two root causes can be verified independently:

Fix 1 — `head -c 40` exit code issue:

# This always exits 0, so || fallback never fires:
echo "" | head -c 40; echo $?   # outputs: 0
# Fix: use explicit if [ -z "$PHASE_SLUG" ] guard instead

Fix 2 — ZSH `${VAR,,}` incompatibility:

# In ZSH, bash-only lowercase expansion fails:
VAR="Hello World"
echo ${VAR,,}   # ZSH: bad substitution error
# Fix: use tr '[:upper:]' '[:lower:]' which is POSIX-compatible
echo "$VAR" | tr '[:upper:]' '[:lower:]'   # works in bash and ZSH

Expected Result

All phase labels (including phases 9+) should have complete, correctly-formatted slugs matching their phase names.

@snipcodeit snipcodeit merged commit 31878de into main Mar 1, 2026
1 check passed
@snipcodeit snipcodeit deleted the issue/100-bug-phase-label-slugs-truncated-to-empty branch March 1, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

slash-commands Changes to slash command files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: phase label slugs truncated to empty string for phases 9+

1 participant