Skip to content

fix: handle empty backlog and remote seed arrays on Bash 3.2 - #3468

Open
kuan0808 wants to merge 9 commits into
kunchenguid:mainfrom
kuan0808:bash32-empty-array-remaining-sites
Open

fix: handle empty backlog and remote seed arrays on Bash 3.2#3468
kuan0808 wants to merge 9 commits into
kunchenguid:mainfrom
kuan0808:bash32-empty-array-remaining-sites

Conversation

@kuan0808

@kuan0808 kuan0808 commented Sep 1, 2026

Copy link
Copy Markdown

Intent

Keep empty backlog receipts and remote secondmate seeding usable under stock macOS Bash 3.2 with set -u.

What Changed

  • Guard both empty-array expansions while preserving nonempty receipt and project behavior.
  • Run both regressions in the existing macOS Bash 3.2 CI job and require exactly two passing cases. The seed regression records that execution reaches SSH transport after the empty loop, without contacting a host.
  • Correct the validation fixtures: portable UTF-8 composer glyphs, a real named Muse ancestor using the existing Cursor fixture pattern, missing remote doctor fixture dependencies, and Calm display-cell measurement and rendered-result readiness.
  • Clarify that the receiver accepts an outbox containing no items.

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

  • Native changed-family baseline: 55 scripts, zero failures, one explicit skip, in 885.3 seconds. The Pi typecheck was skipped because tsc was unavailable; this is not passed typecheck coverage.
  • Stock Bash 3.2.57: both regressions pass and independently fail on the base. CLI checks cover empty and nonempty receipts, duplicate retries, and offline seed transport with zero and two projects. The actual macOS CI command block accepts exactly two cases and rejects zero, one, and three.
  • Native Calm suites pass all 12 cases under C and UTF-8 locales. Delayed rendering fails before the readiness correction and passes after it; zero and multiple rendered answers remain rejected. Composer, Muse, and remote doctor fixture suites also pass.
  • Native review, Test, documentation, and pinned lint completed. The current-head attestation is retained below.

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) ✅
  • 🚨 tests failed with exit code 1
  • bin/fm-test-run.sh --changed --exclude-family real-herdr-gated

🔧 Fix: Report pre-existing composer and Muse test blockers
1 error still open:

  • 🚨 tests failed with exit code 1
  • 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:

  • 🚨 tests failed with exit code 1
  • 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-gated
  • Reused the supplied successful baseline: bin/fm-test-run.sh --changed --exclude-family real-herdr-gated.
  • Ran bin/fm-test-run.sh tests/fm-bash32-empty-array.test.sh on stock macOS Bash 3.2.57.
  • Ran python3 .test-intent-bash32/verify.py: compared exact base and target CLI behavior for empty receipts, nonempty receipts, duplicate retries, and offline seed transport.
  • Ran python3 .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 ✅
  • ⚠️ linter found issues (exit code 1)

🔧 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.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The 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; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Bash 3.2 test not exercised

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!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kuan0808
kuan0808 force-pushed the bash32-empty-array-remaining-sites branch from 47439b5 to 32af2bd Compare September 1, 2026 20:03
Comment on lines +23 to +30
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@kuan0808
kuan0808 force-pushed the bash32-empty-array-remaining-sites branch from 32af2bd to 0b0c970 Compare September 2, 2026 21:44
@kuan0808 kuan0808 changed the title fix: guard the remaining empty-array expansions on Bash 3.2 fix: handle empty backlog and remote seed arrays on Bash 3.2 Sep 5, 2026
@kuan0808

kuan0808 commented Sep 5, 2026

Copy link
Copy Markdown
Author

Refreshed this existing PR through no-mistakes at b7d73c9929743f582b3917d3be38abeb25a4647d. Native review, Test, documentation and pinned lint completed; the body retains the genuine current-head pipeline attestation. The changed-family baseline passed 55 scripts with zero failures and one disclosed missing-tsc skip. Both stock Bash 3.2 regressions and the actual macOS CI two-case guard passed locally.

Could a maintainer approve the fork workflows for this head? CI and Require no-mistakes report action_required, with no jobs or logs available. Hosted CI is not green. The native run is parked at this approval boundary; no merge is requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant