Skip to content

chore: Consolidate error enums and use expect where possible - #869

Merged
adwk67 merged 9 commits into
mainfrom
fix/consolidate-result--handling
Sep 9, 2026
Merged

chore: Consolidate error enums and use expect where possible#869
adwk67 merged 9 commits into
mainfrom
fix/consolidate-result--handling

Conversation

@adwk67

@adwk67 adwk67 commented Aug 28, 2026

Copy link
Copy Markdown
Member

Description

Part of stackabletech/issues#883

--- PASS: kuttl (601.98s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/smoke_druid-37.0.0_zookeeper-3.9.5_hadoop-3.5.0_openshift-false (601.97s)
PASS

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • (Integration-)Test cases added
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

@adwk67
adwk67 marked this pull request as ready for review August 28, 2026 14:55

@siegfriedweber siegfriedweber left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the airflow-operator the expects sit at the call site (pb.add_volumes(…).expect(…)), so the constraint is visible exactly where it has to be honoured: you can see at a glance that nothing may be expected after the user-supplied volumes and volume mounts have been added.

Here most of the adding is delegated to helpers instead: add_tls_volume_and_volume_mounts, add_config_volume_and_volume_mounts, add_log_config_volume_and_volume_mounts, add_log_volume_and_volume_mounts, add_hdfs_cm_volume_and_volume_mounts and RoleResource::update_volumes_and_volume_mounts. From the call site there is no sign that any of them can panic, nor that they must run before the user-supplied additions. The ordering requirement is real, but invisible to anyone editing build_rolegroup_statefulset.

Two ways to address that:

  1. Document it on the helpers, e.g.
/// # Panics
///
/// Panics if the volumes or volume mounts cannot be added to the builders. Only call this
/// on builders whose volume names and mount paths are still distinct from the ones added
/// here.
  1. Keep the helpers returning Result and move the expects to the call site, as in the airflow-operator.

Comment thread rust/operator-binary/src/controller/build/resource/statefulset.rs Outdated
@adwk67

adwk67 commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

I opted for the # Panics docs in b89a8df as otherwise we would need to add back in a fair amount of what has been removed. I'll apply this to the other open PRs as well.

@adwk67
adwk67 added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit 6083781 Sep 9, 2026
13 checks passed
@adwk67
adwk67 deleted the fix/consolidate-result--handling branch September 9, 2026 09:46
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