Skip to content

smartcontract/serviceability,sdk,cli: rename activator-only status variants to *Deprecated#3720

Merged
elitegreg merged 6 commits into
mainfrom
gm/phase-5.2-rust-sdk-cli-status-deprecated
May 20, 2026
Merged

smartcontract/serviceability,sdk,cli: rename activator-only status variants to *Deprecated#3720
elitegreg merged 6 commits into
mainfrom
gm/phase-5.2-rust-sdk-cli-status-deprecated

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

@elitegreg elitegreg commented May 18, 2026

Phase 5.1 + 5.2 of the activator-removal effort, bundled into a single PR after the original 5.1 PR (#3719) was reviewed. Closes #3617 and #3618.

Summary

  • Rename activator-only status variants to *Deprecated across UserStatus, DeviceStatus, LinkStatus, MulticastGroupStatus, LocationStatus, ExchangeStatus in the serviceability program, and propagate the rename into the Rust SDK, CLI, and every Rust consumer that imports doublezero-serviceability directly.
  • UserStatus additionally renames PendingBan → PendingBanDeprecated and Updating → UpdatingDeprecated — both are only written/read by activator-driven flows (requestban.rs, subscribe.rsactivate.rs/reject.rs).
  • Numeric Borsh discriminants are preserved, so legacy onchain accounts continue to decode. Verified by the existing inline test_state_compatibility_* cases in each state file.
  • Display appends (deprecated) for renamed variants; FromStr accepts both old and new strings so any tooling that parses status strings keeps working.
  • #[default] moves from PendingDeprecated to Activated on each enum so Default::default() returns the value new accounts actually start in (per Phase 4 onchain allocation). Discriminants are unchanged, so legacy byte 0 still decodes to PendingDeprecated.
  • Dead status checks removed from User::validate, MulticastGroup::validate, Link::validate, and process_update_multicastgroup_roles (none of the legacy Pending/Rejected arms are reachable for new accounts).
  • Per-status redundant tests (Pending → not eligible, Rejected ignores X) dropped.
  • poll_for_activation.rs requires no change — recent commit 0d7e7f7 already dropped the activator-only pollers.

Audit outcomes

  • UserStatus::Deleting — kept. closeaccount.rs (operator-driven) is the producer.
  • UserStatus::PendingBan — renamed. Only read by activator-gated ban.rs.
  • UserStatus::Updating — renamed. Only consumed by activator-driven activate.rs, reject.rs, subscribe.rs.
  • MulticastGroupStatus::Suspended / Location::Suspended / Exchange::Suspended — out of scope for this phase. Defer to a follow-up.

Controller LinkStatusPending sentinel

Option (b) from the original PR plan: this PR lands the variant rename. The controller sentinel migration to a controller-local linkStatusUnknown lives in PR 5.4 (Go SDK + controller), where the Go consumer of LinkStatus actually exists.

Scope expansion vs. the issue text

The original issue scope for 5.2 was "Rust SDK + CLI". The rename forces matching updates in three other Rust consumers that import doublezero-serviceability directly:

  • client/doublezeroconnect.rs provisioning match arms (UserStatus::RejectedDeprecated, UserStatus::PendingBanDeprecated).
  • controlplane/doublezero-adminmigrate-counts predicates that filter "live" users.
  • smartcontract/programs/doublezero-{geolocation,telemetry}/tests/ — test helpers that build serviceability state for cross-program tests.

Bundling these here keeps the workspace buildable behind a single PR.

Testing Verification

  • make rust-fmt clean.
  • make rust-build clean.
  • cargo test -p doublezero-serviceability — all unit + integration tests pass, including the inline test_state_compatibility_* Borsh-compat round-trips for User, Device, Link, MulticastGroup, Location, Exchange.
  • cargo test -p doublezero_sdk -p doublezero_cli — 171 tests pass.
  • Grep across all Rust files for *Status::Pending\b, *Status::Rejected\b, UserStatus::PendingBan\b, UserStatus::Updating\b returns zero matches outside the enum-definition + FromStr arms.

Part of #3607.
Closes #3617.
Closes #3618.

@elitegreg elitegreg changed the base branch from gm/phase-5.1-serviceability-status-deprecated to main May 19, 2026 13:51
@elitegreg elitegreg changed the title smartcontract/sdk,cli,client,controlplane: propagate *Deprecated status renames smartcontract/serviceability,sdk,cli: rename activator-only status variants to *Deprecated May 19, 2026
@elitegreg elitegreg force-pushed the gm/phase-5.2-rust-sdk-cli-status-deprecated branch from 577f0d9 to 6703cb5 Compare May 19, 2026 13:52
Comment thread client/doublezero/src/command/connect.rs Outdated
Comment thread client/doublezero/src/command/connect.rs Outdated
Comment thread controlplane/doublezero-admin/src/cli/device.rs Outdated
Comment thread controlplane/doublezero-admin/src/cli/device.rs Outdated
Comment thread smartcontract/cli/src/device/list.rs Outdated
Comment thread smartcontract/sdk/rs/src/commands/device/delete.rs Outdated
Comment thread smartcontract/sdk/rs/src/commands/user/delete.rs Outdated
Comment thread smartcontract/sdk/rs/src/commands/user/delete.rs Outdated
Comment thread smartcontract/sdk/rs/src/commands/user/delete.rs Outdated
Comment thread smartcontract/sdk/rs/src/commands/user/requestban.rs Outdated
elitegreg added 4 commits May 19, 2026 20:42
…o *Deprecated

Onchain allocation (RFC-11) is the only path that produces new accounts;
the activator-driven Pending/Rejected (and User-specific PendingBan/Updating)
states are unreachable for new data and only persist on legacy accounts.

Rename those variants to *Deprecated across UserStatus, DeviceStatus,
LinkStatus, MulticastGroupStatus, LocationStatus, ExchangeStatus.
Numeric discriminants are preserved, so Borsh decoding of legacy accounts
is unchanged. Display surfaces append ' (deprecated)' for the renamed
variants; FromStr continues to accept the old strings.

Part of #3607. Closes #3617.
- Move #[default] from PendingDeprecated to Activated on UserStatus,
  DeviceStatus, LinkStatus, MulticastGroupStatus, LocationStatus,
  ExchangeStatus. Borsh deserialization of legacy accounts is unchanged;
  Default::default() now returns Activated, matching the new reality
  where onchain allocation produces Activated accounts directly.
- Remove dead status checks in User::validate (dz_ip, tunnel_net) and
  MulticastGroup::validate (multicast_ip) that gated validation on the
  deprecated Pending/Rejected variants.
- Drop the dead 'Pending → not eligible' arm in subscribe, the dead
  Pending/Updating allowance in subscribe role checks, and the legacy
  Pending link-create initial state (links now create as Activated for
  non-DZX, Requested for DZX).
- Switch test fixtures and Default impls (User/Device/Link/MulticastGroup)
  to Activated.
- Remove the now-redundant 'rejected ignores X' tests for Link and
  MulticastGroup, and the redundant 'Pending device not eligible' case
  in test_device_is_device_eligible_for_provisioning.
- Update INSTRUCTION_GUIDELINES.md example to use Activated.
…us renames

Follow-on to the serviceability program rename (PR 5.1). Updates every
Rust consumer of UserStatus / DeviceStatus / LinkStatus /
MulticastGroupStatus / LocationStatus / ExchangeStatus to use the
*Deprecated variant names.

Affected crates:
- smartcontract/sdk/rs (commands: user/{activate,delete,requestban}, device/delete, link/activate)
- smartcontract/cli (test fixtures in user/list, device/list, exchange/get)
- client/doublezero (connect.rs — provisioning match arms)
- controlplane/doublezero-admin (migrate-counts predicates)
- smartcontract/programs/doublezero-geolocation/tests (geo_probe_test)
- smartcontract/programs/doublezero-telemetry/tests (test_helpers)

poll_for_activation.rs requires no change — recent commit 0d7e7f7 already
dropped activator-only pollers, so no *Deprecated transitions are watched
anywhere in CLI poll loops. CLI 'status' columns format via the
serviceability Display impl, which appends '(deprecated)' automatically.

Part of #3607. Closes #3618.
- Drop dead RejectedDeprecated/PendingBanDeprecated arms from
  client/doublezero connect.rs (the Activated path is the only one
  reachable for new accounts). Removes the now-unused user_rejected
  helper.
- Reduce 'is_live' user filter in controlplane/doublezero-admin to
  '!= Banned' since the other deprecated states cannot be set.
- Remove the dead 'wait for activator: Updating -> Activated' retry
  loops in DeleteUserCommand and RequestBanUserCommand — UpdatingDeprecated
  is unreachable, so the loops never have work to do.
- Switch SDK and CLI test fixtures that started accounts in PendingDeprecated
  to Activated where the test semantics still hold; for filter-by-status
  tests, switch to Drained (Device) / OutOfCredits (User) so the filter
  still discriminates two distinct alive statuses.
- geolocation test_create_geo_probe_exchange_not_activated: use
  ExchangeStatus::Suspended as the 'not activated' fixture.
- telemetry test_helpers::create_device: drop the legacy 'demote back to
  Pending' step (CreateDevice atomically activates), and reduce
  set_device_ready_for_users to a single SetDeviceHealth call.
@elitegreg elitegreg force-pushed the gm/phase-5.2-rust-sdk-cli-status-deprecated branch from 0da4540 to 4143a39 Compare May 19, 2026 20:42
elitegreg added 2 commits May 19, 2026 21:12
- client/doublezero/connect.rs: prefix unused user_pubkey bindings with
  _ to silence clippy's unused_variables (their only consumer was the
  removed user_rejected helper).
