Repository navigation
Conversation
The platform pinned pkg to a commit from before go#614, so Allocate's NetExistingUSDPerHour was not available to the ladder handler (LeanerCloud#243). Move pkg and providers/{aws,azure,gcp} to go main, which also brings in go#441, LeanerCloud#471, LeanerCloud#491, LeanerCloud#439, LeanerCloud#627, LeanerCloud#628 and LeanerCloud#629. The bump needs three mechanical follow-ups: - go#575 dropped the ctx argument from computeengine.NewClient; the GCP history-cost test is updated to the new signature. - go#603/LeanerCloud#609 renamed provider.ProviderConfig to provider.Config and left the old name as a deprecated alias. staticcheck SA1019 flags every use, so all references move to provider.Config. mock.AnythingOfType reports the real type name, so the zonal-recs mock now matches "*provider.Config". - The providerfactory bypass guard matched only the ProviderConfig name; it now recognises both names so a Profile literal is still caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
assembleLadderPlan summed each layer's gross ExistingUSDPerHour into the plan, ladder_runs.existing_usd_hr and the approval email, while Allocate sized the gap against existing minus expiring. A layer with $8/hr OD of existing of which $4/hr expires showed Existing $8/hr next to a gap of $6/hr against a $10/hr target, which does not reconcile. Report Allocate's NetExistingUSDPerHour instead (go#614), which is set on every result including the hold-only exits, so the plan shows the figure the engine used rather than a recomputed one. Closes LeanerCloud#243 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Non-blocking:
Attacked:
Body-stale:
Reviewer: rE2. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Non-blocking:
Attacked:
Body-stale:
Reviewer: rE6. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Addendum to my review above. After posting, I skimmed the earlier reviews and found one point I had missed. It comes from an earlier review, and I confirmed it in the code: Blocking:
Non-blocking:
Attacked: read Body-stale: as in my review above. Also, the body doesn't mention the amend-ceiling change. Reviewer: rE6. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
Why
#243's last open item (finding 8, cross-repo):
assembleLadderPlanadded up each layer's grossExistingUSDPerHourand wrote that total into the ladder plan,ladder_runs.existing_usd_hrand the approval email'sExplain()output.Allocate, though, sizes the gap against net existing commitment (existing minus expiring). Take a layer with $8/hr OD existing, of which $4/hr expires, and a $10/hr target. The plan showed Existing $8/hr next to a $6/hr gap, so an approver could not get from target minus existing to the gap.The go side landed in LeanerCloud/cloud-commitments-go#614:
AllocateResult.NetExistingUSDPerHour. The platform'spkgpin (v0.0.0-20261020053130-ff6225d5ff04) was older than that change, so this PR bumps the pin and then reads the net figure.The other #243 findings were fixed earlier: #1265 has the per-finding table and lists finding 8 as the only deferred item. I re-checked them on current
main. So this PR closes the issue.Closes #243
What
Commit 1:
chore(deps). Movespkgandproviders/{aws,azure,gcp}to go main80e9b8464d2a(v0.0.0-20261026081621-80e9b8464d2a) viago get <module>@<sha>andgo mod tidy. It also includes the follow-ups the bump needs:ctxargument fromcomputeengine.NewClient.internal/purchase/gcp_history_cost_test.gonow uses the new signature.provider.ProviderConfigtoprovider.Configand kept the old name as a deprecated alias. staticcheck SA1019 flagged all 40 uses, so they now useprovider.Config. This is a type alias, so behaviour does not change.mock.AnythingOfTypereports the real type name, so thezonal_recs_test.goexpectation now matches"*provider.Config". Without that change,TestCollectAWSForAccount_AssumedRolePassesExternalIDpanics with "Unexpected Method Call". The test's intent is unchanged.providerfactorybypass guard (TestNoRegistryBypassInProductionCode) only recognised aprovider.ProviderConfig{Profile: ...}literal. It now recognises both names. I checked this by adding a temporary production file containing&provider.Config{Profile: "x"}: the guard flagged it, and the file was deleted afterwards.Commit 2:
fix(server).assembleLadderPlannow reportsallocResult.NetExistingUSDPerHour(copied, not aliased) and no longer takes thelayerStatesparameter.Allocatesets this figure on every successful result, hold-only exits included. It covers only the configured layers, butAllocatealready rejects a layer state outside them, so the scope is the same as before.Behaviour changes pulled in by the bump
Everything in go that touches the four modules between the old pins and
80e9b846. The items the issue named come first:AllocateResult.NetExistingUSDPerHour(used here). Net existing is now computed before the baseline-unavailable hold, so an inconsistent snapshot (expiring above existing) is now an error on that path, where it used to be a Hold.UsageBaseline.Basis(BaselineBasis). A residual baseline no longer has existing commitment subtracted a second time. Neither the platform nor the pinned AWS provider setsBasisyet, so runs keep the default total-demand basis and their behaviour is unchanged. An unknown basis value is now an error.DuplicateCheckerchecks againstGetCoveringCommitmentswhen a client implements it. Azure savings plans billed to another subscription but applied to this one now suppress a matching recommendation, so they are not bought twice.pkgrequirement to the #491 selector. Without it, a standalone build never consulted the covering list.GetExistingCommitmentsfail and blocked purchases for the subscription indefinitely.Other changes in the range that alter behaviour:
LimitPrice. A zero approved upfront is not checked.CommitmentCurrency.MaxDelay.common.Matches,pkg/errorsandpkg/config; the platform uses none of them.Verification
All commands were run from the worktree with
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/null AWS_EC2_METADATA_DISABLED=true.Fail before, pass after. The new test is
TestExecuteLadderRun_ReportsNetExistingCoverageininternal/server/ladder_existing_units_test.go. It runs the realexecuteLadderRun→Allocate→ plan pipeline with existing 4 and expiring 2 commitment at rate 0.5 (8 OD gross, 4 OD net). There are two cases: an allocating run and a baseline-unavailable hold.origin/main'shandler_ladder.goand the new pin, both cases FAIL:Max difference between 4 and 8onexisting_usd_hrand on the plan JSON, andgap reconciles with target - existingfails with 2 vs 6.-race).Checks
go build ./...,go vet ./...,go vet -tags integration ./...and(cd tests/e2e && go vet -tags e2e ./...): all clean.golangci-lintv2.10.1 on./..., with and without--build-tags integration: 0 issues. Before theprovider.Configrename it reported 40 SA1019 issues.gocyclo -over 10on the changed non-test files: no output.go test -race -short -count=1 ./...(full unit suite): all 45 packages pass. Before the mock fix,internal/schedulerfailed as described above.go test -race -tags integration -count=1 ./internal/{api,purchase,scheduler,server,config,providerfactory}/:purchase,schedulerandproviderfactorypassed on the first run. The host was heavily loaded by other agents (load average about 48), so the firstapi/server/configruns had testcontainers Postgres fail to start within its 30s startup timeout (wait until ready ... context deadline exceeded), and every failing test failed only there, before any test code ran. On rerun,internal/configpassed as a full package (ok ... 636s). Theservertests that had hit the container timeout (TestHealth_ConfigStoreAfterFailedReinitialization,TestEnsureDB_IsLambdaSingleSourceOfTruth,TestCheckConfigStore_DBFailureHidesRawError) passed when rerun with-run(ok). So did theapiones (TestApproveRIExchange_Integration_SessionMissingIs404,TestIntegration_HistorySummary_TotalsCoverAllInScopeRows,TestIntegration_HistorySummary_MatchesListedRowsUnderTheCap). All otherserverandapiintegration tests, including the ladder lock tests, passed in the full-package runs.clean; planted key flagged.scripts/test-git-secrets-allowlist.sh: 183 PASS, 0 FAIL.Not verified: the go-side behaviour changes listed above were only exercised through the platform's tests, with mocks, fakes and testcontainers Postgres. No real cloud accounts were used.
🤖 Generated with Claude Code