Skip to content

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

Open
adwk67 wants to merge 8 commits into
mainfrom
fix/consolidate-result--handling
Open

chore: Consolidate error enums and use expect where possible#1017
adwk67 wants to merge 8 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 (554.83s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/smoke_kafka-3.9.2_zookeeper-3.9.5_use-client-tls-false_openshift-false (80.23s)
        --- PASS: kuttl/harness/smoke-kraft_kafka-kraft-3.9.2_openshift-false (237.14s)
        --- PASS: kuttl/harness/smoke_kafka-3.9.2_zookeeper-3.9.5_use-client-tls-true_openshift-false (63.13s)
        --- PASS: kuttl/harness/smoke-kraft_kafka-kraft-4.2.1_openshift-false (243.37s)
        --- PASS: kuttl/harness/smoke-kraft_kafka-kraft-4.1.1_openshift-false (254.55s)
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 self-assigned this Aug 28, 2026
@adwk67
adwk67 marked this pull request as ready for review August 28, 2026 20:15
/// compute the name from the raw cluster identity when fetching the stored `Listener`s that the
/// discovery `ConfigMap` is built from.
///
/// The returned ListenerName is a lowercase RFC 1035 label name (checked by a unit test).

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.

With

const _: () = assert!(
    QualifiedRoleGroupName::MAX_LENGTH + BOOTSTRAP_SUFFIX.len() <= RFC_1035_LABEL_MAX_LENGTH,
    "The string `<qualified_role_group_name>-bootstrap` must not exceed the limit of an \
    RFC 1035 label name."
);

you could statically ensure the maximum length for an RFC 1035 label name.

Comment on lines 740 to 752
/// Adds the Vector log-aggregation sidecar container, when the Vector agent is enabled.
///
/// Whether Vector is enabled, the per-container log config and the (validated) aggregator
/// discovery `ConfigMap` name are resolved up-front in
/// [`ValidatedLogging`]. The container mounts the
/// static `vector.yaml` from the `config` volume and is driven by the env vars the
/// [`vector_container`] sets.
/// The [`ContainerName`] for a role container, derived from its `Display` name so the
/// Vector sidecar's container name always matches that container's logging-config key.
fn container_name(container: impl std::fmt::Display) -> ContainerName {
ContainerName::from_str(&container.to_string())
.expect("a container enum variant is always a valid ContainerName")
}

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.

I stumbled over this function because you used it above.

If anyone is ever looking for an argument against using expect, they've found the perfect one here. We need to fix this before we declare the smooth-operator ticket complete.

And the comment obviously belongs to the next function.

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