Skip to content

feat(copy): copy and move artifacts between hosted repositories - #530

Merged
M0Rf30 merged 2 commits into
mainfrom
feat/copy-move
Nov 27, 2026
Merged

M0Rf30 merged 2 commits into
mainfrom
feat/copy-move

Conversation

@M0Rf30

@M0Rf30 M0Rf30 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Copy or move artifacts between two hosted repositories of the same format.

  • POST /api/v1/repositories/{source}/copy and /move (items by package+version, or sha256+path; dry_run, admin-only force), built on the promote engine.
  • oa cp / oa mv, and "Copy to…" / "Move to…" on the artifact page with a dry-run preview.
  • Docs: docs/repositories/copy-and-move.md, CLI and API reference regenerated.

Decisions

  • A copy carries the artifact's properties; scan results are not copied. The target emits artifact.uploaded, which drives scan-on-upload and policies. created_at of a copy is the copy time.
  • Move = copy, then trash the source in the same transaction (restorable). A source held by a sealed release bundle or in an immutable release is refused unless an admin passes force.
  • Authorization is checked per artifact: read on the source, write on the target, delete on the source for a move. Invisible repositories answer 404. New RBAC scope transfer.
  • Audit names are artifact.copied / artifact.moved (the DB constraint and the repo convention use past tense, not artifact.copy). Migration 032 extends chk_audit_action; the integrator must merge it with other audit-constraint changes.
  • BundlesStore gained GetOrCreateStorageQuota (shared quota accounting).

Out of scope (per the issue)

Adopting proxy-cache artifacts, cross-format copies, copying a whole repository or a path prefix.

Known gaps

  • Docker move leaves index children and blobs in the source; a docker tag only narrows between manifests.
  • An existing target artifact keeps its own properties.
  • The dry-run quota check is advisory.

Checks

  • golangci-lint on promote, api, middleware, oacli, audit, cmd/server: 0 issues; make deadcode, make docs-check ok.
  • go test -short on the same packages; integration on promote, audit, database; bun test (2513 pass), bun run i18n:check.
  • Real clients against a local server: mvn deploy -> oa cp/oa mv -> mvn dependency:get from the target (jar byte-identical); npm publish -> oa cp -> npm install; restore from trash after a move; non-admin token matrix (copy ok, move 403 without delete, force 403, invisible repo 404).
  • Browser: dialog checked in light and dark themes.
  • bun run typecheck reports only src/telemetry/otel.ts(105,28), unrelated to this change.

Closes #511

- POST /api/v1/repositories/{source}/copy and /move, built on the promote engine
- copies carry properties and emit artifact.uploaded webhooks; created_at is the copy time; a move trashes the source
- oa cp / oa mv and a "Copy to…/Move to…" dialog with a dry-run preview
- migration 032 adds the artifact.copied audit action
- docs and OpenAPI updated
@github-actions

Copy link
Copy Markdown

Coverage

