Skip to content

fix(executor): strip k3d's logrus INFO noise from user-facing errors#220

Merged
oleg-flamingocx merged 2 commits into
mainfrom
chore/cli-audit-remediation-4
Jul 14, 2026
Merged

fix(executor): strip k3d's logrus INFO noise from user-facing errors#220
oleg-flamingocx merged 2 commits into
mainfrom
chore/cli-audit-remediation-4

Conversation

@oleg-flamingocx

@oleg-flamingocx oleg-flamingocx commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

k3d logs every step to stderr in logrus format, so a failed k3d command embedded a wall of INFO[0000] progress lines into the error text — raw lines outside the CLI's formatting that drowned the one ERRO/FATA line explaining the failure. CommandError and WSLError now filter informational logrus/logfmt records (INFO/DEBU/TRAC, level=info/debug/trace) before embedding stderr; warnings, errors, fatals, and non-logrus output pass through, with a raw-text fallback when nothing survives. The full stderr stays on the field for verbose paths. Helm/docker output is unaffected (they don't use logrus).

Summary by CodeRabbit

  • Bug Fixes

    • Invalid or malformed Helm values are now detected before cluster creation or chart installation begins.
    • Argo CD stops waiting sooner when persistent manifest errors cannot be resolved automatically, with clearer diagnostic guidance.
    • Error messages are cleaner by removing irrelevant informational log noise while preserving warnings and failures.
  • Reliability

    • Transient Argo CD issues continue to use recovery handling without being misclassified as permanent manifest failures.
  • Tests

    • Added coverage for values validation, manifest failure detection, recovery behavior, and improved error reporting.

k3d logs every step to stderr in logrus format, so a failed k3d command
embedded a wall of INFO[0000] progress lines into the error text — raw lines
outside the CLI's formatting that drowned the one ERRO/FATA line explaining
the failure. CommandError and WSLError now filter informational logrus/logfmt
records (INFO/DEBU/TRAC, level=info/debug/trace) before embedding stderr;
warnings, errors, fatals, and non-logrus output pass through, with a raw-text
fallback when nothing survives. The full stderr stays on the field for
verbose paths. Helm/docker output is unaffected (they don't use logrus).
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@oleg-flamingocx, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f0b0994-3f8a-4123-862f-d6ef1a6cd8b9

📥 Commits

Reviewing files that changed from the base of the PR and between b3cbe21 and 7baa253.

📒 Files selected for processing (3)
  • internal/shared/executor/executor.go
  • internal/shared/executor/lognoise.go
  • internal/shared/executor/lognoise_test.go
📝 Walkthrough

Walkthrough

The PR adds Helm values preflight validation, fail-fast handling for persistent deterministic Argo CD manifest errors, and filtering of informational subprocess log lines from executor error messages.

Changes

Helm values preflight

Layer / File(s) Summary
Values validation contract
internal/chart/providers/argocd/values.go, internal/chart/providers/argocd/values_preflight_test.go
Optional values files are checked for YAML validity and Argo CD override shape; missing files remain valid.
Installation and bootstrap preflight
internal/chart/services/..., internal/chart/providers/helm/manager.go, internal/bootstrap/service.go, internal/chart/providers/helm/uservalues_test.go
Validation errors stop Helm installation and bootstrap before execution or cluster creation, while missing files use baseline values.

Fatal deterministic manifest handling

Layer / File(s) Summary
Manifest classification and persistence
internal/chart/providers/argocd/fatalmanifest.go, internal/chart/providers/argocd/fatalmanifest_test.go
Persistent deterministic manifest conditions are tracked by application, cleared when resolved, and rendered into bounded aggregated errors.
Wait-loop fail-fast integration
internal/chart/providers/argocd/wait.go, internal/chart/providers/argocd/assess.go, internal/chart/providers/argocd/fatalmanifest_test.go
The wait loop checks fatal manifest conditions before recovery handling and excludes deterministic conditions from repo-server recovery counts.

Executor error detail filtering

Layer / File(s) Summary
Log-noise filtering and error formatting
internal/shared/executor/lognoise.go, internal/shared/executor/executor.go, internal/shared/executor/lognoise_test.go
Informational logrus and logfmt lines are removed from formatted command errors while full stderr remains available.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Bootstrap
  participant ValuesPreflight
  participant HelmManager
  participant Cluster
  Bootstrap->>ValuesPreflight: validate Helm values
  ValuesPreflight-->>Bootstrap: validation result
  Bootstrap->>Cluster: create cluster after success
  HelmManager->>ValuesPreflight: validate installation values
  ValuesPreflight-->>HelmManager: validation result
  HelmManager->>HelmManager: execute Helm upgrade when valid
Loading
sequenceDiagram
  participant WaitForApplications
  participant fatalManifestTracker
  participant ArgoCD
  WaitForApplications->>ArgoCD: read application conditions
  WaitForApplications->>fatalManifestTracker: observe deterministic failures
  fatalManifestTracker-->>WaitForApplications: fatal result after thresholds
  WaitForApplications-->>WaitForApplications: return aggregated fatal error
Loading

Possibly related PRs

Suggested reviewers: ivan-flamingo, yaroslavmokflmg

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: filtering k3d INFO noise from user-facing executor errors.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/cli-audit-remediation-4

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/shared/executor/executor.go (1)

38-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Apply stderr truncation to WSLError for consistency.

CommandError truncates its stderr detail using maxStderrInError to prevent massive log walls from overwhelming the terminal. Since WSLError wraps similar executions (like k3d/helm) and can produce similarly huge stderr outputs on failure, consider applying the same truncation here for consistency and better UX.

♻️ Proposed refactor to truncate WSL error detail
 	// Same log-noise strip as CommandError: k3d/helm run via WSL on Windows,
 	// so this error carries the same logrus progress wall on failure.
 	if detail := errorDetail(e.Stderr); detail != "" {
+		if len(detail) > maxStderrInError {
+			detail = "..." + detail[len(detail)-maxStderrInError:]
+		}
 		msg += fmt.Sprintf(": %s", detail)
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/shared/executor/executor.go` around lines 38 - 42, Update the
WSLError stderr-detail handling around errorDetail(e.Stderr) to apply the same
maxStderrInError truncation used by CommandError before appending the detail to
msg. Preserve the existing empty-detail check and message formatting while
ensuring large stderr output cannot overwhelm logs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/shared/executor/executor.go`:
- Around line 38-42: Update the WSLError stderr-detail handling around
errorDetail(e.Stderr) to apply the same maxStderrInError truncation used by
CommandError before appending the detail to msg. Preserve the existing
empty-detail check and message formatting while ensuring large stderr output
cannot overwhelm logs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eb40db35-8871-4540-8c14-78739d5faf78

📥 Commits

Reviewing files that changed from the base of the PR and between 37475d4 and b3cbe21.

📒 Files selected for processing (14)
  • internal/bootstrap/service.go
  • internal/chart/providers/argocd/assess.go
  • internal/chart/providers/argocd/fatalmanifest.go
  • internal/chart/providers/argocd/fatalmanifest_test.go
  • internal/chart/providers/argocd/values.go
  • internal/chart/providers/argocd/values_preflight_test.go
  • internal/chart/providers/argocd/wait.go
  • internal/chart/providers/helm/manager.go
  • internal/chart/providers/helm/uservalues_test.go
  • internal/chart/services/chart_service.go
  • internal/chart/services/preflight.go
  • internal/shared/executor/executor.go
  • internal/shared/executor/lognoise.go
  • internal/shared/executor/lognoise_test.go

WSLError embedded unbounded stderr into its message; the maxStderrInError
tail-truncation now lives in the shared errorDetail helper, deduplicating
CommandError's inline copy.
@oleg-flamingocx oleg-flamingocx enabled auto-merge (squash) July 14, 2026 13:26
@oleg-flamingocx oleg-flamingocx merged commit 878beaf into main Jul 14, 2026
9 checks passed
@oleg-flamingocx oleg-flamingocx deleted the chore/cli-audit-remediation-4 branch July 14, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants