ADR 0001 · Nexus Repository 3 CI REST compatibility adapter
Status. M1 recorded the architecture decision. The proposed inbound adapter and acceptance criteria below targeted M3. Arka already served protocol clients at /repository/{repo}/… and OCI clients at /v2/…. The existing internal/migration/nexus3 driver reads remote Nexus instances. See the cutover guide for the shipped adapter.
Existing CI callers
Legacy CI often searches components, lists assets with pagination, or picks a download URL before invoking Maven, npm, pip, or Docker. These flows depend on Nexus field names, opaque IDs, continuation tokens, and response codes. Putting those conventions in Arka’s Huma DTOs would bind native clients to a third-party version and duplicate authorization.
Decision and boundaries
- In the Arka process,
cmd/arkamounts the separateinternal/compat/nexus3handler only when explicitly enabled. Scope it to/service/rest/v1/. Disabled routes return HTTP 404, including with the Console SPA fallback. - The adapter owns Nexus wire DTOs, parameter parsing, cursors, ID mapping, and status conversion. Use existing domain services and narrow interfaces with the same principal, repository and member grants, path and coordinate checks, upload validation, quotas, and audit rules. Format-specific multipart mapping uses the format extension point.
- Huma registers native management operations under
/api/v1/*. Preserve native code-first DTOs, OpenAPI, Go and Console SDKs, collection envelopes, and Problem Details. Keep compatibility routes out of the native contract. Centralize wiring, the feature flag, and prefix dispatch in the composition root. - Enable operations with side effects only after their authorization and audit tests pass. Return an unsupported error when a route cannot preserve authorization or semantics. Avoid all-repository scans, administrator impersonation, cross-repository deletes, and arbitrary upstream requests.
Twelve candidate CI routes for M3
The prefix is /service/rest/v1. Freeze fields, pagination, and status codes against the chosen Nexus OpenAPI version and sanitized CI samples.
| Method and path | Required CI behavior |
|---|---|
GET /status | Health probe and unavailable status. |
GET /repositories | Visible repository names, formats, types, and URLs. |
GET /components?repository=… | Paginated components, versions, and asset references. |
GET /components/{id} | Visible component and assets by stable opaque ID. |
POST /components?repository=… | Multipart upload for selected Hosted formats with checksum, quota, and write audit. |
DELETE /components/{id} | Delete the exact component and linked assets, enforcing authorization and audit. |
GET /assets?repository=… | Paginated asset paths, checksums, and download URLs. |
GET /assets/{id} | Metadata for one visible asset. |
DELETE /assets/{id} | Single-asset deletion with shared blob reference protection. |
GET /search | Filter by repository and coordinate, order, and paginate components. |
GET /search/assets | Filter visible assets and checksums. |
GET /search/assets/download | Select one asset and verify empty, ambiguous, redirect, and authorization cases. |
Upstream references are the Sonatype Components API and Search API.
Evidence required for M3
- Use
internal/archtestto check imports and registration. Core, protocol, persistence, HTTP API, and format drivers cannot depend on the compatibility package. The adapter cannot import postgres or pgx or execute SQL directly. Keep existing architecture tests and verify Huma still owns native routes. - Compare
api/openapi.jsonand generated clients with the flag on and off. Assert HTTP 404 for disabled compatibility routes. When enabled, verify that only allowlisted methods and paths reach the adapter. Cover adjacent native API, repository, OCI, and Console routes. - Replay the same sanitized requests against Nexus and Arka. On a fresh PostgreSQL dataset, verify fields, statuses, order, downloads, and complete pagination with no duplicates. Test opaque IDs and cursors across users, repositories, and expiration.
- Verify anonymous, read, write, administrator, path- and coordinate-scoped access, and invisible Group members. Check upload and delete in isolated repositories. Read back assets, object references, audit, and post-error state. Document format coverage and limits for each route.