Coverage vs main
Go, unit + integration 83.2% -0.1
Go, unit tests only 69.5% -0.2
Go, integration tests only 53.1% ±0.0
Web, lines 91.8% ±0.0
Web, functions 85.7% -0.1
Go by area
Area Coverage vs main
cmd/docgen 80.3% ±0.0
cmd/genformats 90.8% ±0.0
cmd/oa 0.0% ±0.0
cmd/resetpw 0.0% ±0.0
cmd/server 70.2% ±0.0
internal/ai 85.6% ±0.0
internal/api 77.0% -0.2
internal/apkkeys 77.1% ±0.0
internal/apktest 90.7% ±0.0
internal/artifactpath 100.0% ±0.0
internal/attest 84.0% ±0.0
internal/attestation 79.2% ±0.0
internal/audit 97.6% ±0.0
internal/auth 91.6% ±0.0
internal/backup 72.4% ±0.0
internal/bgtask 96.8% ±0.0
internal/blockreason 100.0% ±0.0
internal/branding 93.5% ±0.0
internal/bundlechecks 100.0% ±0.0
internal/clientsetup 93.0% ±0.0
internal/config 96.4% ±0.0
internal/cron 90.0% ±0.0
internal/crypto 91.0% ±0.0
internal/csaf 85.0% ±0.0
internal/curation 99.2% ±0.0
internal/database 76.0% ±0.0
internal/declarative 84.1% ±0.0
internal/dtrack 85.3% ±0.0
internal/exploit 94.1% +0.5
internal/federation 81.6% -0.1
internal/format 80.2% ±0.0
internal/formats 88.0% ±0.0
internal/gpgkeys 86.8% ±0.0
internal/group 89.5% ±0.0
internal/httpcache 100.0% ±0.0
internal/httpcompress 93.3% ±0.0
internal/httpx 85.7% ±0.0
internal/imagesbom 81.9% ±0.0
internal/importmeta 93.3% ±0.0
internal/iocopy 100.0% ±0.0
internal/itempath 98.3% ±0.0
internal/lazyre 100.0% ±0.0
internal/license 98.5% ±0.0
internal/licensemeta 87.5% ±0.0
internal/licensepolicy 92.6% ±0.0
internal/limitio 92.9% ±0.0
internal/mcp 89.9% ±0.0
internal/metrics 96.2% ±0.0
internal/middleware 94.6% ±0.0
internal/netutil 93.4% ±0.0
internal/nixkeys 79.6% ±0.0
internal/oacli 85.0% -0.2
internal/ocimanifest 100.0% ±0.0
internal/ocipath 100.0% ±0.0
internal/ociref 96.8% ±0.0
internal/osv 89.8% ±0.0
internal/passwd 93.3% ±0.0
internal/pathseg 100.0% ±0.0
internal/pglock 79.0% ±0.0
internal/pkgdeps 88.1% ±0.0
internal/presign 99.2% ±0.0
internal/promote 84.0% -0.4
internal/proxy 86.8% ±0.0
internal/publicurl 96.8% ±0.0
internal/pypisimple 97.9% ±0.0
internal/quarantine 100.0% ±0.0
internal/quayapi 81.2% ±0.0
internal/quota 92.2% ±0.0
internal/recovery 85.3% -0.3
internal/registry 100.0% ±0.0
internal/replication 78.1% ±0.0
internal/repodispatch 85.1% ±0.0
internal/repotype 97.0% ±0.0
internal/rpmextra 92.9% ±0.0
internal/sbom 89.9% ±0.0
internal/scanexport 96.4% ±0.0
internal/search 90.5% ±0.0
internal/secrets 91.4% ±0.0
internal/storage 84.9% ±0.0
internal/telemetry 92.2% ±0.0
internal/tiering 83.5% ±0.0
internal/trash 96.7% ±0.0
internal/urlparams 100.0% ±0.0
internal/vexsync 80.0% ±0.0
internal/vuln 89.8% -0.1
internal/webhook 86.1% ±0.0
internal/worker 82.7% ±0.0
internal/workq 79.5% ±0.0
pkg/ansible 89.8% ±0.0
pkg/cargo 95.6% ±0.0
pkg/compactindex 97.8% ±0.0
pkg/composer 94.5% ±0.0
pkg/conan 99.2% ±0.0
pkg/conda 94.8% ±0.0
pkg/delta 71.4% ±0.0
pkg/gemversion 100.0% ±0.0
pkg/helm 97.0% ±0.0
pkg/lockfile 96.7% ±0.0
pkg/logger 96.9% ±0.0
pkg/maven 96.7% ±0.0
pkg/nix 99.1% ±0.0
pkg/npm 88.0% ±0.0
pkg/nuget 97.6% ±0.0
pkg/pyversion 100.0% ±0.0
pkg/rubymarshal 87.1% ±0.0
tests/integration 78.8% ±0.0
web 93.7% ±0.0
Web by area (lines)
Area Coverage vs main
src 85.1% ±0.0
src/api 92.7% -0.1
src/components 90.3% ±0.0
src/composables 89.7% ±0.0
src/demo 93.0% ±0.0
src/i18n 98.5% ±0.0
src/lib 99.2% ±0.0
src/pages 92.1% ±0.0
src/pwa 97.6% ±0.0
src/router 98.6% ±0.0
src/stores 99.0% ±0.0
src/telemetry 90.8% ±0.0

Full report (HTML, merged profile) in the CI run artifacts

The bundle/copy authz mock loads token scope targets by ID (#528 made the evaluator read them).
@M0Rf30
M0Rf30 merged commit 223ca7b into main Nov 27, 2026
25 checks passed
@M0Rf30
M0Rf30 deleted the feat/copy-move branch November 27, 2026 17:54
@M0Rf30 M0Rf30 mentioned this pull request Nov 27, 2026
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.

Copy and move artifacts between hosted repositories

1 participant