Skip to content

refactor(roxerror): Make CausedBy use double %w semantics#19501

Open
vikin91 wants to merge 1 commit intomasterfrom
piotr/roxerror-caused-by-1.20
Open

refactor(roxerror): Make CausedBy use double %w semantics#19501
vikin91 wants to merge 1 commit intomasterfrom
piotr/roxerror-caused-by-1.20

Conversation

@vikin91
Copy link
Contributor

@vikin91 vikin91 commented Mar 19, 2026

Description

Update errox.RoxError.CausedBy to preserve error causes in the unwrap chain when the provided cause is an error.

Before this change, CausedBy used fmt.Errorf("%w: %v", e, cause), so errors.Is(err, cause) was always false for error causes.
After this change, CausedBy uses fmt.Errorf("%w: %w", e, causeErr) when cause is an error, so callers can match both the RoxError class and the underlying cause via errors.Is.

For non-error causes, behavior remains unchanged (fmt.Errorf("%w: %v", e, cause)), keeping message formatting and existing semantics for string/typed values.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  • CI only

@vikin91
Copy link
Contributor Author

vikin91 commented Mar 19, 2026

This change is part of the following stack:

Change managed by git-spice.

@openshift-ci
Copy link

openshift-ci bot commented Mar 19, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Contributor

@parametalol parametalol left a comment

Choose a reason for hiding this comment

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

👍

@rhacs-bot
Copy link
Contributor

Images are ready for the commit at b7eccd8.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-382-gb7eccd8021.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.26%. Comparing base (35e965a) to head (b7eccd8).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #19501      +/-   ##
==========================================
- Coverage   49.27%   49.26%   -0.01%     
==========================================
  Files        2726     2726              
  Lines      205625   205628       +3     
==========================================
- Hits       101318   101312       -6     
- Misses      96773    96779       +6     
- Partials     7534     7537       +3     
Flag Coverage Δ
go-unit-tests 49.26% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vikin91 vikin91 marked this pull request as ready for review March 19, 2026 14:24
@openshift-ci
Copy link

openshift-ci bot commented Mar 19, 2026

@vikin91: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-4-20-qa-e2e-tests b7eccd8 link false /test ocp-4-20-qa-e2e-tests

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants