Repository navigation
fix(cmd): fail the run when an account name cannot be resolved for an account filter - #2199
Conversation
… account filter GetAccountAlias replaced a name whose DescribeAccount lookup failed with the account ID and cached it. --include-accounts and --exclude-accounts match on names, so one transient error let an excluded account's recommendations through. ResolveAccountName now returns the error and does not cache it, and populating names fails the run when an account filter is set. Without a filter the ID still stands in for the name. Refs #2198 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 7 billable files and costs up to $1.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 34 minutes for your next included review. View limit details
Comment |
|
Independent review (claude-opus-5-5) of bf3d2c6: CHANGES REQUESTED The fix is correct for the case it targets: a transient lookup failure with an account filter set now fails the run instead of failing open. Two findings block it. Blocking
Non-blocking
Coverage of filter sites
The purchase paths consume these filtered results. No other call to Evidence
The
|
…lookups - Failed DescribeAccount lookups are remembered for the run, so a lasting failure (member accounts) costs one call per account. - --include-accounts / --exclude-accounts match the account ID exactly as well as the name, so ID-based filters work without names. - The run fails only when a name-based filter value meets an account whose name is unknown, on both the live and the --input-csv paths. Refs #2198 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Independent review (claude-opus-5-5) of 635fed1: APPROVE This re-review covers the delta since bf3d2c6: commits 01572df, 83e4c9f and 635fed1. Both earlier blockers are resolved, and nothing new blocks. Checks against the blockersI wrote scratch tests that are not committed and ran them on this head.
Live dry run (head binary, payer credentials, no purchase flags)EC2 RI, 1yr no-upfront, 30d: 24 rows, 17 of them for the largest account.
CSV replay with
Non-blocking
State
|
|
Independent review (claude-opus-5-5) of 635fed1: CHANGES REQUESTED This supersedes my APPROVE above for the same SHA; please do not merge on that line. The functional review there still stands. One test-hygiene point needs a change first.
Splitting a literal to slip past a secret scanner is the pattern the scanner exists to catch, and copying it normalizes it. Fix (no
No new 12-digit literal is introduced, and nothing is reused that is not already allowed. Everything else from my previous comment stands:
A head with only this change gets a quick re-check from me. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Independent review (claude-opus-5-5) of a8898b0: APPROVE This supersedes my CHANGES REQUESTED for 635fed1. The delta from 635fed1 is one commit (a8898b0) touching only
No other line changed, and no split numeric literal remains in the file. Local checks on this head:
CI is fully green on a8898b0, and mergeability is CLEAN. The functional review and live evidence in my 635fed1 comments carry over unchanged:
|
Closes #2198
What
GetAccountAliasreplaced a name with the account ID (and cached it) whenorganizations:DescribeAccountfailed. The account filters match on names, so a transient lookup error made an excluded account pass the filter, and a--purchaserun could buy for it.ResolveAccountNamereturns the lookup error and does not cache it.GetAccountAliaskeeps its display-only behaviour (ID on error) on top of it.populateRecommendationAccountNamesnow takes the config: with--include-accountsor--exclude-accountsset, an unresolved name fails the run (Cannot complete the recommendation fetch: cannot apply --include-accounts/--exclude-accounts: describing account ...). With no account filter the ID stands in for the name as before.populateAccountNames) is unchanged: it runs after filtering and is display-only.Tests
TestFetchAllRecs_AccountFilterWithUnresolvableNameFailsTheRun(exclude and include variants, plus the no-filter case). With the filtering branch disabled it fails with "An error is expected but got nil."; with the fix it passes.TestResolveAccountName_LookupErrorIsReturnedAndNotCached; the oldTestGetAccountAliascase that expected the fallback to be cached now expects it not to be.go vet ./cmdandgo test ./cmdpass (31s;TestQueryMajorEngineVersions_ErrorHandlingskipped locally, it hangs in this session independent of this change).Flaky test
TestReservationExpiryCommand/filtered-subsetfailed once in CI on cli#2197 with an extra row for an account the filter should have dropped, which fits a failed name lookup (the child runs withAWS_MAX_ATTEMPTS=1). I could not confirm the lookup failure in the log. With this change such a failure is a loud error rather than a silent extra row, but I did not find what makes the fixture's lookup fail intermittently.🤖 Generated with Claude Code