fix: improve logging on nil-resource case#16
Conversation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR always captures custodian run log tails, records bounded per-execution diagnostics and per-check run summaries during Eval, and returns a bounded, detailed zero-evidence error (including per-execution snapshots) when no evidence is produced, while preserving original per-policy errors. ChangesZero-Evidence Error Reporting with Diagnostic Detail
sequenceDiagram
participant Executor as CommandCustodianExecutor
participant Eval as CloudCustodianPlugin.Eval
participant Composer as composeZeroEvidenceError
Executor->>Eval: return CustodianExecutionResult (LogPaths, LogTail, exitCode, stderr)
Eval->>Eval: accumulate executionDiagnostics and runSummaries
Eval->>Composer: on zero-evidence send accumulatedErrors + executionDiagnostics
Composer->>Eval: composed, bounded diagnostic error string
🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Pull request overview
This PR improves troubleshooting for Cloud Custodian runs that exit successfully (exit code 0) but yield no resources/evidence by always capturing custodian-run.log tails and emitting consolidated, per-check diagnostics when the evaluation produces zero evidence.
Changes:
- Always collect
custodian-run.logartifact paths and tail content intoCustodianExecutionResult(newLogTailfield). - Add consolidated per-check run summaries and preserve execution artifacts when the run produces zero evidence.
- Enrich the “zero evidence” failure error with bounded (capped) per-execution diagnostics (stderr/log tails) and add targeted warnings for zero-resource inventory baselines.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| main.go | Captures log tails unconditionally, adds zero-evidence diagnostic composition, consolidated summary logging, and baseline zero-resource warnings. |
| main_test.go | Updates executor behavior tests for always-captured log tails and adds coverage for enriched zero-evidence diagnostics and size bounding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Summary by CodeRabbit
New Features
Bug Fixes
Tests