Repository navigation
fix(cli): classify github failures and give every error a remedy - #90
Open
FreshlyBrewedCode wants to merge 2 commits into
Open
FreshlyBrewedCode wants to merge 2 commits into
FreshlyBrewedCode wants to merge 2 commits into
Conversation
Non-2xx GitHub responses now carry a classified failure from the transport (unauthenticated, forbidden, not-found, unexpected). The API layer phrases each in the caller's terms with the repository or resource it addressed: an invalid or expired credential names how to supply a working one; a credential that cannot reach the repository is not told to sign in again; a missing repository is named and described as not found or not visible; and an unexpected status keeps GitHub's own message. The sweep also gives previously vague filesystem and server messages a path and a next step, and report.ts collapses any multi-line diagnosis to the single 'wayful:'-prefixed stderr line the contract promises. closes #81
This branch has not been 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.
closes #81
User-facing change
Every CLI failure now names the actual problem and, where one exists, the remedy. The GitHub transport classifies a non-2xx response and the API layer phrases it in the caller's terms, so the four failures that used to collapse into
unexpected status Nare now distinct:gh auth loginorGH_TOKEN).Rate-limit failures keep their existing distinct primary and secondary messages and retry advice.
The sweep also gives previously vague filesystem and server messages a path and a next step, and
report.tsnow collapses any multi-line diagnosis to a singlewayful:-prefixed stderr line, so the single-line/no-stack-trace contract holds even when a backend hands back a multi-line body.Before / after examples
Invalid credential:
Credential that cannot reach the repository:
Repository configured but not found/visible:
Missing resource (e.g. a step):
Filesystem read failures now name the directory and the next step:
How it works
GithubHttp.getJsonraises a classifiedGithubRequestError(unauthenticated/forbidden/not-found/unexpected) instead of a genericunexpected status N.api.ts'sgithubFailureturns a classification plus the addressed repository/resource into the caller-terms message; every GitHub call site routes its non-2xx path through it.graphql.tsuses the same classification for snapshot reads.oneLine(indomain/errors.ts) collapses multi-line messages;report.tsapplies it to every diagnosis.Tests
http.test.ts: status → classification, GitHub message preserved.api.test.ts: credential, access, repository-not-found, resource-not-found, and unexpected-status messages.mapStore.test.ts:listMapsfailure messages at the store seam.graphql.test.ts: classified snapshot failures.domain/errors.test.ts: single-line collapsing.bun check(lint, typecheck, tests) passes.