Repository navigation
fix: make exit codes match the documented contract - #4
Merged
Merged
Conversation
Network failures, rate limits and server errors now exit 8. Previously `read` and `user` reported every failure as not found (5), and `search` and `front` exited 1, so callers could not tell when to retry. `hn user` moves to the Firebase API because Algolia answers 500 for unknown users. An empty `hn front` exits 3, and `hn status --json` exits 8 when the API is down.
Owner
|
This is the right fix. A dropped connection exiting 5 reads as a deleted item, which is exactly the case an agent needs to separate from an outage. Routing everything through one Firebase for |
Owner
|
This shipped in v0.3.0. |
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.
The README promises exit 8 for retryable errors, but only
hn statuscould return it.readanduserturned every failure into exit 5, so a dropped connection looked like a deleted item.searchandfrontexited 1. An agent couldn't tell when to retry.readoruser, network downsearchorfront, network downhn frontwith no storieshn status --json, API downhn usernow uses the Firebase API. Algolia answers 500 for an unknown user, which can't be told apart from an outage. Firebase answersnull. The--jsonoutput keeps its fields.I also dropped "no rate limits" from the README and AGENTS.md. I couldn't find an official limit, but community guides report about 10k requests an hour per IP, so the claim looked unsafe.
Checked with
make test,golangci-lint, and live runs against the APIs, with a dead proxy for the network cases.