Skip to content

Return 409 Conflict for duplicate skill version uploads (#41)#42

Merged
Aaronontheweb merged 1 commit intonetclaw-dev:devfrom
Aaronontheweb:fix/409-duplicate-version
Apr 27, 2026
Merged

Return 409 Conflict for duplicate skill version uploads (#41)#42
Aaronontheweb merged 1 commit intonetclaw-dev:devfrom
Aaronontheweb:fix/409-duplicate-version

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Contributor

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:

Status Meaning
201 Published successfully
409 Already exists (skip, no-op)
400 Actual validation error
401/403 Auth problem

Changes

src/SkillServer/Services/SkillUploadService.cs

  • Added IsDuplicateVersion flag to SkillUploadResult
  • Added SkillUploadResult.DuplicateVersion(error) factory method
  • Version-exists check now returns DuplicateVersion(...) instead of Failed(...)

src/SkillServer/Endpoints.cs

  • UploadSkill handler: if result.IsDuplicateVersion → return Results.Conflict(409) with error code duplicate_version
  • Other validation errors still return 400 as before

tests/SkillServer.Integration.Tests/SkillServerIntegrationTests.cs

  • UploadSkill_DuplicateVersion_Returns409 — verifies 409 response with correct error code
  • UploadSkill_DifferentVersions_AreAllowed — verifies v1.0.0 and v2.0.0 both succeed

Motivation

Enables idempotent skill publishing in CI/CD pipelines (petabridge-skills) without fragile response-body parsing.

Closes #41

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
@Aaronontheweb Aaronontheweb force-pushed the fix/409-duplicate-version branch from 4cdb769 to 3178535 Compare April 27, 2026 19:29
@Aaronontheweb Aaronontheweb merged commit 7c8dde3 into netclaw-dev:dev Apr 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return 409 Conflict for duplicate skill version uploads

1 participant