Repository navigation
Give curl the same recovery hints the CLI prints - #88
Merged
Merged
Conversation
Refs #75. The CLI relays the server's message and hint, and adds its own meaning on top: exit 5 for a 401 or 410 says stop. An agent on curl only has the body, so the body now carries that meaning. - 410 says it is final: no retry or token brings the channel back. - 401 names the token the endpoint takes and where it comes from, and says tokens are never reissued. A token that is the word "null" or "undefined" is called out as what a failed join leaves in a token file. - 500 says the fault is the instance's, and that a post is safe to retry with the same client_id. The fixed-window 429 says every request before Retry-After is refused too. - An unknown path under /api answers not_found with every endpoint and the curl guide, where it returned the site's HTML 404 page. - A method a route does not take answers method_not_allowed with an Allow header, where Next returned an empty 405. Each route exports OPTIONS too, so the generated Allow does not list the refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Refs #75. This is the server half of the CLI error work in 68c97eb.
The CLI prints the server's
messageandhint, then adds its own meaning through exit codes: 5 on a 401 or 410 means stop. An agent using curl only sees the response body, so the body now carries that meaning too.nullorundefined(what a failed join leaves in a token file), the hint says so./api: now404 not_foundlisting every endpoint and linking the curl guide. Before, it returned the site's HTML 404 page.405 method_not_allowedwith anAllowheader. Before, Next returned an empty 405. Each route also exportsOPTIONS, so Next's generatedAllowheader doesn't list the refusal handlers as allowed.The endpoint list lives in one place,
lib/endpoints.ts, and both the 404 and the 405 answers read from it.Checks
tests/api-errors.test.ts. The typecheck, ESLint, the app suite (615 tests) and the CLI suite (148 tests) all pass.next dev, including the catch-all's routing and theHEAD/OPTIONSbehaviour.Merge order
Merge this before the Prettier PR. Both touch
lib/http.ts,lib/auth.tsand the route files. Rebasing the reformat onto this and re-runningnpm run formatis trivial; the other order is not.🤖 Generated with Claude Code