Skip to content

OCPBUGS-14392: make sync status Failure logs human-readable - #1440

Open
pdudley wants to merge 1 commit into
openshift:mainfrom
pdudley:OCPBUGS-14392
Open

OCPBUGS-14392: make sync status Failure logs human-readable#1440
pdudley wants to merge 1 commit into
openshift:mainfrom
pdudley:OCPBUGS-14392

Conversation

@pdudley

@pdudley pdudley commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • Fix CVO Synchronizing status (and related sync-worker status dumps) so nested Failure values print error text instead of (*payload.UpdateError)(0x…) under %#v.
  • Add SyncWorkerStatus.String() / LoadPayloadStatus.String() and switch those log lines to %s / %v.
  • Also surfaces loadPayloadStep / loadPayloadFailure so payload-load errors on the unexported loadPayloadStatus are readable in the same log line.

Resolves https://issues.redhat.com/browse/OCPBUGS-14392

Example

Before:

Synchronizing status … status=&cvo.SyncWorkerStatus{… Failure:(*payload.UpdateError)(0xc00…), …}

After:

Synchronizing status errs=[] status=generation=4 done=3/33 … failure="Could not update deployment …" loadPayloadStep="PayloadLoaded" loadPayloadFailure="<none>"

Note on verbosity

String() intentionally omits some fields previously visible only in %#v dumps (e.g. VersionHash, capabilities, feature gates, full load-payload message). V(6) sites use the same format after this change.

Summary by CodeRabbit

  • Improvements
    • Improved sync status messages with clearer, more readable validation, failure, and payload details.
    • Standardized status output so empty values display consistently and without technical memory references.
  • Tests
    • Added coverage to verify consistent formatting across populated and empty sync states.

@openshift-ci-robot openshift-ci-robot added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 5, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@pdudley: This pull request references Jira Issue OCPBUGS-14392, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Summary

  • Fix CVO Synchronizing status (and related sync-worker status dumps) so nested Failure values print error text instead of (*payload.UpdateError)(0x…) under %#v.
  • Add SyncWorkerStatus.String() / LoadPayloadStatus.String() and switch those log lines to %s / %v.
  • Also surfaces loadPayloadStep / loadPayloadFailure so payload-load errors on the unexported loadPayloadStatus are readable in the same log line.

Resolves https://issues.redhat.com/browse/OCPBUGS-14392

Example

Before:

Synchronizing status … status=&cvo.SyncWorkerStatus{… Failure:(*payload.UpdateError)(0xc00…), …}

After:

Synchronizing status errs=[] status=generation=4 done=3/33 … failure="Could not update deployment …" loadPayloadStep="PayloadLoaded" loadPayloadFailure="<none>"

Note on verbosity

String() intentionally omits some fields previously visible only in %#v dumps (e.g. VersionHash, capabilities, feature gates, full load-payload message). V(6) sites use the same format after this change.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 23 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c9505ec1-2679-4725-bbfa-350c25473ad8

📥 Commits

Reviewing files that changed from the base of the PR and between 97ee3b7 and 5b7c068.

📒 Files selected for processing (3)
  • pkg/cvo/status.go
  • pkg/cvo/sync_worker.go
  • pkg/cvo/sync_worker_status_string_test.go

Walkthrough

The change adds deterministic String() methods for sync status types, updates synchronization logs to use readable formatting, and adds tests for populated, nil, and zero-value states.

Changes

Sync status formatting

Layer / File(s) Summary
Status string contracts
pkg/cvo/sync_worker.go, pkg/cvo/sync_worker_status_string_test.go
LoadPayloadStatus.String() and SyncWorkerStatus.String() now format status fields, failures, and payload details without pointer addresses. Tests cover exact output and zero-value handling.
Status log integration
pkg/cvo/status.go, pkg/cvo/sync_worker.go
Synchronization and sync worker logs now use readable status strings and default validation error formatting.

Estimated code review effort: 2 (Simple) | ~10 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error SyncWorkerStatus.String() logs raw Failure.Error() and load-payload errors; these include Kubernetes pod messages and registry host data from retrieval failures. Redact or whitelist error content before logging. Use stable reason and resource identifiers instead of raw errors, pod messages, and untrusted image references.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the issue and summarizes the main change to make sync status failure logs human-readable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Stable And Deterministic Test Names ✅ Passed All added test titles are static literals: "nil failures", "apply sync failure", and "payload load failure"; no Ginkgo titles or dynamic values appear.
Test Structure And Quality ✅ Passed The added file uses standard unit tests, not Ginkgo. Tests create no cluster resources, use no waits, keep focused subtests, and provide diagnostic failure messages consistent with nearby tests.
Microshift Test Compatibility ✅ Passed The PR adds only standard Go unit tests in pkg/cvo; no Ginkgo e2e tests or MicroShift-incompatible API references were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The only added tests are standard Go testing unit tests for string formatting; no Ginkgo e2e tests or multi-node assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed The commit only changes CVO status formatting and tests; its three changed files add no manifests or scheduling constraints such as affinity, replicas, selectors, spreads, or PDBs.
Ote Binary Stdout Contract ✅ Passed The PR changes only pkg/cvo formatting and String methods; no stdout writes occur in main, init, RunSpecs setup, or suite setup. fmt.Fprintf targets a buffer.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added tests use standard Go testing.T, not Ginkgo e2e constructs. They perform only in-memory string checks and do not connect to IPv4 addresses or external services.
No-Weak-Crypto ✅ Passed The PR only changes status logging and String methods/tests; added lines contain no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The commit changes only Go status/logging code and tests; it adds no container or Kubernetes manifest and no privilege-related setting. Existing privileged bootstrap settings are unchanged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pdudley
Once this PR has been reviewed and has the lgtm label, please assign hongkailiu for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@pkg/cvo/sync_worker.go`:
- Around line 164-176: Update SyncWorkerStatus.String() to emit only
allow-listed, redacted representations for Actual.Image and failure text instead
of raw values. Ensure the sanitized String() output is used unchanged at the
klog call sites in pkg/cvo/sync_worker.go lines 742, 944-950, and 972-978, and
pkg/cvo/status.go line 165; the formatter site in pkg/cvo/sync_worker.go lines
164-176 requires the direct change.
🪄 Autofix

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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 40775fd3-6c08-4067-8e9f-e604a7bedf34

📥 Commits

Reviewing files that changed from the base of the PR and between 97ee3b7 and c42cc87.

📒 Files selected for processing (3)
  • pkg/cvo/status.go
  • pkg/cvo/sync_worker.go
  • pkg/cvo/sync_worker_status_string_test.go

Comment thread pkg/cvo/sync_worker.go
Comment on lines +164 to +176
func (w SyncWorkerStatus) String() string {
failure := "<none>"
if w.Failure != nil {
failure = w.Failure.Error()
}
loadFailure := "<none>"
if w.loadPayloadStatus.Failure != nil {
loadFailure = w.loadPayloadStatus.Failure.Error()
}
return fmt.Sprintf("generation=%d done=%d/%d completed=%d reconciling=%t initial=%t version=%q image=%q failure=%q loadPayloadStep=%q loadPayloadFailure=%q",
w.Generation, w.Done, w.Total, w.Completed, w.Reconciling, w.Initial,
w.Actual.Version, w.Actual.Image, failure,
w.loadPayloadStatus.Step, loadFailure)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)pkg/cvo/(sync_worker|status)\.go$|sync_worker_status_string_test\.go$' || true

echo "== sync_worker relevant sections =="
wc -l pkg/cvo/sync_worker.go pkg/cvo/status.go pkg/cvo/sync_worker_status_string_test.go 2>/dev/null || true
sed -n '130,190p' pkg/cvo/sync_worker.go
sed -n '720,760p' pkg/cvo/sync_worker.go
sed -n '920,990p' pkg/cvo/sync_worker.go
sed -n '150,175p' pkg/cvo/status.go

echo "== Search for Image/Failure/Error logging around status formatter =="
rg -n "Actual\.Image|\.Failure|loadPayloadStatus\.Failure|fmt\.Sprintf|Infof|Status" pkg/cvo/sync_worker.go pkg/cvo/status.go -C 2

echo "== Imports and possible redaction helpers =="
sed -n '1,80p' pkg/cvo/sync_worker.go
rg -n "func .*Sanit|redact|sanitize|scrub|Replace|Mask|Secret|NoProxy|Proxy|Authorization|Bearer|password|token|key" pkg/cvo . --glob '*.go' -C 1 | head -n 200

Repository: openshift/cluster-version-operator

Length of output: 50390


Information Disclosure (CWE-532): Insertion of Sensitive Information into Log File

Reachability: Internal

Reachability path
● Entry
  pkg/cvo/sync_worker_status_string_test.go:14
  TestSyncWorkerStatus_String: Contrast with %#v, which is the old buggy log format.
│
▼
● Sink
  pkg/cvo/sync_worker.go

Redact sensitive fields in SyncWorkerStatus.String() before klog writes them.

String() returns Actual.Image and unfiltered failure text; the klog sites log this shared string unchanged. Use an allow-listed, redacted image and failure representation in the formatter and pass that sanitized status into the klog call sites in pkg/cvo/sync_worker.go and pkg/cvo/status.go.

📍 Affects 2 files
  • pkg/cvo/sync_worker.go#L164-L176 (this comment)
  • pkg/cvo/sync_worker.go#L742-L742
  • pkg/cvo/sync_worker.go#L944-L950
  • pkg/cvo/sync_worker.go#L972-L978
  • pkg/cvo/status.go#L165-L165
🤖 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 `@pkg/cvo/sync_worker.go` around lines 164 - 176, Update
SyncWorkerStatus.String() to emit only allow-listed, redacted representations
for Actual.Image and failure text instead of raw values. Ensure the sanitized
String() output is used unchanged at the klog call sites in
pkg/cvo/sync_worker.go lines 742, 944-950, and 972-978, and pkg/cvo/status.go
line 165; the formatter site in pkg/cvo/sync_worker.go lines 164-176 requires
the direct change.

Source: Coding guidelines

@pdudley

pdudley commented Aug 5, 2026

Copy link
Copy Markdown
Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 5, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@pdudley: This pull request references Jira Issue OCPBUGS-14392, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (jiajliu@redhat.com), skipping review request.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Replace %#v dumps of SyncWorkerStatus with curated String() output so
Failure and loadPayloadStatus.Failure show error text instead of pointer
addresses (OCPBUGS-14392).

Signed-off-by: Paul Dudley <pdudley@redhat.com>
@emmahone

emmahone commented Aug 6, 2026

Copy link
Copy Markdown

/retest

@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@pdudley: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants