feat(releases): release a target to a connected workspace and publish versions (#1028) #1063

Merged
sharang merged 1 commits from feat/sbom-releases into main 2026-11-19 12:35:08 +00:00
Owner

Part of #1028 (phase 4), step 4 of the plan on that issue: releases and publishing, the supplier's side. Stacked on #1062 (the connections client); it will be retargeted to main once that merges.

What it adds

Call What it does
GET /api/v1/targets/{id}/releases The target's releases (active ones first, each group newest first) and its published versions
POST /api/v1/targets/{id}/releases {connection_id} Releases the target over one of the workspace's active connections. 409 released if it's already released over it; 422 unknown_connection otherwise.
POST …/releases/{release}/end Ends a release. Ending it again keeps the first end.
POST /api/v1/targets/{id}/versions {label} Publishes a version: the target's components now, as the stripped CycloneDX from #1049, with the workspace's display name as supplier and the label as version. 409 label_taken, 422 empty, 422 label, 413 too_many_components.
GET …/versions/preview?label= The same document, as a download, without publishing it
  • Storage: releases go in sbom_releases and versions in sbom_versions, both in the supplier's own database.
    • A version's document is kept in the target's upload folder together with its SHA-256. The customer side will use the hash so an unchanged version starts no scan.
    • A release keeps the other workspace's display name from when it was made. It never holds or shows the other tenant's id.
  • Audit: releasing, ending and publishing are recorded through the registry (pruefwerk.sbom_release_created, …_ended, pruefwerk.sbom_version_published).
  • Deleting a target deletes its releases and versions; their files go with its upload folder, as before.
  • Docs: guide/sbom, section "Releasing an SBOM to a connected workspace".

Delivering versions to the customers who accept comes with the customer side (step 5).

Tests

  • Unit: label rules; a release reads as active until it is ended.
  • e2e, without a registry:
    • nothing to publish before there are components;
    • publishing trims the label and counts the components; a duplicate label and an empty label are refused;
    • the stored document is the stripped one: no vulnerabilities, and the CVE appears nowhere in it;
    • a preview stores nothing;
    • releasing without a registry gives 422 unknown_connection;
    • an unknown target gives 404.
  • Against the fake registry (tests/connections.rs):
    • a release over an active connection names the other workspace and never its tenant id;
    • a duplicate gives 409 and an unknown connection 422;
    • ending keeps the first end, and a target can be released again after its release ended;
    • another workspace gets 404 on this target.
  • Checks: the OpenAPI and route gates pass, the cascade tests pass, and clippy is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part of #1028 (phase 4), step 4 of the plan on that issue: releases and publishing, the supplier's side. **Stacked on #1062** (the connections client); it will be retargeted to `main` once that merges. ## What it adds | Call | What it does | |---|---| | `GET /api/v1/targets/{id}/releases` | The target's releases (active ones first, each group newest first) and its published versions | | `POST /api/v1/targets/{id}/releases` `{connection_id}` | Releases the target over one of the workspace's active connections. `409 released` if it's already released over it; `422 unknown_connection` otherwise. | | `POST …/releases/{release}/end` | Ends a release. Ending it again keeps the first end. | | `POST /api/v1/targets/{id}/versions` `{label}` | Publishes a version: the target's components now, as the stripped CycloneDX from #1049, with the workspace's display name as supplier and the label as version. `409 label_taken`, `422 empty`, `422 label`, `413 too_many_components`. | | `GET …/versions/preview?label=` | The same document, as a download, without publishing it | - **Storage:** releases go in `sbom_releases` and versions in `sbom_versions`, both in the supplier's own database. - A version's document is kept in the target's upload folder together with its SHA-256. The customer side will use the hash so an unchanged version starts no scan. - A release keeps the other workspace's display name from when it was made. It never holds or shows the other tenant's id. - **Audit:** releasing, ending and publishing are recorded through the registry (`pruefwerk.sbom_release_created`, `…_ended`, `pruefwerk.sbom_version_published`). - **Deleting a target** deletes its releases and versions; their files go with its upload folder, as before. - **Docs:** `guide/sbom`, section "Releasing an SBOM to a connected workspace". Delivering versions to the customers who accept comes with the customer side (step 5). ## Tests - **Unit:** label rules; a release reads as active until it is ended. - **e2e, without a registry:** - nothing to publish before there are components; - publishing trims the label and counts the components; a duplicate label and an empty label are refused; - the stored document is the stripped one: no `vulnerabilities`, and the CVE appears nowhere in it; - a preview stores nothing; - releasing without a registry gives `422 unknown_connection`; - an unknown target gives `404`. - **Against the fake registry (`tests/connections.rs`):** - a release over an active connection names the other workspace and never its tenant id; - a duplicate gives `409` and an unknown connection `422`; - ending keeps the first end, and a target can be released again after its release ended; - another workspace gets `404` on this target. - **Checks:** the OpenAPI and route gates pass, the cascade tests pass, and clippy is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang changed target branch from feat/registry-connections to main 2026-11-19 12:12:02 +00:00
sharang added 1 commit 2026-11-19 12:12:05 +00:00
feat(releases): release a target to a connected workspace and publish versions (#1028)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m56s
CI / Check (pull_request) Successful in 21m53s
b84c6d329e
The supplier's side of phase 4, step 4 of the plan on #1028:

- `POST /api/v1/targets/{id}/releases` releases a target over one of the
  workspace's active connections (#1062), once per connection at a time
  (409 `released`); an unknown or inactive connection is 422
  (`unknown_connection`); `…/releases/{release}/end` ends it (idempotent);
- `POST /api/v1/targets/{id}/versions` publishes a version: the target's
  components now as the stripped CycloneDX (`released_cyclonedx`, #1049),
  the workspace's display name as supplier and the label as version; labels
  are unique per target (409), a target without components is 422; the
  document is kept in the target's upload folder with its SHA-256, so an
  unchanged version is never delivered twice;
- `GET …/versions/preview?label=` builds it without storing it;
- `GET /api/v1/targets/{id}/releases` lists releases (active first) and
  versions;
- releasing, ending and publishing are audited; deleting a target deletes
  its releases and versions (their files with its upload folder).

Delivering versions to the customers who accept comes with the customer
side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang force-pushed feat/sbom-releases from a2f768d99c to b84c6d329e 2026-11-19 12:12:05 +00:00 Compare
sharang merged commit c8a13fecad into main 2026-11-19 12:35:08 +00:00
sharang deleted branch feat/sbom-releases 2026-11-19 12:35:08 +00:00
Sign in to join this conversation.