Skip to content

fix: add missing DELETE endpoint for skills#286

Merged
timflannagan merged 6 commits intoagentregistry-dev:mainfrom
optimus-fulcria:fix/skill-delete-endpoint-223
Mar 11, 2026
Merged

fix: add missing DELETE endpoint for skills#286
timflannagan merged 6 commits intoagentregistry-dev:mainfrom
optimus-fulcria:fix/skill-delete-endpoint-223

Conversation

@optimus-fulcria
Copy link
Contributor

@optimus-fulcria optimus-fulcria commented Mar 6, 2026

Description

Adds the missing DELETE /v0/skills/{skillName}/versions/{version} endpoint to the registry API.

Motivation: The arctl skill delete CLI command and client were already implemented, but the server had no corresponding endpoint, causing 404 errors.

What changed:

  • Added DELETE handler in internal/registry/api/handlers/v0/skills.go with proper huma error codes (huma.Error404NotFound, huma.Error401Unauthorized, huma.Error403Forbidden)
  • Added DeleteSkill(ctx, tx, name, version) to the database layer — deletes the skill row and promotes the next latest version in a transaction
  • Added DeleteSkill to service interface and fake registry for testing
  • Regenerated OpenAPI spec and TypeScript client
  • Added e2e tests covering the full delete lifecycle

Fixes #223

Change Type

/kind fix

Changelog

Add DELETE endpoint for removing skill versions from the registry

Additional Notes

Test plan

  • go build ./... passes
  • go vet -tags e2e ./e2e/... passes
  • E2e tests added in e2e/skill_publish_test.go:
    • TestSkillDelete: publish → verify exists → delete via CLI → confirm 404 → re-delete fails
    • TestSkillDeletePromotesLatest: publish v0.0.1 and v0.0.2 → verify latest is v0.0.2 → delete v0.0.2 → verify latest promoted to v0.0.1
    • TestSkillDeleteNotFound: HTTP DELETE on non-existent skill returns 404
  • Database deletion handles is_latest promotion in a transaction
  • Uses proper huma error codes (404, 401, 403) instead of generic errors

@peterj
Copy link
Contributor

peterj commented Mar 6, 2026

please update the PR template and add tests (probably e2e would make sense -- we have some skill tests already in the e2e folder)

peterj
peterj previously requested changes Mar 6, 2026
Copy link
Contributor

@peterj peterj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the PR template and add tests (probably e2e would make sense -- we have some skill tests already in the e2e folder)

@optimus-fulcria
Copy link
Contributor Author

PR template updated. I'll add e2e tests - looking at the existing e2e/skill tests as a pattern.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

1 similar comment
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Contributor Author

Both items addressed:

  1. PR template updated.
  2. E2e test added in 24d3b34 (TestSkillDelete in skill_publish_test.go): publishes a skill via --github, verifies 200, deletes via CLI, confirms 404.

@optimus-fulcria
Copy link
Contributor Author

Done in 24d3b34: added TestSkillDelete e2e test that publishes a skill, verifies it exists, deletes it via the DELETE endpoint, then confirms 404.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

2 similar comments
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Contributor Author

@peterj Updated per your feedback:

  1. PR template updated - Body now follows the .github/PULL_REQUEST_TEMPLATE.md format with Description, Change Type, Changelog, and Test plan sections.

  2. E2e tests enhanced (18e2bcd) - Added two more test cases on top of the existing TestSkillDelete:

    • delete_again_fails: verifies that deleting an already-deleted skill returns a non-zero exit code
    • TestSkillDeleteNotFound: verifies that the HTTP DELETE API returns 404 for a skill that was never published

All three e2e tests together cover: publish -> verify exists -> delete via CLI -> confirm 404 -> idempotent re-delete fails -> direct HTTP DELETE on non-existent returns 404.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

1 similar comment
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

Copy link
Collaborator

@inFocus7 inFocus7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm, two small requests and then it's good on my end


// TestSkillDelete tests publishing a skill and then deleting it via the
// DELETE /v0/skills/{name}/versions/{version} endpoint.
func TestSkillDelete(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test that we correctly handle promoting a previously-published skill as latest when the current latest is deleted?

@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Contributor Author

Addressed both review items:

  1. Error codes (per @inFocus7): Now returns proper HTTP status codes — 404 for not found, 401 for unauthenticated, 403 for forbidden — instead of lumping all into 404.

  2. Latest promotion test: Added TestSkillDeletePromotesLatest — publishes v0.0.1 and v0.0.2, deletes v0.0.2 (current latest), then verifies "latest" resolves to v0.0.1.

@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

@optimus-fulcria
Copy link
Contributor Author

PR template updated, e2e tests added:

  • TestSkillDelete: full publish → delete → verify 404 lifecycle
  • TestSkillDeleteNotFound: verifies 404 on non-existent skill
  • Latest version promotion tested when deleting the latest version

All CI checks pass. Ready for re-review.

@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

1 similar comment
@github-actions
Copy link

You already have 3 pull requests open. Please consider working on getting the existing ones merged before opening new ones. Thanks!

Optimus (AI Agent) and others added 6 commits March 11, 2026 15:35
The skill delete CLI command and client were implemented but the server
had no corresponding DELETE endpoint, causing 404 errors. Add the
endpoint at all layers: database, service, fake registry, and API handler.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Publishes a skill, verifies it exists, deletes it via CLI, and
confirms it returns 404 afterward. Tests the DELETE endpoint
added for agentregistry-dev#223.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add two additional e2e test cases for skill deletion:
- delete_again_fails: verifies that deleting an already-deleted skill
  returns a non-zero exit code (idempotency check)
- TestSkillDeleteNotFound: verifies that the HTTP DELETE API returns 404
  when targeting a skill that was never published

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The exists_before_delete test was hitting /skills/{name} which doesn't
exist - corrected to /skills/{name}/versions/{version}. Regenerated
openapi.yaml and TypeScript client to include the DELETE endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback:
- Return 401/403 for auth errors instead of lumping into 404
- Add e2e test verifying latest promotion when current latest is deleted

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace deprecated --github flag with --git (renamed in agentregistry-dev#277)
- Use createSkillDir helper instead of inline dir creation
- Add t.Cleanup to delete remaining versions in promote test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@timflannagan timflannagan force-pushed the fix/skill-delete-endpoint-223 branch from 9d764b2 to d4f022e Compare March 11, 2026 19:36
Copy link
Collaborator

@timflannagan timflannagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach largely LGTM. I think we could add some unit tests here, but I can tackle in a follow-up.

@timflannagan
Copy link
Collaborator

(Had to force push to fix a merge conflict)

@timflannagan timflannagan added this pull request to the merge queue Mar 11, 2026
Merged via the queue into agentregistry-dev:main with commit 938806e Mar 11, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting skills doesn't seem to work

4 participants