Skip to content

do power off by default#313

Merged
mangelajo merged 2 commits intojumpstarter-dev:mainfrom
bennyz:default-no-poweroff
Mar 13, 2026
Merged

do power off by default#313
mangelajo merged 2 commits intojumpstarter-dev:mainfrom
bennyz:default-no-poweroff

Conversation

@bennyz
Copy link
Copy Markdown
Member

@bennyz bennyz commented Mar 12, 2026

--no-power-off should be used explicitly to keep device on after flash

Summary by CodeRabbit

  • New Features
    • Flash CLI now accepts a dual toggle: --power-off / --no-power-off (defaults to power off after flashing).
  • Documentation
    • README and driver docs updated with the new toggle, default behavior, examples, and usage clarifications.
  • Misc
    • Completion log message simplified to "Leaving target powered on".

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 12, 2026

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 4f0ef59
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/69b2e91b1a85a20008f743f3
😎 Deploy Preview https://deploy-preview-313--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 Mar 12, 2026

Important

Review skipped

This PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b55e3549-581c-454a-ae5c-2c93eb6c3192

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaces single --no-power-off flag with a dual --power-off / --no-power-off toggle (bound to power_off) in two driver CLI commands, shortens a post-flash log message, and updates related README/docs links and prose. Behavior default remains to power off after flashing.

Changes

Cohort / File(s) Summary
Flasher client
python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py
Replaced --no-power-off flag with --power-off/--no-power-off toggle bound to power_off; updated help text and removed the explicit "(--no-power-off)" suffix from the post-flash log message.
RideSX client
python/packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py
Same CLI change: replaced --no-power-off with --power-off/--no-power-off bound to power_off; updated help text.
Documentation / README
python/docs/source/reference/package-apis/drivers/ridesx.md, python/packages/jumpstarter-driver-flashers/README.md, python/packages/jumpstarter-driver-ridesx/README.md
Added/updated references and README notes to document the --power-off / --no-power-off CLI form, default behavior, and example usage; formatting adjustments in RideSX README.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • add --no-power-off to flashers #296 — Related changes to CLI flag and log message for power-off behavior.
  • jumpstarter-dev/jumpstarter#716 — Touches RideSX post-flash power-off handling when a power child exists.

Suggested reviewers

  • mangelajo
  • raballew

Poem

🐇 I toggled flags with nimble paws tonight,
--power-off or --no-power-off — pick the light.
Devices hum or slip to sleep, all right,
A shorter log lets spring moonlight,
Hop, flash, rest — the circuit's bright.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'do not power off by default' is misleading and contradicts the actual changes. The PR description states '--no-power-off should be used explicitly to keep device on after flash,' which means the device SHOULD power off by default, not avoid powering off. The title is grammatically ambiguous and does not accurately reflect the PR's intent. Revise the title to clearly reflect the change, such as 'Power off device by default after flashing' or 'Make power-off the default behavior for flash operations'.
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py (1)

1521-1528: ⚠️ Potential issue | 🔴 Critical

Bug: --no-power-off flag becomes non-functional with this change.

With flag_value=False and default=False, both providing and omitting the flag results in power_off=False:

  • --no-power-off provided → power_off=False
  • Flag omitted → power_off=False

Users have no CLI mechanism to power off the device after flashing.

To properly implement "do not power off by default", invert the flag semantics:

🐛 Proposed fix using `--power-off` flag
 `@click.option`(
-    "--no-power-off",
+    "--power-off/--no-power-off",
     "power_off",
-    is_flag=True,
-    flag_value=False,
     default=False,
-    help="Leave device powered on after flashing",
+    help="Power off device after flashing (default: leave powered on)",
 )

This creates a flag pair where:

  • No flag → power_off=False (stays on)
  • --power-offpower_off=True (powers off)
  • --no-power-offpower_off=False (stays on, explicit)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py`
around lines 1521 - 1528, The CLI flag for powering off is inverted so providing
or omitting "--no-power-off" both yield power_off=False; fix by changing the
click option for the "power_off" parameter to use a paired boolean flag (e.g.
"--power-off/--no-power-off") with default=False so that no flag keeps the
device powered on and "--power-off" sets power_off=True; update the click.option
decorator that declares "--no-power-off" for the power_off argument accordingly
and adjust any docs/tests that expect the old behavior.
python/packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py (1)

436-443: ⚠️ Potential issue | 🔴 Critical

Same issue: --no-power-off flag becomes non-functional.

Consistent with the flashers client, this flag now always results in power_off=False regardless of whether it's provided.

Apply the same fix for consistency across drivers:

🐛 Proposed fix using `--power-off` flag
 `@click.option`(
-    "--no-power-off",
+    "--power-off/--no-power-off",
     "power_off",
-    is_flag=True,
-    flag_value=False,
     default=False,
-    help="Leave device powered on after flashing",
+    help="Power off device after flashing (default: leave powered on)",
 )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@python/packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py`
around lines 436 - 443, The CLI option currently defines only "--no-power-off"
which makes power_off always False; change the click.option to expose a paired
flag so Click produces a real boolean. Replace the single "--no-power-off"
decorator with a combined option like "--power-off/--no-power-off" (targeting
the same parameter name power_off) or switch to a single "--power-off" flag with
default True and an explicit "--no-power-off" inverse, so that the function
receiving power_off (in client.py where the click.option is declared) gets the
correct True/False value depending on the user's flag.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py`:
- Around line 1521-1528: The CLI flag for powering off is inverted so providing
or omitting "--no-power-off" both yield power_off=False; fix by changing the
click option for the "power_off" parameter to use a paired boolean flag (e.g.
"--power-off/--no-power-off") with default=False so that no flag keeps the
device powered on and "--power-off" sets power_off=True; update the click.option
decorator that declares "--no-power-off" for the power_off argument accordingly
and adjust any docs/tests that expect the old behavior.

