Repository navigation
fix(git): return 409 when GitHub repo name already exists - #64
Merged
Merged
Conversation
Detect GitHub's 422 "name already exists" response when creating a repository and surface it as a typed `GitProviderError::RepositoryAlreadyExists` variant. The handler maps this to a 409 Conflict with an actionable detail message instead of flattening it to a generic 500. Also fix the frontend ProblemDetails extractor: it was looking for the nonexistent `type_url` field instead of RFC 7807's `type`, and it didn't unwrap envelopes used by hey-api's openapi-ts client (`body`, `error`, `data`). The new version uses a proper type guard and recognizes any shape that carries a `title` plus one canonical RFC 7807 field.
Document the 409-on-duplicate-GitHub-repo-name fix and the ProblemDetails extraction rewrite for downstream release notes.
Move the PR #64 changelog from tmp/ into the actual CHANGELOG.md under [Unreleased] -> Fixed, so the changelog-check CI passes and the entry shows up in the next release notes.
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.
Summary
422 name already existsresponse and surface it as a typedGitProviderError::RepositoryAlreadyExists { name }variant.GitProviderManagerError::ProviderError— forward the typedProblemdirectly.extractProblemDetailsto (1) use the correct RFC 7807 field nametype(nottype_url), (2) unwrapbody/error/dataenvelopes used by hey-api's openapi-ts client, and (3) gate detection on a proper type guard so unrelated thrown objects are not misidentified as ProblemDetails.Files
crates/temps-git/src/services/git_provider.rs— new error variantcrates/temps-git/src/services/github_provider.rs— parse 422 body, detectnamefield "already exists"crates/temps-git/src/handlers/base.rs— map variant to 409, drop redundant wrappingcrates/temps-projects/src/handlers/handlers.rs— propagate typed Problem instead of converting to 500web/src/utils/errorHandling.ts— fix RFC 7807 field name and envelope unwrappingTest plan
title/detailcorrectly through both the bare andbody-nested shapes.