fix: handle empty backlog and remote seed arrays on Bash 3.2 - #3468
fix: handle empty backlog and remote seed arrays on Bash 3.2#3468kuan0808 wants to merge 9 commits into
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (4): Last reviewed commit: "no-mistakes(lint): Remove tests/fm-calm-..." | Re-trigger Greptile |
| # shellcheck source=tests/lib.sh | ||
| . "$(dirname "${BASH_SOURCE[0]}")/lib.sh" | ||
|
|
||
| [ -x /bin/bash ] || { echo "skip: no /bin/bash"; exit 0; } |
There was a problem hiding this comment.
This check accepts any executable /bin/bash, and CI discovers the test only in the Ubuntu portable-serial lane. Modern Bash does not reproduce the original empty-array failure, so reverting either guard would leave this regression test passing; execute it in the existing macOS Bash 3.2 job instead.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Addressed in b7d73c9929743f582b3917d3be38abeb25a4647d. The existing macOS Bash 3.2 job now runs tests/fm-bash32-empty-array.test.sh and requires exactly two passing cases. Both cases passed on stock Bash 3.2.57 and independently failed on the base; the guard also rejects zero, one, or three cases. The seed test proves transport is reached and rejects the unbound-array diagnostic even when the cleanup trap returns zero. Modern Bash retains its explicit skip.
The native changed-family baseline passed 55 scripts with zero failures and one disclosed missing-tsc skip. Hosted CI awaits maintainer approval, so I am not claiming hosted macOS coverage has run yet.
47439b5 to
32af2bd
Compare
| case $BIN_BASH_VERSION in | ||
| 3.*) ;; | ||
| 4.[0-3]) ;; | ||
| *) | ||
| echo "skip: /bin/bash is $BIN_BASH_VERSION; the empty-array unbound error this covers only occurs below 4.4" | ||
| exit 0 | ||
| ;; | ||
| esac |
There was a problem hiding this comment.
Bash 3.2 coverage still absent
When CI reaches this test on its modern Linux Bash, this branch exits successfully before either regression case runs, while the macOS Bash 3.2 job does not invoke this file. Reverting either empty-array guard therefore leaves CI green.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
The refreshed head b7d73c9929743f582b3917d3be38abeb25a4647d includes the missing macOS execution and an exact two-case count assertion. Both regressions now fail independently on the base and pass on stock Bash 3.2.57; the actual workflow command block was exercised locally. Current workflow.
Modern Linux Bash still reports the intentional skip. The hosted macOS CI run requires maintainer workflow approval; local verification and hosted execution are recorded separately in the PR body.
a5f3cbe fixed this class in bin/fm-public-followup.sh. Two shipped scripts still expand an array that is reachably empty: - bin/fm-backlog-receive.sh KEYS, when a delivered outbox carries no Queued keys, in all three classification and receipt loops. - bin/fm-remote-home-seed.sh PROJECT_NAMES, in the per-project loop that --no-projects reaches with no names. The other expansion of that array is already dominated by a length check and is left alone. Both now use the same ${arr[@]+"${arr[@]}"} idiom a5f3cbe introduced. tests/fm-bash32-empty-array.test.sh runs each real script through /bin/bash with the array genuinely empty. The syntax is valid on every bash, so the parse-only stock-bash sweep cannot see this defect; executing the lines is what finds it. Reverting either guard makes the matching case report "unbound variable". The test now checks that /bin/bash is actually below 4.4 before running, and skips with the version it found otherwise. Without that check the cases pass on a modern /bin/bash whether or not the guards are present, so a lane with a newer /bin/bash would report a pass that proves nothing. The macOS stock-Bash CI lane now runs that file too. The Ubuntu lanes carry a modern Bash, where the file skips itself, so without this step reverting either guard would leave CI green.
32af2bd to
0b0c970
Compare
…sh-20260905/pr-3468-u1
…arness.test.sh, tests/fm-on.test.sh, tests/fm-calm-pi-extension.test.sh; focused checks pass
…both locales and negative controls pass
…oat_line; canonical lint passes
|
Refreshed this existing PR through no-mistakes at Could a maintainer approve the fork workflows for this head? CI and Require no-mistakes report |
Intent
Keep empty backlog receipts and remote secondmate seeding usable under stock macOS Bash 3.2 with
set -u.What Changed
Risk Assessment
Production behavior changes are limited to the two empty-array guards. The additional corrections are test fixtures that preserve existing assertions, including exact answer counts and the transport latency budget. The Muse fixture requires a C compiler, as the existing Cursor fixture does; Calm uses its existing Pi TUI dependency.
Testing
tscwas unavailable; this is not passed typecheck coverage.The unchanged transport latency assertion passes in the current baseline; an earlier 16-second result remains unexplained and is not claimed as a causal repair.
Hosted CI and Require no-mistakes await maintainer workflow approval. Hosted CI is not green.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
Step was skipped.
✅ **Review** - passed
✅ No issues found.
🔧 **Test** - 1 issue found → auto-fixed (3) ✅
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated🔧 Fix: Report pre-existing composer and Muse test blockers
1 error still open:
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated🔧 Fix: Fix tests/fm-composer-lib.test.sh, tests/fm-muse-harness.test.sh, tests/fm-on.test.sh, tests/fm-calm-pi-extension.test.sh; focused checks pass
1 error still open:
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated🔧 Fix: Fix tests/fm-calm-pi-extension.test.sh readiness; both locales and negative controls pass
✅ Re-checked - no issues remain.
bin/fm-test-run.sh --changed --exclude-family real-herdr-gatedReused the supplied successful baseline:bin/fm-test-run.sh --changed --exclude-family real-herdr-gated.Ranbin/fm-test-run.sh tests/fm-bash32-empty-array.test.shon stock macOS Bash 3.2.57.Ranpython3 .test-intent-bash32/verify.py: compared exact base and target CLI behavior for empty receipts, nonempty receipts, duplicate retries, and offline seed transport.Ranpython3 .test-intent-bash32/extra.py: independently confirmed both existing regressions fail on the base; checked successful seed responses and decoded project manifests using offline transport.Executed the actual YAML-parsed macOS empty-array CI block; verified its count guard accepts exactly two cases and rejects zero, one, and three.✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Remove tests/fm-calm-pi-extension.test.sh unused boat_line; canonical lint passes
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.