Part (c), item 3 of t72: customers choose which targets are included. Built to the user's decision, option (b).
Rule
When: a customer can swap an extra target with an included one at any time, and the swap takes effect immediately.
Charge: the number of extra targets, and so the 5,99 € line, stays the same.
Lock: the target swapped in stays included until the end of its calendar month (Europe/Berlin), so it can't be swapped out again that month. The target swapped out becomes extra at once.
What changes
Core:
IncludedChoice (included / extra) and check_swap, with SwapRefusal values Unlimited, NotExtra, NotIncluded and Locked.
split_included now ranks swapped-in targets first, other targets by age, and swapped-out targets last. That keeps a swap in place while targets are added or archived.
Target model:included_choice, plus included_until (the start of the next Berlin month) on the target swapped in.
Agent:
metering::swap and end_of_berlin_month.
POST /api/v1/targets/{id}/billing/swap{"with": "<included target id>"}.
It returns 409 with swap_locked / swap_not_extra / swap_not_included / swap_unlimited, 404 for a target that isn't one of the tenant's active targets, and 503 when the plan can't be read.
It re-runs the billing split right away.
It's a write, so the role gate keeps read-only roles out, and API keys can't reach it.
Dashboard: an extra target's page shows its badge. For users who can write, it also shows the swap, with a choice of the included targets; a refusal is explained in plain words.
Tests
Core: a swap moves one target in and one out with the same extra count; the lock and the other refusals.
Agent: the Berlin month end, including December into January and summer time.
Mongo (tests/target_billing.rs):
a swap;
the swapped-in target is locked that month;
another included target can still go out;
the lock ends in December;
an unknown target returns 404.
Dashboard: which targets can be swapped out.
Not built locally, per the CI-only rule. This may need a rebase after #930 (both add a handler next to the scan endpoint).
Part (c), item 3 of t72: customers choose which targets are included. Built to the user's decision, option (b).
## Rule
- **When:** a customer can swap an extra target with an included one at any time, and the swap takes effect immediately.
- **Charge:** the number of extra targets, and so the 5,99 € line, stays the same.
- **Lock:** the target swapped in stays included until the end of its calendar month (Europe/Berlin), so it can't be swapped out again that month. The target swapped out becomes extra at once.
## What changes
- **Core:**
- `IncludedChoice` (included / extra) and `check_swap`, with `SwapRefusal` values `Unlimited`, `NotExtra`, `NotIncluded` and `Locked`.
- `split_included` now ranks swapped-in targets first, other targets by age, and swapped-out targets last. That keeps a swap in place while targets are added or archived.
- **Target model:** `included_choice`, plus `included_until` (the start of the next Berlin month) on the target swapped in.
- **Agent:**
- `metering::swap` and `end_of_berlin_month`.
- `POST /api/v1/targets/{id}/billing/swap` `{"with": "<included target id>"}`.
- It returns 409 with `swap_locked` / `swap_not_extra` / `swap_not_included` / `swap_unlimited`, 404 for a target that isn't one of the tenant's active targets, and 503 when the plan can't be read.
- It re-runs the billing split right away.
- It's a write, so the role gate keeps read-only roles out, and API keys can't reach it.
- **Dashboard:** an extra target's page shows its badge. For users who can write, it also shows the swap, with a choice of the included targets; a refusal is explained in plain words.
## Tests
- **Core:** a swap moves one target in and one out with the same extra count; the lock and the other refusals.
- **Agent:** the Berlin month end, including December into January and summer time.
- **Mongo (`tests/target_billing.rs`):**
- a swap;
- the swapped-in target is locked that month;
- another included target can still go out;
- the lock ends in December;
- an unknown target returns 404.
- **Dashboard:** which targets can be swapped out.
Not built locally, per the CI-only rule. This may need a rebase after #930 (both add a handler next to the scan endpoint).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
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>
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 (c), item 3 of t72: customers choose which targets are included. Built to the user's decision, option (b).
Rule
What changes
IncludedChoice(included / extra) andcheck_swap, withSwapRefusalvaluesUnlimited,NotExtra,NotIncludedandLocked.split_includednow ranks swapped-in targets first, other targets by age, and swapped-out targets last. That keeps a swap in place while targets are added or archived.included_choice, plusincluded_until(the start of the next Berlin month) on the target swapped in.metering::swapandend_of_berlin_month.POST /api/v1/targets/{id}/billing/swap{"with": "<included target id>"}.swap_locked/swap_not_extra/swap_not_included/swap_unlimited, 404 for a target that isn't one of the tenant's active targets, and 503 when the plan can't be read.Tests
tests/target_billing.rs):Not built locally, per the CI-only rule. This may need a rebase after #930 (both add a handler next to the scan endpoint).
🤖 Generated with Claude Code
e66585dcf2to5cebca1ff0Decided 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>5cebca1ff0to42414b2bad