Part of #1028 (phase 4), step 5, first half: the customer's side of a release. Based on main (#1063 is merged).
What it adds
Call
What it does
POST /api/v1/targets/{id}/releases (changed)
After the registry confirms again that the connection joins exactly these two workspaces (ConnectionState::peer_of), writes an offer into the customer's database. If the offer can't be written, the release is taken back.
GET /api/v1/sbom-offers
The workspace's offers, open ones first. Each shows the supplier's name and its product, nothing else of the supplier's.
POST /api/v1/sbom-offers/{id}/accept
Into an existing supplier component (target_id), or a new one (name, project_ids; named after the product when no name is given). The connection is checked again first; if it has ended, the offer ends and nothing is created. Refusals: 409 answered, 409 ended, 409 target_taken, 422 not_supplier_component.
POST /api/v1/sbom-offers/{id}/decline
Declines; 409 answered if already answered
POST …/releases/{release}/end (changed)
Also ends the customer's offer
The supplier sees the answer:answer on each release (accepted or declined).
Tenant ids: the release keeps the customer's tenant id and the offer keeps the supplier's. They are used internally for writing across; neither is ever shown.
New components count like any other target: a component created on accepting goes through the same insert as POST /api/v1/targets. That insert is now the shared onboarding::insert_target, which handles CSAF refresh and the target.added usage event.
Audit:pruefwerk.sbom_offer_accepted and pruefwerk.sbom_offer_declined.
Docs:guide/sbom, the customer's side.
Concurrency and deletes:
Claim first: accepting claims the offer atomically before it creates anything. If the insert fails, the claim is given back. If the supplier ends the release between claim and insert, the still-empty component is removed and the answer is 409 ended.
One release per component: if two acceptances race into one component, neither keeps it (target_taken), and the next one finds the component free. Ids are compared canonically.
Release must be live: an offer is accepted only while the supplier's release exists and hasn't ended, as well as the connection being active.
Peer must hold Prüfwerk: a release to a workspace without Prüfwerk, or a halted or archived one, gives 422 peer_not_entitled. No database is created for it.
Deleting either side ends the offer: if the supplier deletes the target, its releases end at the customers. If the customer deletes the component, offers into it end, and the supplier sees ended.
Plan: there is no hard target cap. A component created on accepting is a target like one made by POST /api/v1/targets, billed as included or extra under t72.
Delivering published versions to accepted offers is the second half (next PR).
Tests (tests/connections.rs, fake registry)
Full round trip:
the supplier releases and the customer sees the offer, never with the supplier's tenant id;
accepting into a component of the customer's own is refused (not_supplier_component);
accepting into a new component names it and records the supplier product;
accepting twice gives 409 answered;
the supplier sees accepted;
ending the release ends the offer;
a second release is listed first while open, declined, and the supplier sees declined.
Ended connection: an offer over an ended connection gives 409 ended, and no target is created.
No Prüfwerk: a release to a workspace without Prüfwerk is refused, and no database appears for it.
Deletes:
the supplier deletes the target: the offer is ended, and accepting gives 409 ended;
the customer deletes the component: the supplier sees ended.
One component, two releases: the second acceptance gives target_taken even with the id in another case, and that offer stays open.
Checks: the OpenAPI, route and role gates pass; the e2e releases and onboarding tests pass; clippy is clean.
Part of #1028 (phase 4), step 5, first half: the customer's side of a release. Based on `main` (#1063 is merged).
## What it adds
| Call | What it does |
|---|---|
| `POST /api/v1/targets/{id}/releases` (changed) | After the registry confirms again that the connection joins exactly these two workspaces (`ConnectionState::peer_of`), writes an offer into the customer's database. If the offer can't be written, the release is taken back. |
| `GET /api/v1/sbom-offers` | The workspace's offers, open ones first. Each shows the supplier's name and its product, nothing else of the supplier's. |
| `POST /api/v1/sbom-offers/{id}/accept` | Into an existing supplier component (`target_id`), or a new one (`name`, `project_ids`; named after the product when no name is given). The connection is checked again first; if it has ended, the offer ends and nothing is created. Refusals: `409 answered`, `409 ended`, `409 target_taken`, `422 not_supplier_component`. |
| `POST /api/v1/sbom-offers/{id}/decline` | Declines; `409 answered` if already answered |
| `POST …/releases/{release}/end` (changed) | Also ends the customer's offer |
- **The supplier sees the answer:** `answer` on each release (`accepted` or `declined`).
- **Tenant ids:** the release keeps the customer's tenant id and the offer keeps the supplier's. They are used internally for writing across; neither is ever shown.
- **New components count like any other target:** a component created on accepting goes through the same insert as `POST /api/v1/targets`. That insert is now the shared `onboarding::insert_target`, which handles CSAF refresh and the `target.added` usage event.
- **Audit:** `pruefwerk.sbom_offer_accepted` and `pruefwerk.sbom_offer_declined`.
- **Docs:** `guide/sbom`, the customer's side.
- **Concurrency and deletes:**
- **Claim first:** accepting claims the offer atomically before it creates anything. If the insert fails, the claim is given back. If the supplier ends the release between claim and insert, the still-empty component is removed and the answer is `409 ended`.
- **One release per component:** if two acceptances race into one component, neither keeps it (`target_taken`), and the next one finds the component free. Ids are compared canonically.
- **Release must be live:** an offer is accepted only while the supplier's release exists and hasn't ended, as well as the connection being active.
- **Peer must hold Prüfwerk:** a release to a workspace without Prüfwerk, or a halted or archived one, gives `422 peer_not_entitled`. No database is created for it.
- **Deleting either side ends the offer:** if the supplier deletes the target, its releases end at the customers. If the customer deletes the component, offers into it end, and the supplier sees `ended`.
- **Plan:** there is no hard target cap. A component created on accepting is a target like one made by `POST /api/v1/targets`, billed as included or extra under t72.
Delivering published versions to accepted offers is the second half (next PR).
## Tests (`tests/connections.rs`, fake registry)
- **Full round trip:**
- the supplier releases and the customer sees the offer, never with the supplier's tenant id;
- accepting into a component of the customer's own is refused (`not_supplier_component`);
- accepting into a new component names it and records the supplier product;
- accepting twice gives `409 answered`;
- the supplier sees `accepted`;
- ending the release ends the offer;
- a second release is listed first while open, declined, and the supplier sees `declined`.
- **Ended connection:** an offer over an ended connection gives `409 ended`, and no target is created.
- **No Prüfwerk:** a release to a workspace without Prüfwerk is refused, and no database appears for it.
- **Deletes:**
- the supplier deletes the target: the offer is `ended`, and accepting gives `409 ended`;
- the customer deletes the component: the supplier sees `ended`.
- **One component, two releases:** the second acceptance gives `target_taken` even with the id in another case, and that offer stays open.
- **Checks:** the OpenAPI, route and role gates pass; the e2e releases and onboarding tests pass; clippy is clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang
changed target branch from feat/sbom-releases to main2026-11-19 12:35:07 +00:00
The first half of phase 4's customer side (step 5 of the plan on #1028):
- releasing a target (#1063) now writes an offer into the customer's
database, right after the registry confirms the connection joins exactly
the two workspaces (`ConnectionState::peer_of`, #1062); without the offer
the release is taken back;
- `GET /api/v1/sbom-offers`: the workspace's offers, open first, naming the
supplier and its product only;
- `POST /api/v1/sbom-offers/{id}/accept`: into an existing supplier
component, or a new one (named after the product unless named, in the
given projects); the connection is checked again first, and an ended one
ends the offer and creates nothing; a new component goes through the same
insert as `POST /api/v1/targets` (`insert_target`), so it is counted;
- `POST /api/v1/sbom-offers/{id}/decline`;
- the answer is written back to the supplier's release (`answer`); ending a
release ends the customer's offer; accepting and declining are audited.
Delivering published versions to accepted offers is the second half.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
- accepting claims the offer first (offered -> accepted, atomically) and
only then creates the component, giving the claim back when that fails;
an end that lands in between removes the still-empty component; of two
acceptances into one component neither keeps it (`target_taken`), and
the id is compared canonically;
- an offer is acceptable only while the supplier's release still exists
and has not ended, besides the connection joining the two;
- a release is refused (`peer_not_entitled`) when the other workspace does
not hold Prüfwerk or is halted or archived, so no database is created for
it;
- deleting a target ends its releases at their customers and ends offers
accepted into it, with `ended` as the answer the supplier sees.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #1028 (phase 4), step 5, first half: the customer's side of a release. Based on
main(#1063 is merged).What it adds
POST /api/v1/targets/{id}/releases(changed)ConnectionState::peer_of), writes an offer into the customer's database. If the offer can't be written, the release is taken back.GET /api/v1/sbom-offersPOST /api/v1/sbom-offers/{id}/accepttarget_id), or a new one (name,project_ids; named after the product when no name is given). The connection is checked again first; if it has ended, the offer ends and nothing is created. Refusals:409 answered,409 ended,409 target_taken,422 not_supplier_component.POST /api/v1/sbom-offers/{id}/decline409 answeredif already answeredPOST …/releases/{release}/end(changed)The supplier sees the answer:
answeron each release (acceptedordeclined).Tenant ids: the release keeps the customer's tenant id and the offer keeps the supplier's. They are used internally for writing across; neither is ever shown.
New components count like any other target: a component created on accepting goes through the same insert as
POST /api/v1/targets. That insert is now the sharedonboarding::insert_target, which handles CSAF refresh and thetarget.addedusage event.Audit:
pruefwerk.sbom_offer_acceptedandpruefwerk.sbom_offer_declined.Docs:
guide/sbom, the customer's side.Concurrency and deletes:
409 ended.target_taken), and the next one finds the component free. Ids are compared canonically.422 peer_not_entitled. No database is created for it.ended.Plan: there is no hard target cap. A component created on accepting is a target like one made by
POST /api/v1/targets, billed as included or extra under t72.Delivering published versions to accepted offers is the second half (next PR).
Tests (
tests/connections.rs, fake registry)not_supplier_component);409 answered;accepted;declined.409 ended, and no target is created.ended, and accepting gives409 ended;ended.target_takeneven with the id in another case, and that offer stays open.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
8444ddc52dto79dd08977d