smartcontract/serviceability,sdk,cli: rename activator-only status variants to *Deprecated#3720
Merged
Merged
Conversation
577f0d9 to
6703cb5
Compare
elitegreg
commented
May 19, 2026
…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.
0da4540 to
4143a39
Compare
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
*DeprecatedacrossUserStatus,DeviceStatus,LinkStatus,MulticastGroupStatus,LocationStatus,ExchangeStatusin the serviceability program, and propagate the rename into the Rust SDK, CLI, and every Rust consumer that importsdoublezero-serviceabilitydirectly.UserStatusadditionally renamesPendingBan → PendingBanDeprecatedandUpdating → UpdatingDeprecated— both are only written/read by activator-driven flows (requestban.rs,subscribe.rs→activate.rs/reject.rs).test_state_compatibility_*cases in each state file.Displayappends(deprecated)for renamed variants;FromStraccepts both old and new strings so any tooling that parses status strings keeps working.#[default]moves fromPendingDeprecatedtoActivatedon each enum soDefault::default()returns the value new accounts actually start in (per Phase 4 onchain allocation). Discriminants are unchanged, so legacy byte 0 still decodes toPendingDeprecated.User::validate,MulticastGroup::validate,Link::validate, andprocess_update_multicastgroup_roles(none of the legacyPending/Rejectedarms are reachable for new accounts).Pending → not eligible,Rejected ignores X) dropped.poll_for_activation.rsrequires 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-gatedban.rs.UserStatus::Updating— renamed. Only consumed by activator-drivenactivate.rs,reject.rs,subscribe.rs.MulticastGroupStatus::Suspended/Location::Suspended/Exchange::Suspended— out of scope for this phase. Defer to a follow-up.Controller
LinkStatusPendingsentinelOption (b) from the original PR plan: this PR lands the variant rename. The controller sentinel migration to a controller-local
linkStatusUnknownlives in PR 5.4 (Go SDK + controller), where the Go consumer ofLinkStatusactually 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-serviceabilitydirectly:client/doublezero—connect.rsprovisioning match arms (UserStatus::RejectedDeprecated,UserStatus::PendingBanDeprecated).controlplane/doublezero-admin—migrate-countspredicates 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-fmtclean.make rust-buildclean.cargo test -p doublezero-serviceability— all unit + integration tests pass, including the inlinetest_state_compatibility_*Borsh-compat round-trips forUser,Device,Link,MulticastGroup,Location,Exchange.cargo test -p doublezero_sdk -p doublezero_cli— 171 tests pass.*Status::Pending\b,*Status::Rejected\b,UserStatus::PendingBan\b,UserStatus::Updating\breturns zero matches outside the enum-definition + FromStr arms.Part of #3607.
Closes #3617.
Closes #3618.