Repository navigation
feat(common): add EC2 platform, tenancy and scope dimensions to Commitment - #458
Conversation
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 55 minutes for your next included review. View limit details
Comment |
|
@coderabbitai review |
|
Independent review verdict: CLEAN at 64c9741Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. No behaviour change:
Normalizers (
Notes for slice 1b (non-blocking):
What was attacked and how (pkg,
Gate:
|
|
CI is green on head |
…tment Behaviour-neutral first part of the #323 slice-1 dedupe fix. Adds flat omitempty Platform, Tenancy, Scope and AvailabilityZone fields on Commitment, plus NormalizeTenancyName and NormalizeScopeName next to NormalizePlatformName. Nothing in pkg/recfilter reads the new fields yet, so no dedupe result changes. Refs #323 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64c9741 to
30e042d
Compare
Summary
This is PR 1a of the first #323 slice. It is behaviour-neutral by design.
The slice fixes the recfilter duplicate check for AWS EC2. A recent Windows, dedicated or zonal reservation currently counts as covering a Linux, default-tenancy or regional recommendation.
This PR only adds the data and the normalizers:
common.Commitmentfields:Platform,Tenancy,ScopeandAvailabilityZone. They are flat andomitempty, following theEngine/Deploymentprecedent. An empty value means unknown, and the dedupe treats it as a wildcard that still covers.Accountalready exists and is unchanged.common.NormalizeTenancyName:common.NormalizeScopeName:ScopeRegional.ScopeZonal.parseEC2TenancyandparseEC2Scopeaccept inproviders/aws/services/ec2/client.go, which pkg cannot import, and cross-reference them.Nothing reads the new fields yet. PR 1b adds the dedupe matching. Its core is
scopeCovers, defined by an explicit truth table: a regional RI covers zonal usage, and a zonal RI never covers regional usage. PR 2 has the EC2 listing fill these fields.Account keying is deliberately out of scope. With RI sharing, which is the Organizations default, keying on account would let a duplicate through. See the design note on #323.
Refs #323
Verification (macOS, Go 1.26.9)
(cd pkg && GOWORK=off go test -race -short ./...)passes.make buildandmake vetpass.GOWORK=off go build ./...passes in all five modules.gofmtis clean.{"Bogus",""}.TestCommitment_EC2DimensionsJSONchecks the fields are absent when empty, survive a round trip, and that an old payload without them still unmarshals.Unit tests only. No cloud call.
🤖 Generated with Claude Code