feat(pruefwerk): entry offer on top of a Monitor subscription #153

Merged
sharang merged 1 commits from feat/entry-offer-with-monitor into main 2026-11-30 08:37:07 +00:00
Owner

Sharang approved this on 30 Nov 2026 as "allow the entry offer alongside Monitor".

Change

  • POST /v1/admin/tenants/{id}/entry-offer on a workspace whose only Prüfwerk subscription is Monitor no longer answers 409 already_booked. Instead it adds entry_targets, entry_until and order_ref to the subscription's grant. Source erp, plan Monitor and no end date stay as they are.
  • pruefwerkLimits(cfg, cap, now): on Monitor, included_targets is 1 plus entry_targets while entry_until is still ahead. Other plans ignore the keys.
  • recomputeEntitlements carries a running add-on over and drops an ended one.
  • The grant is audited as entitlement.entry_granted with with: monitor, plus previous_expires_at when the offer is sent again at delivery.
  • Still refused: any other Prüfwerk subscription (already_booked), and Monitor booked but not yet granted (not_provisioned, reconcile first).

Limits

  • If the customer cancels Monitor while the offer runs, the ERP grant is disabled as usual, and the 90 days of access end with it. Staff can then send the entry offer again, which grants the entry plan.
  • portal #206 has no German text for not_provisioned yet and shows the generic error.

Tests
TestEntryOfferWithMonitor covers:

  • the call before the grant exists (409);
  • the grant on top of Monitor (3 targets, 10 Prüfungen, extra_targets 0);
  • survival across a recompute;
  • 1 target after the end, with the keys dropped by the next recompute;
  • the audit entry;
  • Standard booked next to Monitor (409);
  • Standard ignoring entry_targets.

Merge only with Sharang's OK; prod via promote.

🤖 Generated with Claude Code

Sharang approved this on 30 Nov 2026 as "allow the entry offer alongside Monitor". **Change** - `POST /v1/admin/tenants/{id}/entry-offer` on a workspace whose only Prüfwerk subscription is Monitor no longer answers 409 `already_booked`. Instead it adds `entry_targets`, `entry_until` and `order_ref` to the subscription's grant. Source `erp`, plan Monitor and no end date stay as they are. - `pruefwerkLimits(cfg, cap, now)`: on Monitor, `included_targets` is 1 plus `entry_targets` while `entry_until` is still ahead. Other plans ignore the keys. - `recomputeEntitlements` carries a running add-on over and drops an ended one. - The grant is audited as `entitlement.entry_granted` with `with: monitor`, plus `previous_expires_at` when the offer is sent again at delivery. - Still refused: any other Prüfwerk subscription (`already_booked`), and Monitor booked but not yet granted (`not_provisioned`, reconcile first). **Limits** - If the customer cancels Monitor while the offer runs, the ERP grant is disabled as usual, and the 90 days of access end with it. Staff can then send the entry offer again, which grants the entry plan. - portal #206 has no German text for `not_provisioned` yet and shows the generic error. **Tests** `TestEntryOfferWithMonitor` covers: - the call before the grant exists (409); - the grant on top of Monitor (3 targets, 10 Prüfungen, extra_targets 0); - survival across a recompute; - 1 target after the end, with the keys dropped by the next recompute; - the audit entry; - Standard booked next to Monitor (409); - Standard ignoring `entry_targets`. Merge only with Sharang's OK; prod via promote. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-30 08:22:39 +00:00
feat(pruefwerk): entry offer on top of a Monitor subscription
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 7m40s
ci / image (pull_request) Skipped
852649bdad
A Monitor subscriber who orders a CRA-Check, SBOM-Erstellung or CVE-Scan
keeps Monitor: the entry-offer route adds the order's targets to the
subscription's grant as entry_targets until entry_until, instead of
refusing with already_booked. recomputeEntitlements carries a running
add-on over, and pruefwerkLimits adds it to Monitor's one target while it
runs (other plans ignore it). Any other Prüfwerk subscription is still
refused; a Monitor subscription without its grant yet is not_provisioned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit e549246cc6 into main 2026-11-30 08:37:07 +00:00
sharang deleted branch feat/entry-offer-with-monitor 2026-11-30 08:37:07 +00:00
Sign in to join this conversation.