In
`@python/packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py`:
- Around line 436-443: The CLI option currently defines only "--no-power-off"
which makes power_off always False; change the click.option to expose a paired
flag so Click produces a real boolean. Replace the single "--no-power-off"
decorator with a combined option like "--power-off/--no-power-off" (targeting
the same parameter name power_off) or switch to a single "--power-off" flag with
default True and an explicit "--no-power-off" inverse, so that the function
receiving power_off (in client.py where the click.option is declared) gets the
correct True/False value depending on the user's flag.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4b3c8b95-b03d-4769-a3e4-76441dbaf834

📥 Commits

Reviewing files that changed from the base of the PR and between 9fa6fe2 and 641523e.

📒 Files selected for processing (2)
  • python/packages/jumpstarter-driver-flashers/jumpstarter_driver_flashers/client.py
  • python/packages/jumpstarter-driver-ridesx/jumpstarter_driver_ridesx/client.py

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@bennyz bennyz force-pushed the default-no-poweroff branch from 641523e to e9b790d Compare March 12, 2026 13:21
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@python/packages/jumpstarter-driver-ridesx/README.md`:
- Around line 106-124: The doctest setup creates ridesx_client and
ridesx_power_client but the subsequent `{testcode}` calls to
ridesx_client.flash() fail because image paths like "/path/to/boot.img" don't
exist; either (A) in the `{testsetup}` create temporary sample image files
(e.g., use tempfile.NamedTemporaryFile or write small dummy files) and pass
those real paths so _upload_file_if_needed() → OpendalFile.write_from_path() →
OpendalAdapter/operator.stat succeeds, or (B) change the offending `{testcode}`
blocks to non-executable code-blocks so they are not run as doctests; locate
usages by searching for ridesx_client.flash(), _upload_file_if_needed(),
OpendalFile.write_from_path(), and OpendalAdapter in the README to apply the
chosen fix.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fe952ca5-691b-41ea-96e8-c45351b5f5bb

📥 Commits

Reviewing files that changed from the base of the PR and between e9b790d and f804178.

📒 Files selected for processing (1)
  • python/packages/jumpstarter-driver-ridesx/README.md

Comment thread python/packages/jumpstarter-driver-ridesx/README.md Outdated
@bennyz bennyz force-pushed the default-no-poweroff branch from f804178 to 5fa206b Compare March 12, 2026 13:51
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
@bennyz bennyz force-pushed the default-no-poweroff branch from 5fa206b to 4f0ef59 Compare March 12, 2026 16:26
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.

🧹 Nitpick comments (1)
python/packages/jumpstarter-driver-ridesx/README.md (1)

136-144: Consider clarifying the power_client variable.

The examples use power_client but don't show where it comes from. For better clarity, consider adding a brief setup comment showing how to obtain the power client instance, similar to how the configuration section shows separate storage and power drivers.

Example:

# Get power client from the power driver instance
# power_client = ... (from your RideSXPowerDriver connection)

# Turn device power on
power_client.on()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@python/packages/jumpstarter-driver-ridesx/README.md` around lines 136 - 144,
The examples reference power_client without showing how to obtain it; add a
brief setup line before the usage examples that shows obtaining the client from
the RideSX power driver (e.g., indicate instantiation or retrieval from
RideSXPowerDriver or the power driver variable used in the config), referencing
symbols like power_client and RideSXPowerDriver so readers know where
power_client comes from and can follow the snippet.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@python/packages/jumpstarter-driver-ridesx/README.md`:
- Around line 136-144: The examples reference power_client without showing how
to obtain it; add a brief setup line before the usage examples that shows
obtaining the client from the RideSX power driver (e.g., indicate instantiation
or retrieval from RideSXPowerDriver or the power driver variable used in the
config), referencing symbols like power_client and RideSXPowerDriver so readers
know where power_client comes from and can follow the snippet.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 259c79a4-e994-419d-a868-10120846158e

📥 Commits

Reviewing files that changed from the base of the PR and between 5fa206b and 4f0ef59.

📒 Files selected for processing (1)
  • python/packages/jumpstarter-driver-ridesx/README.md

@bennyz bennyz requested a review from mangelajo March 12, 2026 17:29
@mangelajo mangelajo merged commit dfa91b7 into jumpstarter-dev:main Mar 13, 2026
31 checks passed
@jumpstarter-backport-bot
Copy link
Copy Markdown

Backport failed for release-0.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-0.8
git worktree add -d .worktree/backport-313-to-release-0.8 origin/release-0.8
cd .worktree/backport-313-to-release-0.8
git switch --create backport-313-to-release-0.8
git cherry-pick -x e9b790dc78d5ccda27b033de9c3b870a9b996f26 4f0ef59ba48ff25be44cc130eb03ca3df7d3ec49

@bennyz bennyz changed the title do not power off by default do power off by default Mar 13, 2026
@jumpstarter-backport-bot
Copy link
Copy Markdown

Backport failed for release-0.8, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-0.8
git worktree add -d .worktree/backport-313-to-release-0.8 origin/release-0.8
cd .worktree/backport-313-to-release-0.8
git switch --create backport-313-to-release-0.8
git cherry-pick -x e9b790dc78d5ccda27b033de9c3b870a9b996f26 4f0ef59ba48ff25be44cc130eb03ca3df7d3ec49

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