Repository navigation
fix(config): match purchase suppressions across the ec2 and compute slugs - #1419
Conversation
AWS EC2 recs reach suppressions as "ec2" (scheduler-collected) or the canonical "compute" (purchase requests), and matching compared the exact service string, so a suppression under one spelling did not hide recs under the other. Normalise AWS ec2 to compute on both the suppression and rec side when building the scheduler match key, so existing rows of either spelling work without a migration, and write the canonical slug from BuildSuppressions. Azure and GCP compute are unchanged. Matching is in Go only; no SQL filters by suppression. Closes #1412 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Canonical service and suppression building internal/config/types.go, internal/config/suppressions_build.go, internal/config/suppressions_build_test.go |
CanonicalSuppressionService maps AWS ec2 to compute. Suppression buckets use the canonical service. Tests cover service mappings and aggregation of AWS ec2 and compute records. |
Scheduler matching and regression tests internal/scheduler/scheduler.go, internal/scheduler/scheduler_suppressions_test.go, internal/scheduler/suppression_variant_integration_test.go |
Suppression grouping and recommendation lookup use canonical services. Tests cover matching AWS records across service spellings and preserving distinct Azure and GCP behavior. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- LeanerCloud/cloud-commitments-platform#1411: Both PRs change the AWS EC2 branch in
suppressionBucketOf; the canonicalized predicate and service value interact with the wildcard-row behavior introduced there.
Suggested reviewers: iamjsd
Merge Risk: 
Minimal · up to 41de6
-
No actionable merge-blocking risk is established for the EC2 suppression matching change.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
The changes satisfy
#1412.CanonicalSuppressionServicemaps AWSec2tocompute. The scheduler normalizes stored suppressions and recommendations before matching.BuildSuppressionswrites the canonical AWS service. Unit and real-Postgres tests cover both spellings and preserve Azure and GCP behavior.
Full details: Out of Scope Changes check
-
Explanation
The changed files support
#1412. They implement service canonicalization, scheduler matching, suppression construction, and regression tests. The evidence shows no unrelated product behavior, SQL change, or index change.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Independent review 2 (claude-fleet, cold): APPROVE 41de606 Findings:
Consumer table (site / canonicalised? / evidence):
Probes (scratch copy of the head export; each file restored with cp and cmp-verified against the export):
Commands (GOTOOLCHAIN=go1.26.10, AWS config and credentials set to /dev/null, no cloud credentials):
Reviewed by an independent agent with no author context (second reviewer). Review only: nothing was pushed, and the GitHub review state is unchanged. |
|
VERDICT: APPROVE 41de606 PR #1419 (Closes #1412), reviewed at head 41de606 against origin/main 5aa3df5. One commit, 6 files, +125/-7. Findings (none blocking):
Attacked:
|
|
Local verification at
|
Closes #1412
Problem
AWS EC2 recs reach purchase suppressions as
ec2(scheduler-collected) or the canonicalcompute(purchase requests). Matching compared the exact service string, so a suppression saved under one spelling did not hide recs stored under the other, and capacity could be re-shown and re-bought.Design
config.CanonicalSuppressionService(provider, service)maps AWSec2tocompute; every other provider/service is unchanged, so Azure and GCPcomputestay as they are. It lives inconfigbecause the pinned cloud-commitments-gocommonpackage has no such mapping andconfigis the lowest package both callers import.aggregateSuppressions) and the rec side (applySuppressionIndex), so existing rows of either spelling work. No data migration.BuildSuppressionsstores the canonical slug, soec2andcomputerecs in one request merge into one row. The fix(purchase): suppress every variant when a legacy EC2 recommendation has no details #1411 wildcard rule for AWS EC2 recs with empty platform and tenancy now checks the canonical bucket service, so it still covers both spellings.Tests
TestApplySuppressions_EC2SlugSpellings(aws both directions, azure/gcp unaffected),TestCanonicalSuppressionService,TestBuildSuppressions_CanonicalisesAWSEC2Slug; fix(purchase): suppress every variant when a legacy EC2 recommendation has no details #1411'sTestBuildSuppressions_ComputeSlugEC2and legacy-wildcard tests still pass.TestSuppressionsMatchAcrossEC2Slugs_RealPostgreswith rows under both spellings through the store andListRecommendations.Mutation evidence
Removing the normalisation on the suppression side, the rec side, or the write side each makes tests fail (unit and integration for the first two,
TestBuildSuppressions_CanonicalisesAWSEC2Slugfor the write side); each was reverted.Verification
go build ./...,go vet -tags integration ./...,go test -race -short -count=1 ./..., config and scheduler integration tests, and pre-commit all pass locally (macOS).🤖 Generated with Claude Code
Summary by CodeRabbit
ec2orcompute, so differing labels no longer prevent a suppression from applying.computerecommendations and unrelated services retain their existing matching behavior.