Repository navigation
feat(archera): project stored savings plan recommendations into match identities - #1054
Conversation
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 37 minutes for your next included review. View limit details
Comment |
… identities ProjectRecommendation turns a stored EC2 Instance Savings Plan recommendation into the identity the Archera line items are matched against, and RecommendationIdentity.Equal lets a caller detect that the row changed between two reads. The hourly token is capped at 64 bytes with a [-100,100] exponent bound checked before big.Rat parses it, and a nil, zero or non-number hourly returns ErrRecommendationIdentity (validRecommendation no longer checks it). Refs #799 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
be20c0a to
aeb2e93
Compare
Independent review verdict: CLEAN at be20c0a, carried to aeb2e93 (pure rebase)Reviewer: a fresh Claude agent (Sonnet 5.5, high effort), not the author, given a cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. Rebase: I rebased onto main after #1053 (the go bump) merged. What was verified:
Local verification (fixture-based,
Non-blocking notes:
Gate:
|
Independent review at aeb2e93Verdict: no blocking or major findings. Two minor nits, neither required. I started on be20c0a; the PR head is now aeb2e93 (a rebase onto the go-pin commit). Findings
I tried to refute both as bugs and could not. Neither changes behavior. Checked against sources of truth
Mutation results (15 mutants, scratch copy, each reverted)All 15 killed.
Not mutated (15-mutant cap): the 64-byte token cap and the Local verification (synthetic fixtures only, no real account or vendor data)
This is a review verdict only. It is not an approval and not a merge. |
What and why
#799 R2 step 1.
archera.ProjectRecommendationprojects a stored EC2 Instance Savings Plan recommendation into aRecommendationIdentity, andRecommendationIdentity.Equalcompares two projections so a caller can detect that the row changed between two reads. The #945 squash dropped the nil-hourly check fromvalidRecommendation, so the projection now rejects a nil, zero or non-number hourly itself and returnsErrRecommendationIdentity.json.Unmarshalinto a struct (Details is written by Go marshal, so the duplicate-key token decoder is gone).big.Rat.SetString; quoted numbers, null, booleans and containers fail.no-upfront,partial-upfront,all-upfrontmap toinsurance.Payment*; term 1 and 3 map to 31536000 and 94608000.RecommendationIdentitygainsCloudAccountIDsoEqualsees it.Equalcompares every projected field, usingRat.Cmpfor the hourly amount, and is false for nil operands.Callers: PR1b (selector and constants) and PR2 (DTO) consume it; this PR only adds the exported function.
Evidence (synthetic fixtures, no real account)
validRecommendationaccepts an identity with a nilHourlyCommitment(scratch test failed on main, passes here via the projection).GOWORK=off go test -race ./internal/archera/,go vet ./...,go build ./..., gofmt, gocyclo <= 10 all pass locally. Local golangci-lint is broken by a toolchain mismatch; CI lint is authoritative.go test -overlay, synthetic fixtures): field-mapping swaps and drops, payment and term swaps, exponent bounds, length caps, quote acceptance, zero acceptance, nil-hourly acceptance, Equal field drops. 24 killed. Two initial survivors (a redundant first-byte check on the hourly token, and the Details size cap) led to removing the redundant check and adding a padded-valid-JSON test.Refs #799
Stack: next is PR1b (typed constants,
vendorAlternatives,SelectLineItem), then PR2.🤖 Generated with Claude Code