- telemetry tests: restore the legacy 'device not activated' fixtures
  that broke when create_device stopped demoting devices to
  PendingDeprecated. Add demote_device_to_pending_deprecated() helper
  on ServiceabilityProgramHelper and use it in the two
  initialize_device_latency_samples_tests that exercise the
  DeviceNotActivated rejection path. Foundation members may set any
  status via UpdateDevice, so tests can construct legacy-state fixtures
  explicitly.
test_initialize_device_latency_samples_fail_origin_device_not_activated
and test_initialize_device_latency_samples_fail_target_device_not_activated
exercised the DeviceNotActivated rejection path against a device in
PendingDeprecated state. With onchain allocation always-on, new devices
can never reach a non-activated status, so these failure paths are
unreachable for any account produced by the current program. Remove the
tests and the demote_device_to_pending_deprecated helper that was only
keeping them alive.
@elitegreg elitegreg marked this pull request as ready for review May 19, 2026 23:41
@elitegreg elitegreg enabled auto-merge (squash) May 19, 2026 23:41
@elitegreg elitegreg requested review from juan-malbeclabs and vihu May 19, 2026 23:41
Copy link
Copy Markdown
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

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

LGTM

@elitegreg elitegreg merged commit bf9af1b into main May 20, 2026
38 of 39 checks passed
@elitegreg elitegreg deleted the gm/phase-5.2-rust-sdk-cli-status-deprecated branch May 20, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants