Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdded twelve new failure reason string constants to standardize error classification codes. Introduced a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scanfailure/types.go`:
- Around line 56-63: ReasonFriendlyText currently returns an empty string when
reasonCode == ""; update the function (ReasonFriendlyText) to handle an empty
input by returning a sensible default human-friendly string (e.g., "Unknown
reason" or "No reason provided") instead of falling back to the empty code; keep
the existing lookup against reasonFriendlyText for non-empty codes and only use
the default when reasonCode is empty or all-whitespace.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fb3fe9ae-3594-4cdc-8d6b-172dba80868d
📒 Files selected for processing (1)
scanfailure/types.go
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…ilure Add structured failure reason codes (enum-like strings) for scan failure notifications. UNS maps codes to human-friendly text via ReasonFriendlyText() at render time, so notification wording can change without redeploying scanners. Changes: - 12 Reason* constants (sbom_generation_failed, image_too_large, etc.) - ReasonFriendlyText() maps codes to user-facing notification text - Error field on ScanFailureReport for raw R&D debugging - Fix alignment of ImageHash/JobID fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Empty string now returns the unexpected error text instead of blank - Add unit tests: known code, unknown code, empty string, all codes mapped Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Empty codes fall back to unexpected error text. Unknown non-empty codes are returned as-is for forward-compat with newer scanner versions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
02d7c7a to
f0b15aa
Compare
Summary
Add structured failure reason codes and
ReasonFriendlyText()mapping for scan failure notifications. UNS renders friendly text at notification time, so wording can change without redeploying in-cluster scanners.Changes (single file:
scanfailure/types.go)12 reason code constants:
sbom_generation_failedimage_too_largesbom_too_largesbom_incompleteimage_auth_failedimage_not_foundcve_matching_failedresult_upload_failedsbom_storage_failedscanner_oom_killedscan_timeoutunexpected_errorReasonFriendlyText(code) string— maps code to friendly text, falls back to returning the code itself.Error stringfield onScanFailureReport— raw error for R&D debugging (not rendered in notifications).Field alignment fix —
ImageHash/JobIDaligned to match gofmt conventions.Consumers
ReasonFriendlyText()in Slack/Teams template renderingRelated
Test plan
go build ./scanfailure/...passesSummary by CodeRabbit