Skip to content

test(project): split the += rule into its string and array forms - #1359

Merged
Chemaclass merged 1 commit into
mainfrom
fix/1349-split-append-assignment-rule
Sep 9, 2026
Merged

Chemaclass merged 1 commit into
mainfrom
fix/1349-split-append-assignment-rule

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1349

test_src_has_no_append_assignment matched two constructs that fail on different Bash versions with one pattern, so the compat suite could not tell "needs a version guard" from "can never appear at all".

💡 Changes

  • Split it into a string rule (x+=y) and an array rule (arr+=(x)), each carrying its own reasoning. Verified against a real GNU bash 3.00.0 with each construct inside if false; then … fi: the array form is a parse error and the file never runs, while the string form parses and is simply skipped.
  • Add a self-check with a fixture of each construct, asserting neither rule answers for the other — without it a later edit could quietly widen one back over both and the suite would stay green.
  • Record the distinction in .claude/rules/bash-style.md and the project CLAUDE.md, where the single row read as if both were merely 3.1+ features.

No CHANGELOG entry: tests and contributor rules only, matching how the other test(...) changes here land.

https://claude.ai/code/session_01EXYWTGLjf7qM8Ru3GakDRm

One pattern covered two constructs that fail on different versions, so
the compat suite could not tell "needs a version guard" from "can never
appear at all".

Verified against a real GNU bash 3.00.0, with each construct inside
`if false; then … fi`:

  arr+=(x)   syntax error at parse time; the file does not run
  s+=y       parses, is skipped, the script continues

So the array form kills a file on Bash 3.0 even where nothing reaches
it, and a green macOS run says nothing about it, while the string form
is safe behind a guard 3.0 never takes. They are two rules now, each
carrying that reasoning.

The self-check is the point of the split: a fixture of each construct,
asserting that neither rule answers for the other. Without it a later
edit could quietly widen one back over both and the suite would still
be green.

Closes #1349

Claude-Session: https://claude.ai/code/session_01EXYWTGLjf7qM8Ru3GakDRm
@Chemaclass Chemaclass added the bug Something isn't working label Sep 9, 2026
@Chemaclass Chemaclass self-assigned this Sep 9, 2026
@Chemaclass
Chemaclass merged commit f354e4c into main Sep 9, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the fix/1349-split-append-assignment-rule branch September 9, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant