Repository navigation
fix(plans): scope Savings Plans out of multi-step ramps - #865
Conversation
Refuse an armed multi-step plan with an enabled Savings Plans service at plan create, update and arm (HTTP 400), via PurchasePlan.Validate and the step Precheck. At attach, route ErrUnsupportedPlan to failStep so an already-armed plan gets one visible failed row instead of erroring every tick. Single-step SP plans are unchanged. Adds an owner runbook query for armed hits. Refs #631 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 8 billable files and costs up to $2.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 2 minutes for your next included review. View limit details
Comment |
Gate verdict: CLEAN at 847f140 (not merged: awaiting the owner's DEV/prod armed-plans query)Independent adversarial review (money path) of the full diff against task C5 / Q7(A) of #631. Attacked and how
Local evidence (git archive of the head, GOTOOLCHAIN=go1.26.9): CI: all checks green at 847f140, mergeStateStatus CLEAN, 0 commits behind main. Nits (non-blocking): the runbook filename doubles a word ( |
|
Independent Sol-medium adversarial review, two passes, exact SHA 847f140: no actionable source findings. Checked the enabled + auto_purchase + total_steps > 1 + enabled common.IsSavingsPlan predicate against the pinned common model (five exact supported service slugs), create/PUT/PATCH validation reachability, Resolve precheck ordering, error identity, permanent step failure before attachment/suppression, supported single-step/unarmed/non-SP controls, security, duplication and scope. Fresh macOS local evidence at the exact revision: Go 1.26.9 go build ./... passed. Config, planstep, purchase and API package tests passed. The initial purchase test attempt was blocked by sandbox localhost socket permissions; the socket-authorized rerun passed. Focused race checks passed for config and planstep. Purchase/API race builds were blocked by no space left on device in the Go temporary build directory, so no race verdict is claimed for those packages. Scratch server stopped after verification; data and logs are preserved. Independent fixture evidence on native PostgreSQL 17, migrated by the exact production migrations to schema 118: actual create rejects armed multi-step SP with domain HTTP 400 and leaves the row count unchanged; supported create controls persist three rows. Actual PUT rejects changing an immediate SP plan to armed multi-step and stored total_steps remains 1. Actual PATCH refuses arming a multi-step SP and stored enabled/auto_purchase remain false; single-step SP and multi-step RDS PATCH controls succeed. Authentication is mocked; handlers and PostgreSQL store are production code. Actual Manager.SetRecommendationSource -> Resolve -> Precheck -> failStep -> PostgreSQL persistence was exercised for all five pinned SP service slugs. Two ticks per plan leave exactly one failed row with NoSubmission=true, the SP rejection reason, empty recommendations, no token/rotation, no recommendation-source call and no ramp advance. Inputs and the strict recommendation-source boundary are synthetic fixtures; no provider or email call occurs. This is native database evidence, not a live provider test or live environment write. Mutation probe: deleting only the ErrUnsupportedPlan -> failStep branch in the scratch copy makes the native test fail because the unsupported error propagates instead of returning the quiet failed-step sentinel. The branch was restored immediately. All 913 tracked files under internal/, cmd/, go.mod and go.sum were byte-compared with the reviewed commit afterwards: zero differences. The archive-only independent harnesses are not production changes. Scope caveats: previously attached nonempty pending/notified roots can bypass Resolve/Precheck through adoption, so this proof covers new attachment and does not establish blanket prevention of purchases from every preexisting execution. The owner inventory/remediation gate before deployment remains necessary. Valid multi-step non-SP behavior is preserved; previously unsupported non-SP configurations now fail permanently under the shared ErrUnsupportedPlan route. Separate owner-authorized live DEV read-only evidence must remain labelled separately from these fixtures. Production inventory/remediation, current CI and final merge/deployment policy are separate gates; this local code review does not authorize a purchase or deployment. Authorized live AWS DEV inspection completed separately: schema118 dirty=false, valid unique11-column recommendation arbiter, and armed multi-step Savings Plans aggregate count0. The read-only transaction ended with ROLLBACK and the owned SSM session was cleaned up. Active-prod discovery: configured AWS account/region runtime inventory has0 matching production Lambda/RDS/ECS resources; known production Terraform state prefixes contain0 objects; GitHub production deployment records and releases are empty. The configured GCP project is freshly confirmed DELETE_REQUESTED. No actual Azure production backend/resource locator was established, so cross-cloud absence is not inferred. |
|
Active-project inventory gate satisfied at exact PR head 847f140. Authorized read-only AWS DEV database inspection found zero armed multi-step Savings Plans; schema118 is clean. The query covered all five service slugs recognized by the pinned common.IsSavingsPlan model. No remediation or purchase was performed. Known active production scope: no matching AWS production Lambda/RDS/ECS resources in the configured project account/region; zero objects under its known production Terraform state prefixes; no GitHub production deployment records or releases. The configured GCP project is DELETE_REQUESTED. Azure's configured cudly-prod namespace has zero resource groups/resources in the existing authenticated profile. GCP and Azure deployment workflows are disabled. No active project production deployment was identified. This statement is scoped to those actual configured routes; it does not claim absence across hypothetical unmapped installations or unrelated subscriptions. If a production deployment is later identified, run the documented read-only inventory before its release and resolve any positive result. Fresh independent Sol-medium two-pass source review and native PostgreSQL/API/manager verification are recorded above. All five SP slugs failed one unattached step on two ticks without recommendations, submission, token, rotation, or ramp advancement. Source byte comparison matched all913 inspected tracked files. Existing attached executions remain outside this proof, which is why the actual deployment inventory mattered. Local purchase/API race compilation was limited by disk exhaustion; normal package tests and config/planstep race tests passed. No cloud purchase, forced deployment, or existing database write is authorized or performed. Normal merge requires the unchanged named head, current CLEAN/MERGEABLE status, successful required checks, and the existing repository lock. CodeRabbit is optional under the standing independent-review policy; no check or approval bypass is permitted. |
Scope
Platform #631 task C5 (Q7 option A): multi-step ramps do not support Savings Plans.
PurchasePlan.CheckNoMultiStepSavingsPlans(config/validation.go) is the one check. "Multi-step" =total_steps > 1; "armed" = enabled and auto_purchase; an enabled SP service (common.IsSavingsPlan).PurchasePlan.Validatecalls it, so create, PUT and PATCH (arm) return 400multi-step ramps do not support Savings Plans: ...from the shared validation, not three copies.planstep.Precheckcalls the same check, andattachStepnow routesErrUnsupportedPlantofailStep: one failed row plus notice instead of an error every tick.total_steps0 or 1, incl. immediate) SP plans, unarmed plans and valid multi-step non-SP plans are unchanged. Previously unsupported configurations using the same ErrUnsupportedPlan route now record a permanent failed step rather than repeatedly stalling. Resolve sizing, C3 wiring and D1 untouched.Evidence
Unit tests (mocks, no live DB): handler tests for 400 on create, PUT (mergeUpdatedPlan) and PATCH-arm; 200 for single-step SP, single-step custom SP, multi-step RDS, unarmed multi-step SP; boundary table at total_steps 0/1/2; attach test shows a visible failed row. 8 mutation probes on the new condition, all killed.
go build,go vetand tests for config, planstep, purchase, api pass. Fresh independent verification also exercised native PostgreSQL-backed plan handlers and two manager ticks for all five supported SP slugs; the details and fixture/mock boundaries are recorded in the exact-head gate comments.Active deployment inventory
Completed before the normal merge: authorized read-only AWS DEV query returned zero affected plans. No active prod deployment was found in the actual configured AWS/GCP/Azure scope, as recorded in the gate comments. This does not claim absence across hypothetical unmapped installations. Run the following read-only query before releasing to any subsequently identified prod deployment (also in
runbooks/armed-multi-step-savings-plans-plans.md); any hit requires remediation before that deployment:Refs #631
🤖 Generated with Claude Code