fix(api/inventory): show account name in Commitments view#953
Conversation
resolveAccountNamesByID built its map keyed only by CloudAccount.ID (UUID), but PurchaseHistoryRecord.AccountID is the provider external ID (VARCHAR 20, e.g. an AWS account number), not the UUID. The lookup always missed, so AccountName was always empty and omitted from the JSON response, causing the frontend to fall through to the ID-only display path. Fix: also key the map by CloudAccount.ExternalID so the purchase-history lookup path resolves the display name correctly. UUID callers (recommendation records carrying cloud_account_id) continue to work via the UUID key. Update TestHandler_listActiveCommitments_FiltersExpired and AccountFilter to use realistic fixtures (ID=UUID, ExternalID=legacy account ID) so this regression cannot hide behind matching test values again.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes account name resolution in the commitments view. The production logic in ChangesAccount name resolution fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
3 similar comments
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
|
@coderabbitai review |
3 similar comments
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai review |
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
|
@coderabbitai review |
4 similar comments
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai review |
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
|
@coderabbitai review |
3 similar comments
|
@coderabbitai review |
|
@coderabbitai review |
|
@coderabbitai review |
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Rate Limit Exceeded
|
Summary
resolveAccountNamesByIDbuilt its lookup map keyed only byCloudAccount.ID(UUID), butPurchaseHistoryRecord.AccountIDstores the cloud-provider external ID (e.g. an AWS 12-digit account number), not the UUID. The map lookup always missed, soAccountNamewas always empty and omitted from the JSON (omitempty), causing the frontend Commitments table to fall through to the ID-only display path.CloudAccount.ExternalIDso the purchase-history lookup path resolves the display name correctly. UUID callers (recommendation records using thecloud_account_idFK) continue to work via the UUID key unchanged.ID=UUID/ExternalID=legacy-account-idvalues so this regression cannot hide behind accidentally matching test values again.Closes #952.
Test plan
go test ./internal/api/... -run TestHandler_listActiveCommitments-- all 5 tests pass, including the updated fixtures that now use UUID IDs and separate ExternalIDsgo test ./internal/api/...-- all 1428 backend tests passnpx jest --testPathPattern=inventory(frontend) -- all 41 tests passnpx tsc --noEmit-- no TypeScript errorsSummary by CodeRabbit
Bug Fixes
#952).Tests