feat(metering): a plan can allow no extra targets (entry plan) #1079

Merged
sharang merged 2 commits from feat/entry-plan-target-limit into main 2026-11-28 22:09:20 +00:00
2 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 53da41ae94 feat(metering): the entry plan bills no target as extra and leaves demo targets out
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 5m15s
CI / Check (pull_request) Successful in 23m9s
Sharang's answers to the entry plan's open questions:

- A plan with `extra_targets: 0` bills every active target as included,
  also those already beyond its included ones when a workspace moves to
  it: no extra-target line, no counted change scans on them. Only new
  targets are refused. A swap on such a plan is refused as unlimited.
- The demo seeder marks its targets (`demo: true`); the cap neither
  counts nor refuses them. Demo targets seeded before this count as
  before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
2026-11-28 19:37:35 +01:00
Sharang ParnerkarandClaude Opus 5.5 7ef6387d39 feat(metering): a plan can allow no extra targets (entry plan)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m29s
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Check (pull_request) Successful in 22m56s
The registry's `limits.extra_targets` caps how many targets beyond the
included ones may be active; the entry plan sends 0. A new target past
included_targets + extra_targets is refused with 409 `target_limit`,
whichever way it is added: the API, accepting a supplier's SBOM release
(the offer stays open), Managed Git (skipped, retried at the next sync)
and the demo seed. A missing or null key keeps today's behaviour: extra
targets are allowed and billed.

All active targets count, as for the included/extra split; archiving
one frees its place. Without an answer from the registry the target is
added, as scans then run unmetered.

Every way of adding a target now goes through targets::create_target,
which reads the plan once for the cap and the billing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
2026-11-28 15:07:53 +01:00