Skip to content

test(compat): make the space-in-path premise able to fail (unblocks main) - #888

Closed
fujibee wants to merge 1 commit into
mainfrom
fix/premise-that-cannot-fail
Closed

test(compat): make the space-in-path premise able to fail (unblocks main)#888
fujibee wants to merge 1 commit into
mainfrom
fix/premise-that-cannot-fail

Conversation

@fujibee

@fujibee fujibee commented Aug 19, 2026

Copy link
Copy Markdown
Owner

main is red on a required check right now, so this blocks landing for every branch.

check-enforced-assertions: 639 unenforceable assertions, baseline is 638.

Where the extra one came from

Bisected across the commits since v1.2.1, running the checker at each:

v1.2.1    638     67a1252   638     626a625   638
df4c597   638     fa826b7   639  <- here      2910722   639

fa826b7 (#771) added tests/test_compat_posix.bats, and with it:

  # The real ps hands us a path with a space -- the premise of the stub above.
  [[ "$raw" == *"Application Support"* ]]

Why the ratchet is right and the baseline should not move

A non-last [[ ]] cannot fail a test on bash 3.2 (#670). This one is the case's
premise — it exists to establish that the real ps on this platform hands
back a path containing a space, which is the whole situation the assertions below
it are about.

Because it cannot fail, it passes for any raw whatsoever. On a platform whose
ps returned something else entirely, the case would sail past its own premise
and then assert against a value that never had the shape in question. The case
statement above it already skips the platforms where the path is unreachable, so
the surviving failure mode is the quiet one: a premise that reads as checked and
is not.

That is the class the ratchet exists to catch, so the fix is the assertion, not
the number.

The change

grep -qF, the idiom the other #850-era cases in this tree settled on:

  grep -qF -- 'Application Support' <<<"$raw"

Verified

check-enforced-assertions: 638 unenforceable assertions, at the baseline (638).   exit 0
bats tests/test_compat_posix.bats -> all cases pass

The mutation is the point of the change, so it is worth stating plainly: with the
old line, replacing Application Support with a string the path never contains
leaves the case green. With the new line it goes red.

`main` is red on the enforced-assertions ratchet: 639 against a baseline of
638. The count rose at fa826b7 (#771), which added

    [[ "$raw" == *"Application Support"* ]]

as the premise for the case below it -- and a non-last `[[ ]]` cannot fail a
test on bash 3.2 (#670). So the premise passed on any `raw` at all, and the
assertions underneath it would have run against a value that never had the
shape they are about. A premise that cannot fail is worse than no premise,
because it reads as one.

Uses `grep -qF`, the idiom the other #850-era cases in this tree settled on.

The baseline is deliberately not bumped. The ratchet was reporting a real
defect, not drift.
@fujibee

fujibee commented Aug 19, 2026

Copy link
Copy Markdown
Owner Author

Closing as a duplicate of #887, which is the one being landed: it carries CLEARED from two reviewers at the same head, and it prints what ps actually returned when the premise does not hold — which is the reason the premise exists at all. The comment wording here is being taken across.

@fujibee fujibee closed this Aug 19, 2026
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