Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

ridesx: power off device if power is referenced#716

Merged
mangelajo merged 2 commits intojumpstarter-dev:mainfrom
bennyz:qc-poweroff
Oct 20, 2025
Merged

ridesx: power off device if power is referenced#716
mangelajo merged 2 commits intojumpstarter-dev:mainfrom
bennyz:qc-poweroff

Conversation

@bennyz
Copy link
Copy Markdown
Member

@bennyz bennyz commented Oct 20, 2025

Summary by CodeRabbit

  • New Features
    • Device power is now managed automatically following successful flash operations, with status logging.

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 20, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit f2c7342
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/68f67fccdfb66d0008438715
😎 Deploy Preview https://deploy-preview-716--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 20, 2025

Walkthrough

Adds post-flash cleanup logic to the RideSX flash flow: after successful flash completion, the device power is turned off if a power child component exists, with corresponding logging; otherwise logs that the device remains running. Minor syntax adjustment adds trailing comma to driver initialization argument.

Changes

Cohort / File(s) Summary
Post-flash cleanup logic
packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py
After successful flash operation, checks for power child component existence; if present, powers off device and emits log; otherwise logs device remains running
Driver initialization syntax
packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/driver.py
Adds trailing comma to remove_created_on_close=True, argument in __post_init__ method; no functional changes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Client as RideSXClient
    participant Power as PowerChild
    participant Log as Logger
    
    User->>Client: flash()
    activate Client
    Client->>Client: perform flash
    Client->>Client: check power child exists
    
    alt Power child exists
        Client->>Power: power_off()
        activate Power
        Power-->>Client: ack
        deactivate Power
        Client->>Log: log power-off event
    else No power child
        Client->>Log: log device remains running
    end
    
    Client-->>User: flash complete
    deactivate Client
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • jumpstarter#582 — Refactors RideSXPowerClient on/off/cycle/rescue methods to use self.call(), affecting the same power-control functionality used in the new post-flash cleanup logic.

Suggested reviewers

  • mangelajo

Poem

🐰 Post-flash, the power bows its head,
Cleanup whispers when flash is spread,
If power child listens to the call,
Off goes the device, logs it all,
A tidy device, a rabbit's delight!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "ridesx: power off device if power is referenced" accurately summarizes the primary change in the changeset. The main modification adds post-flash cleanup logic that powers off the RideSX device if a power component exists, which directly aligns with the title's description. The title is concise, specific, and clearly communicates the purpose without vague terminology. The secondary change (trailing comma syntax adjustment in driver.py) is appropriately minor and does not detract from the title's focus on the main functionality change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py (1)

102-107: Consider adding error handling for power-off operation.

If self.power.off() raises an exception, the entire flash operation will fail even though the flash itself completed successfully. This could confuse users and make debugging harder.

Consider wrapping the power-off call in a try-except block:

     self.logger.info("flash operation completed successfully")

     if "power" in self.children:
-        self.power.off()
-        self.logger.info("device powered off")
+        try:
+            self.power.off()
+            self.logger.info("device powered off")
+        except Exception as e:
+            self.logger.warning(f"failed to power off device: {e}")
     else:
         self.logger.info("device left running")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2863bcd and dc2fecf.

📒 Files selected for processing (2)
  • packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py (1 hunks)
  • packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/driver.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py (1)
packages/jumpstarter-driver-power/jumpstarter_driver_power/client.py (4)
  • off (16-18)
  • off (50-52)
  • off (65-66)
  • off (73-75)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
  • GitHub Check: pytest-matrix (macos-15, 3.12)
  • GitHub Check: pytest-matrix (macos-15, 3.13)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
  • GitHub Check: pytest-matrix (macos-15, 3.11)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
  • GitHub Check: e2e
  • GitHub Check: Redirect rules - jumpstarter-docs
  • GitHub Check: Header rules - jumpstarter-docs
  • GitHub Check: Pages changed - jumpstarter-docs
🔇 Additional comments (1)
packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py (1)

102-107: Verify the timing between fastboot continue and power-off.

The flash process ends with a fastboot continue command (in flash_with_fastboot at line 186 of driver.py) which instructs the device to exit fastboot mode and boot normally. Immediately after, this code powers off the device.

Ensure this immediate power-off doesn't interfere with the device's boot process or leave it in an inconsistent state.

If this behavior is intentional (e.g., to prevent auto-boot into the new image), consider adding a brief comment explaining the rationale. Otherwise, you might want to add a small delay or check device state before powering off.

@bennyz bennyz requested a review from mangelajo October 20, 2025 09:13
@mangelajo mangelajo merged commit 6032831 into jumpstarter-dev:main Oct 20, 2025
18 checks passed
@jumpstarter-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for release-0.7:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants