Loading
feat(npm): npm hosted step 20, part 2 of 3 — unpublish handler + core tests
Part 2 of 3 of the npm hosted plan — Step 20: whole-package unpublish + inline cascade.
🗂️ Stacked MRs
Split into 3 stacked MRs to keep each within the review size limit (~600 ideal reviewable LoC). Each part targets the previous one (part 1 → main); review and merge bottom-up.
- feat(npm): npm hosted step 20, part 1 of 3 — un... (!699 - merged) • David Fernandez • 19.2
- feat(npm): npm hosted step 20, part 2 of 3 — un... (!700 - merged) • David Fernandez • 19.2
👈 - test(npm): npm hosted step 20, part 3 of 3 — un... (!701 - merged) • David Fernandez • 19.2
🔌 What this part adds
UnpublishPackageHandlerforDELETE /{slug}/npm/{repo}/{package}/-rev/{rev}: verifies{rev}(mismatch → 409rev_mismatch), missing package → 404package_not_found, missing auth resolution → 500 (AC 58). On success returns 200{"ok": true}and emits the post-commitbufferedUpdatecounter events (repositories.artifacts_count,repositories.size_bytes) off the request path.InstallBufferedWaitGrouptest-export shim, so the externalnpm_testpackage can await the detachedbufferedUpdategoroutines deterministically.- Core integration tests plus the shared fixture helpers the whole unpublish suite builds on.
ℹ️ The route is currently wired to a 501 placeholder inhandler.go; mounting the real handler is a deliberate later step, the same pattern used for the other npm handlers.
✅ Spec coverage
| Acceptance criterion / case | Test |
|---|---|
| AC 59 — happy path (200, package + versions soft-deleted) | TestUnpublishPackageIntegration_Success |
AC 59 — non-matching {rev} → 409 rev_mismatch |
TestUnpublishPackageIntegration_RevMismatch |
AC 34 — missing package → 404 package_not_found |
TestUnpublishPackageIntegration_PackageNotFound |
| AC 58 — auth contract (no resolution → 500) | TestUnpublishPackageIntegration_MissingResolution_Returns500 |
| AC 27 — metadata cache invalidated in-tx | TestUnpublishPackageIntegration_CacheInvalidated |
📚 References
- Plan: https://gitlab.com/gitlab-org/ops/artifact-registry/-/blob/main/docs/plans/2026-05-11-npm-hosted.md
- Spec: https://gitlab.com/gitlab-org/ops/artifact-registry/-/blob/main/docs/specs/S11-npm-hosted.md
Related to #138 (closed)
Edited by David Fernandez