Return 409 Conflict for duplicate skill version uploads (#41)#42
Merged
Aaronontheweb merged 1 commit intonetclaw-dev:devfrom Apr 27, 2026
Merged
Conversation
Previously, uploading a skill version that already existed returned 400 Bad Request, making it hard for clients to distinguish between validation errors and benign duplicate uploads without parsing the response body. - Add IsDuplicateVersion flag and DuplicateVersion() factory to SkillUploadResult - Return 409 Conflict with error code 'duplicate_version' for duplicates - Add integration tests for 409 duplicate and multi-version success
4cdb769 to
3178535
Compare
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
Return 409 Conflict instead of 400 Bad Request when uploading a skill version that already exists.
Follows the same pattern as NuGet — clients can use HTTP status codes alone for idempotent publish pipelines:
Changes
src/SkillServer/Services/SkillUploadService.csIsDuplicateVersionflag toSkillUploadResultSkillUploadResult.DuplicateVersion(error)factory methodDuplicateVersion(...)instead ofFailed(...)src/SkillServer/Endpoints.csUploadSkillhandler: ifresult.IsDuplicateVersion→ returnResults.Conflict(409)with error codeduplicate_versiontests/SkillServer.Integration.Tests/SkillServerIntegrationTests.csUploadSkill_DuplicateVersion_Returns409— verifies 409 response with correct error codeUploadSkill_DifferentVersions_AreAllowed— verifies v1.0.0 and v2.0.0 both succeedMotivation
Enables idempotent skill publishing in CI/CD pipelines (petabridge-skills) without fragile response-body parsing.
Closes #41