fix: report per-resource listing failures - #315
Conversation
- report KMS and ACM detail failures alongside successful rows - keep Inspector findings when target-health lookups are denied
|
Warning Review limit reachedNext included review available in 10 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (22)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
The partial-failure handling implementation is well-designed and correctly addresses issue #314. The changes properly preserve successful results while reporting per-resource failures as warnings, improving the user experience when working with limited AWS permissions.
Key improvements:
- ACM and KMS service layers now return warnings alongside successful results
- Inspector scanners correctly propagate warnings without failing the entire scan
- UI displays per-resource errors inline, maintaining usability during partial access
- Added
RotationKnownfield to distinguish between denied permissions and actual rotation status - All changes are backed by comprehensive tests
The implementation follows Go best practices for error handling and maintains backward compatibility with existing functionality.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
YoungJinJung
left a comment
There was a problem hiding this comment.
Reviewed head: 99722e0
Findings
-
P2 — Preserve context cancellation as a fatal target-health error (
internal/inspector/inspector_rules_cost.go:249-254)The new partial-failure branch treats every
DescribeTargetHealtherror as a resource warning, includingcontext.Canceledandcontext.DeadlineExceeded. After the user cancels a scan or leaves the screen, this loop therefore keeps visiting every remaining target group and the helper can return a nil fatal error with cancellation buried inwarnings. Checkctx.Err()in this error path and return the context error; only ordinary per-resource API failures should be collected. A cancellation-focused test would lock in the distinction. -
P2 — Bound per-resource warnings to the terminal viewport (
internal/app/screen_kms.go:109-120,internal/app/screen_acm.go:128-139,internal/app/screen_inspector.go:840-844)Each denied key/certificate is rendered as another line above the list, while
visibleLinesbottoms out at five; the Inspector path similarly renders the full multilineerrors.Joinvalue. In an account where a policy denies dozens of detail lookups, the warnings alone exceed the terminal height and push the successful resources and help bar off-screen, defeating the partial-results behavior this PR adds. Render a bounded warning summary/count (or window the warning lines inside the panel) and cover a small-height model with multiple warnings.
- stop target-health scans when their context is canceled - bound resource warning summaries while keeping results visible
|
Applied the review feedback in 6d6ac3c.
Docs remain unchanged because this fixes the PR’s existing partial-results behavior. |
|
/q review |
There was a problem hiding this comment.
Summary
This PR successfully implements partial-failure handling for AWS resource listing operations, preserving successfully retrieved resources when individual detail lookups fail due to permission issues. The implementation is well-designed and correctly handles the behavior described in issue #314.
Key Changes Reviewed
Core Implementation:
- Modified return signatures across KMS and ACM services to return
([]Resource, []error, error)for warnings and fatal errors - Added
RotationKnownfield to track when KMS rotation status checks fail due to permissions - Changed inspector behavior to collect findings before checking for errors, ensuring partial results are preserved
- Updated UI components to display warning summaries for resource lookup failures
Error Handling Pattern:
The PR implements a robust three-tier error handling pattern:
- Fatal errors - returned as the third return value (connection failures, list operation failures)
- Per-resource warnings - accumulated and returned as second return value (permission denied on specific resources)
- Successful results - preserved and returned even when warnings exist
Test Coverage:
Comprehensive test coverage validates:
- Per-resource failure scenarios preserve successful results
- Concurrency limits remain enforced with partial failures
- Warning messages correctly identify failed resources
- The
RotationKnownflag properly tracks when rotation status cannot be determined
Verdict
The implementation is production-ready with no blocking defects. The code correctly handles partial permissions, maintains existing functionality, and includes thorough test coverage. All changes follow Go best practices and maintain backward compatibility with existing error handling patterns.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
YoungJinJung
left a comment
There was a problem hiding this comment.
Reviewed head: 6d6ac3c — No actionable findings. The new commit preserves context cancellation as fatal, bounds warning rendering while keeping successful resources visible, and adds focused regressions. Validation passed: make test, make build, and git diff --check; CI is green.
Summary
Related Issues
Closes #314
Validation
go test ./internal/services/aws ./internal/inspector ./internal/appmake testmake buildgit diff --checkChecklist
docs/branch-naming-harness.mddocs/documentation-harness.md)docs/pages updated if architecture, auth, config, or workflow changed