OSAC-6871: discover billing accounts and assign tenants (epic) #2160
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.75) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #2160"
general
weight: 0.35
amito
Prerequisite
Why
Billing accounts discovery and tenant assignment for the billing integration (design OSAC-3784, epic OSAC-6871). The previous branch mixed billing changes with generic changes and sat on an old base. This rebuild keeps billing changes only; generic fixes are in #2686.
What this PR does
BillingAccounts,BillingProviderStatusesandTenantBillingAssignmentsare private services. There is no public billing API.BillingAccounts.Listreads the billing provider on request only. There is no background poller. Each call refreshes observed fields and stores one row per provider account.externalId. It never overwrites or clears a non-empty token and never generates one.TenantBillingAssignmentscreate, update, list and get. Each assignment interval is append-only history. A tenant has at most one active account and an account at most one active tenant (unique indexes on the assignment table).BillingAccountsGet, Create, Update and Delete andTenantBillingAssignmentsDelete are defined so generic CLI commands work. They returnUnimplemented.fulfillment-service/internal/billing/README.md.Decided differences from the design
1. Private API only; the design lists public billing methods.
2. No per-method OPA allow-list for billing (design §4.5). Admins reach billing methods through the admin rule.
3. No database unique index on the attribution token. The provider does not enforce uniqueness, and the account table mirrors the provider. Uniqueness is checked at assignment.
4. No tenant self-read of assignments. The design (§4.7) is admin-only, and the epic acceptance criterion was updated to match.
5. Assignment tenant is
metadata.tenant;spec.tenantis removed.6. The assignment history has no foreign key to the tenant, so history survives tenant deletion.
Out of scope (follow-ups)
Testing
it/suite andtests/e2e.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Affected areas
BillingAccountsandTenantBillingAssignmentsservices and REST routes. Removes the publicBillingProviderStatusesservice, its proto files, and its REST route.cloud-provider-admin. Public billing routes return 404.migrations.sha256.get,edit,delete, and completion.Backward compatibility
FailedPreconditionwithTENANT_IDENTITY_RETAINED.55P03while a tenant writer holds a lock. Operators must drain writers before it runs.Risk classification
Not available. The repository search for
risk:ship,risk:show, andrisk:askreturned no labeling criteria. Its only matches were unrelated text in vendored and documentation files. The second search's output was not returned, so it is not established. No label is applied. The labeling criteria were not supplied, so no nearest classification can be established.<!-- end of auto-generated comment: release notes by coderabbit.ai -->