Generated brew formula test asserts a --help string fj never emits #235
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The generated Homebrew formula's
test doblock asserts against textfj --helpdoes not emit. The assertion is a false negative waiting to happen and, worse, it is currently passing for a reason unrelated to what it claims to check.Where
.forgejo/workflows/release.yml, in the heredoc that generates the tap formula. Line 440 at the time of filing:What is wrong
assert_match "Command-line tool for Forgejo"does not correspond to any string infj --helpoutput. What the binary actually emits starts:Two differences, either of which alone breaks the match:
a command-line tool for Forgejo, lowercasec. The assertion capitalises it.fj is a command-line tool, so even case-insensitively there is no substringCommand-line tool for Forgejostarting at a word boundary the assertion would land on.The capitalised string is the
descfield of the formula (line 405,desc "Command-line tool for Forgejo, in the spirit of gh"), not the help output. The assertion looks like it was copied from thedescline a few dozen lines above it in the same heredoc, which is exactly the kind of near-miss that reads as correct in review.Why it passes today, for the wrong reason
brew testis not run by the release workflow. The formula is generated, attached to the release, and copied into the tap by hand, so nothing in CI ever executes thetest doblock. The assertion has never been evaluated. It is not "passing", it is unexercised, which is why a string that cannot match has survived.The failure surfaces the first time anyone runs
brew test rasterstate/tap/fj, or the first time a tap audit does. At that point it reports the binary as broken when the binary is fine, which is the worst class of test failure to hand somebody: it points at the wrong thing.Minimal repro
Or against the real surface:
Notes for whoever fixes it
--versionassertion on the line above is correct and should stay:fj --versionemitsfj 0.4.0, soassert_match "fj #{version}"matches.fj is a command-line tool for Forgejois the current opening clause; a shorter anchor is less likely to drift.brew testanywhere, so any assertion in that block can rot the same way. Fixing the string without addressing that leaves the next one to be found by a user.Found while working the paragon
:2222retirement chain; filing rather than fixing so it does not ride along on an unrelated PR.