Skip to content

Conversation

@juan-malbeclabs
Copy link
Contributor

@juan-malbeclabs juan-malbeclabs commented Dec 30, 2025

This pull request primarily updates tests and CLI code to support the new desired_status field for devices and links, ensuring that the activated status is consistently set and displayed throughout the codebase. Additionally, it improves CLI commands to allow specifying the desired status when updating a device and updates output formatting and test assertions accordingly.

Support for desired_status field:

CLI enhancements for device status:

  • Updated UpdateDeviceCliCommand in device/update.rs to accept a desired_status argument, allowing users to specify the desired status when updating a device. The status argument is now typed as DeviceStatus instead of String.
  • Added import for DeviceDesiredStatus to support the new argument.
  • Removed unnecessary parsing logic for the status argument in the update command implementation.

Output formatting and test assertion updates:

  • Modified device information output in device/get.rs to include the desired_status field, both in the format string and in the printed values. [1] [2]
  • Updated related test assertions to expect the new desired_status line in output.

Testing Verification

  • Show evidence of testing the change

Solves: #2476 #2478

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a desired_status field to both Device and Link entities, enabling tracking of the intended operational state separate from the current status. The field supports four states: Pending, Activated, HardDrained, and SoftDrained. Changes span state definitions, update processors, CLI commands, and comprehensive test coverage updates.

Key Changes

  • Added DeviceDesiredStatus and LinkDesiredStatus enums with FromStr/Display implementations and default value of Pending
  • Updated Device and Link structs to include desired_status field with corresponding serialization logic
  • Added check_status_transition() placeholder methods for future validation logic
  • Extended CLI to accept desired_status parameter in update commands and display it in get/list operations

Reviewed changes

Copilot reviewed 56 out of 56 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
smartcontract/programs/doublezero-serviceability/src/state/device.rs Added DeviceDesiredStatus enum and field to Device struct
smartcontract/programs/doublezero-serviceability/src/state/link.rs Added LinkDesiredStatus enum and field to Link struct
smartcontract/programs/doublezero-serviceability/src/processors/device/update.rs Added desired_status parameter to device update processor
smartcontract/programs/doublezero-serviceability/src/processors/link/update.rs Added desired_status parameter to link update processor
smartcontract/cli/src/device/update.rs Changed status from String to DeviceStatus and added desired_status parameter
smartcontract/cli/src/link/update.rs Added desired_status parameter to link update CLI
smartcontract/cli/src/device/get.rs Updated output formatting to display desired_status
smartcontract/cli/src/link/get.rs Updated output formatting to display desired_status
Multiple test files Updated test data to include desired_status field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

wait: false,
status: None,
desired_status: None,
wait: false,
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

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

The wait field is repositioned after desired_status in the struct initialization, which is inconsistent with the field declaration order in the struct definition. While functionally correct, maintaining consistent field ordering improves code readability and reduces confusion.

Copilot uses AI. Check for mistakes.
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.

3 participants