Skip to content

fix(scripts): correct bash-3.2 comment's stated mechanism in bump-objectui.sh - #12306

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-12222-bump-objectui-trailing-and-note
Aug 25, 2026
Merged

fix(scripts): correct bash-3.2 comment's stated mechanism in bump-objectui.sh#12306
yinlianghui merged 1 commit into
mainfrom
claude/issue-12222-bump-objectui-trailing-and-note

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#12222

What

scripts/bump-objectui.sh's bash-3.2 comment explaining why the ref-collection loop uses
if [[ -n "$x" ]]; then …; fi rather than a trailing [[ … ]] && … attributed the trap to
the empty-list case. Measured on bash 5.2.21, that does not reproduce: an all-empty read
leaves the loop body unexecuted and the while exits 0. The real trap is a non-empty
read whose last line fails the test, and only once that loop is the last command of a
function
— the &&-list's false status becomes the loop's exit status, becomes the
function's return, and set -e kills the caller on that.

The if form itself is unchanged — this PR touches only the comment's stated reason, not
behavior.

Scope

Declared file surface: the one comment in scripts/bump-objectui.sh (lines 341-343 → the
corrected block). Nothing else changed:

Verification — the measured mechanism

Constructed all four combinations under bash --version 5.2.21 (set -euo pipefail, loop
body [[ -n "$x" ]] && arr+=(...)):

caseinputloop positionexit status
1emptylast command of function0
2emptyNOT last command of function0
3non-empty, last line fails testlast command of function1 (killed)
4non-empty, last line fails testNOT last command of function0

Only case 3 dies — confirming the corrected comment's claim and refuting the original
empty-list attribution (cases 1 and 2 both exit 0 regardless of loop position).

Gates run (final commit a4dc82450d)

node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack at the final commit
names 8 matched local families for this diff (no STALE TREE warning); all run via the
shared verify lock, all exit 0:

  • pnpm check:agent-test-spelling — 0
  • pnpm check:cli-command-ids — 0 (✓ check-cli-command-ids: 276 command-id literal(s) … 1 baselined violation(s) — pre-existing baseline entry, unrelated to this diff)
  • pnpm check:cross-package-test-inputs — 0 (All 117 self-test cases passed.)
  • pnpm check:entry-guard — 0 (✓ check:entry-guard: 167 scripts/ file(s) …)
  • pnpm check:parse-guard — 0
  • pnpm check:pnpm-filter-targets — 0 (✓ check:pnpm-filter-targets: 136/173 …)
  • node scripts/check-ci-filter-parity.mjs — 0 (OK: all 96 declared cross-package glob(s) …)
  • node scripts/check-cross-package-test-inputs.mjs — 0

Also ran pnpm check:objectui-changeset (the R7 leg this file touches, per the claim
comment's flagged hazard) — exit 0, self-test line ✓ objectui-range --self-test: all checks passed, R7 line reads ✓ #12071 R7 bump-objectui.sh names no bash 4+/5 construct (mapfile, ${x^^}, declare -A, &>>, EPOCH*). The correction is on full-line comments only
(no trailing comment on a code line), so R7's ^\s*# exemption applies cleanly.

No changeset — this PR publishes nothing (a shell comment correction) — skip-changeset
label applied via the read→union→add flow (REST surface closed from this dev seat, #12123).

Generated by Claude Code


Generated by Claude Code

…ectui.sh
The bash-3.2 note explaining why the ref-collection loop uses `if [[ -n "$x" ]]; then …; fi`
rather than a trailing `[[ … ]] && …` attributed the trap to the empty-list case. Measured
on bash 5.2.21, that does not reproduce: an all-empty read leaves the loop body unexecuted
and the `while` exits 0. The real trap is a non-empty read whose last line fails the test,
and only once that loop is the last command of a function — the `&&`-list's false status
becomes the loop's exit status, becomes the function's return, and `set -e` kills the
caller on that. Measured over all four combinations (empty vs. non-empty-with-failing-last-
line × loop-is-fn's-last-command vs. not): only that one combination exits 1; the other
three exit 0.
The `if` form itself is unchanged and correct — only the stated reason was wrong.
Fixes#12222
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_af22b339-91b5-5814-8b9b-2453fc5b3f68
@yinlianghuiyinlianghui added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Aug 25, 2026 — with Claude
@yinlianghui
yinlianghui marked this pull request as ready for review August 25, 2026 17:28
@yinlianghui
yinlianghui added this pull request to the merge queueAug 25, 2026
Merged via the queue into main with commit 0d91eaaAug 25, 2026
34 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-12222-bump-objectui-trailing-and-note branch August 25, 2026 17:51
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sskip-changesetPR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants

@yinlianghui@claude