feat(metering): swap an extra target with an included one (t72) #932

Merged
sharang merged 1 commits from feat/t72-swap into main 2026-11-07 03:11:31 +00:00
1 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 42414b2bad feat(metering): swap an extra target with an included one (t72)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 3m49s
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 / Check (pull_request) Successful in 19m37s
Decided by the user (option b): a customer can swap an extra target
with an included one at any time, effective at once; the extra-target
count, and so the 5,99 € line, stays the same. The target swapped in
stays included until the end of its calendar month (Europe/Berlin), so
it cannot be swapped out again that month; the one swapped out becomes
extra at once.

- A target stores the customer's choice (`included_choice`) and, when
  swapped in, `included_until` (the next Berlin month's start). The
  split ranks swapped-in targets before the oldest and swapped-out ones
  after the newest, so the swap holds while targets come and go.
- POST /api/v1/targets/{id}/billing/swap {"with": id}: 409 with the
  reason (locked, not extra, not included, plan includes all), 404 for
  a target that is not an active one of the tenant. A write: the role
  gate keeps read-only roles and API keys out.
- An extra target's page shows its badge and, for those who may write,
  the swap with a choice of the included targets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 03:51:14 +01:00