Skip to content

Run list loops under bash, not zsh - #736

Merged
mergify[bot] merged 1 commit into
mainfrom
stack/EdbertChan/feat/memory-rules-into-catstack/run-list-loops-under-bash-zsh--2b1e4339
Sep 17, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
stack/EdbertChan/feat/memory-rules-into-catstack/run-list-loops-under-bash-zsh--2b1e4339

Conversation

@EdbertChan

@EdbertChan EdbertChan commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

List loops run under bash, because zsh does not split an unquoted variable into words.

Under zsh, a loop over a list kept in one variable runs just once, with the whole list as a single item, and still exits 0.

So the loop looks done, even though it only ever saw one item.

Review Claim

The learned working-style rules require running list loops under bash and counting failed lookups as unchecked.

Review Lane

behavior

Review Unit

corpus-lesson

Safety Invariant

Adds one rule; the test runs both shells so the rule fails loudly if the shell behavior changes.

Slice Rationale

One rule and its test.

Non-goals

  • No hook enforces this yet.

Test Plan

Test Plan
  • python3 -m unittest tests.test_zsh_loop_rule: rule checks fail before, pass after; the premise checks print zsh 1 and bash 3 for the same loop

  • Every step in .github/workflows/ci.yml ran locally on the full stack with rc=0: run_all_tests.sh, check_no_tracked_local_artifacts, check_hook_test_coverage, check_no_silent_hook_except, check_rules_are_wired, check_skills_three_harnesses, check_ecosystem_boundaries, check_skill_file_refs, check_skill_test_coverage, check_skill_test_debt_no_growth, check_skill_trigger_mechanism, check_dora_baseline, check_no_dated_provenance, check_no_new_comments, ruff check . --select E9,F, shellcheck install.sh

  • zsh keeps an unquoted variable whole; bash splits it:

    $ zsh -c 'v="a b"; for w in $v; do echo "[$w]"; done'
    [a b]
    $ bash -c 'v="a b"; for w in $v; do echo "[$w]"; done'
    [a]
    [b]
    

Revert Plan

Revert Plan
  • Safe to revert? Yes
  • Revert command: git revert <sha>
  • Post-revert steps: rerun ./install.sh so installed copies match
  • Data migration? No

🤖 Generated with Claude Code

@EdbertChan

EdbertChan commented Sep 17, 2026

Copy link
Copy Markdown
Owner Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 Run list loops under bash, not zsh #736 👈
2 Read a script's whole body before asking to run it #737
3 Reconcile declared intent, code, and result when finishing a merge #738
4 Keep approved fix-later items in every status update #739
5 Search saved memory both ways before a deep dive #740

@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/feat/memory-rules-into-catstack/run-list-loops-under-bash-zsh--2b1e4339 branch from 1b75246 to b400645 Compare September 17, 2026 04:23
@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/feat/memory-rules-into-catstack/count-background-job-wakeup-behind-eta-call-time--216f9659 branch from 5fc502e to 86d94a8 Compare September 17, 2026 04:23
@EdbertChan

EdbertChan commented Sep 17, 2026

Copy link
Copy Markdown
Owner Author

Revision history

# Type Changes Reason Date
1 initial 1b75246 2026-09-17 04:23 UTC
2 rebase 1b75246 → b400645 (rebase only) 2026-09-17 04:23 UTC
3 rebase b400645 → 81cc51b (rebase only) 2026-09-17 04:37 UTC
4 rebase 81cc51b → aba9455 (rebase only) 2026-09-17 04:55 UTC

@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/feat/memory-rules-into-catstack/count-background-job-wakeup-behind-eta-call-time--216f9659 branch from 86d94a8 to 1e0bb34 Compare September 17, 2026 04:37
@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/feat/memory-rules-into-catstack/run-list-loops-under-bash-zsh--2b1e4339 branch from b400645 to 81cc51b Compare September 17, 2026 04:37
zsh does not split an unquoted variable into words, so a list loop runs once
and reports success. Add the rule to the learned working-style rules with a
test that runs both shells and pins the rule text.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: I2b1e4339a193191560c91d8416cd06a4441283dd
@EdbertChan
EdbertChan changed the base branch from stack/EdbertChan/feat/memory-rules-into-catstack/count-background-job-wakeup-behind-eta-call-time--216f9659 to main September 17, 2026 04:55
@EdbertChan
EdbertChan force-pushed the stack/EdbertChan/feat/memory-rules-into-catstack/run-list-loops-under-bash-zsh--2b1e4339 branch from 81cc51b to aba9455 Compare September 17, 2026 04:55
@mergify

mergify Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@EdbertChan

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 6 minutes 57 seconds in the queue, including 6 minutes 27 seconds running CI.

Required conditions to merge
  • check-success = lint
  • check-success = test
  • check-success = validate

@mergify mergify Bot added the queued label Sep 17, 2026
@mergify
mergify Bot merged commit 81da61c into main Sep 17, 2026
5 of 9 checks passed
@mergify mergify Bot removed the queued label Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant