Skip to content

feat(registry): derive Ord and PartialOrd for SubnetType#9357

Merged
severin-amrein merged 1 commit intomasterfrom
sev/add-missing-traits-to-subnettype
Mar 16, 2026
Merged

feat(registry): derive Ord and PartialOrd for SubnetType#9357
severin-amrein merged 1 commit intomasterfrom
sev/add-missing-traits-to-subnettype

Conversation

@severin-amrein
Copy link
Contributor

Motivation

The DRE multiservice-discovery (MSD) crate needs to add a subnet_type: Option<SubnetType> field to TargetGroup and TargetDto structs, which are stored in BTreeSet and therefore require all fields to implement Ord. Currently SubnetType only derives Eq/PartialEq, so it cannot be used in ordered collections.

This adds Ord and PartialOrd to the derive list, enabling downstream consumers (like MSD) to include SubnetType in structs that participate in BTreeSet/BTreeMap collections. The derived ordering follows variant declaration order (Application < System < VerifiedApplication < CloudEngine), which is a reasonable default.

Test Protocol

  • Ran cargo check -p ic-registry-subnet-type — compiles cleanly
  • Change is a two-line addition to the derive macro; no logic changes, no new dependencies

@github-actions github-actions bot added the feat label Mar 13, 2026
@severin-amrein severin-amrein marked this pull request as ready for review March 13, 2026 16:42
@severin-amrein severin-amrein requested a review from a team as a code owner March 13, 2026 16:42
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@severin-amrein severin-amrein added this pull request to the merge queue Mar 16, 2026
Merged via the queue into master with commit 0e614eb Mar 16, 2026
41 checks passed
@severin-amrein severin-amrein deleted the sev/add-missing-traits-to-subnettype branch March 16, 2026 06:44
severin-amrein added a commit to dfinity/dre that referenced this pull request Mar 16, 2026
…pe targets

Bump IC library dependencies to revision 0e614ebbb23a which includes
Ord/PartialOrd derives on SubnetType (dfinity/ic#9357).

Add subnet_type: Option<SubnetType> to TargetGroup and TargetDto.
Fetch the subnet type from the registry via SubnetRegistry::get_subnet_type()
and propagate it through to both the file_sd (ServiceDiscoveryRecord) and
multiservice-discovery (PrometheusConfigBuilder) label emission paths as
the ic_subnet_type label.

This enables downstream VMAgent relabel configs to filter scrape targets
by subnet type (e.g. keep only cloud_engine subnets for Control Panel
metrics forwarding).

Also fixes a pre-existing broken test in prometheus_updater.rs where
TargetGroup was constructed with Option fields that no longer exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants