Repository navigation
Make --help and the README describe what the tool actually does - #72
Merged
Merged
Conversation
--help is the only reference available at the terminal, and it could not be used to tell the regexp assertions from the exact-match ones -- the single most important distinction in the flag set. --assert-header and --assert-header-eq carried identical text, as did --assert-redirect and --assert-redirect-eq, and --assert-body advertised an equality check it has never performed. --assert-ok said "successful (2xx)" while passing anything below 400. That is deliberate, and pinned as such by Test_AssertStatusOK, which asserts 300, 301, 307 and 399 are OK -- curl -f semantics. Since redirects are not followed, a health check aimed at an endpoint that starts redirecting to a login page stays green, so the description now says which range it accepts rather than implying a narrower one. -v selects debug and -s selects error; the descriptions claimed info and a filter over it. Both now name the level they are equivalent to. Both header assertions fall back to a presence check when given a bare name, which is worth knowing at the point of use: it is also why asserting that a header equals the empty string is not expressible. And -m loses the double spaces it inherited from curl's man page, where they were troff formatting. Closes #20 Closes #30 Closes #37 Closes #40 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019EMMhgmTkbzAsmeNy97PrP
The exit code is this tool's entire output, and --help never mentioned one. Nor did it reveal that six options can be set without touching the command line, or that the transport already honours HTTP_PROXY, HTTPS_PROXY and NO_PROXY -- so users behind a corporate proxy went looking for a flag that does not exist, and users with the variable set for unrelated reasons had their health checks silently rerouted with nothing to explain it. The README documents the first two. It is not what anybody reaches for with a terminal already open. Exit code 2 is deliberately absent. It was the Go panic path; #61 removed it and the hostile-input probe keeps it removed, so listing it would document something that can no longer happen. The new test pins all of this against the harness's own exit-code constants rather than against literals, so the prose and the contract cannot drift apart quietly. It also guards a trap this change created: the flag-panic probe locates the flag list by cutting the help output at the first "Flags:", and that string appearing in the prose above would silently point it at the wrong section -- a probe that reads no flags is a probe that passes. Both failure modes were confirmed by mutation before committing. Closes #24 Closes #39 Closes #46 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019EMMhgmTkbzAsmeNy97PrP
The assertion table promised a 2xx check from a flag that passes anything below 400. Since redirects are not followed, that gap is exactly where a health check quietly succeeds against an endpoint now redirecting to a login page. Proxying has always worked and nothing said so, which fails in both directions: users behind a corporate proxy assume it does not, and users with the variable set for unrelated reasons cannot explain why their checks reach the wrong host. The rest of the assertion table was already right -- it distinguished the regexp flags from the exact-match ones correctly, which --help did not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019EMMhgmTkbzAsmeNy97PrP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every reference the tool offers disagreed with the tool.
--helpcould not be used to tell the regexp assertions from the exact-match ones — the single most important distinction in the flag set.--assert-headerand--assert-header-eqcarried identical text, as did--assert-redirectand--assert-redirect-eq, and--assert-bodyadvertised an equality check it has never performed.--assert-okclaimed "successful (2xx)" while passing anything below 400. Verified against a live endpoint:-vsaid it logs info and selects debug;-ssaid it filters and selects error.-mcarried double spaces imported from curl's man page, where they were troff formatting.And
--helpnever mentioned the exit code — the tool's entire output — nor the six options settable from the environment, nor that the transport already honoursHTTP_PROXY:Solution
Descriptions now name the range, level or match semantics they actually implement, and
--helpgrew a section covering exit codes, theHTTP_ASSERT_*variables with their precedence, and proxy support.The 2xx-or-3xx behaviour is documented rather than narrowed.
Test_AssertStatusOKpins 300, 301, 307 and 399 as OK, so it is intentional — curl-fsemantics. Worth knowing that since redirects are not followed, a health check aimed at an endpoint that starts redirecting to a login page stays green.Both header assertions fall back to a presence check when handed a bare name, which the descriptions now say — it is also why asserting a header equals the empty string is not expressible.
A new end-to-end test pins the help text against the harness's own exit-code constants rather than against literals, so the four places these codes now live cannot drift apart quietly. Both of its failure modes were confirmed by mutation before commit, because a guard that has never failed is not a guard.
Other Changes
Exit code
2is deliberately not documented, contrary to what #24 asked for. It was the Go panic path; #61 removed it and the hostile-input probe keeps it removed, so listing it would document something that can no longer happen. The test asserts its absence.#24's remaining item —93conflating "service down" with "service wrong" — is a behaviour change and moved to #71.Notes for the reviewer
The
Longtext carries a trap worth knowing about: the flag-panic probe locates the flag list by cutting--helpat the first"Flags:", so that string appearing in the prose above would silently point it at the wrong section — and a probe that reads no flags is a probe that passes. The new test asserts there is exactly one occurrence.The README's assertion table was already correct about regexp vs exact matching; only its
--assert-okrow was wrong. #37 is narrower than filed — a--help-only bug.Closes #20
Closes #24
Closes #30
Closes #37
Closes #39
Closes #40
Closes #46
🤖 Generated with Claude Code