-
Notifications
You must be signed in to change notification settings - Fork 15
DNM engineering: Add --runtime flag
#385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 --runtime flag to the trident update command as a safety mechanism to prevent unexpected system reboots. When the flag is set, Trident will error out if it determines that an A/B update (which requires a reboot) is necessary, allowing users to ensure they're performing only runtime updates.
Key Changes
- Added
--runtimeboolean CLI flag to theupdatecommand - Introduced
AbUpdateRuntimeFlagMismatcherror type for when A/B update is determined with runtime flag set - Threaded the flag through the call chain from CLI → main.rs → lib.rs → engine/update.rs
- Added documentation for the new flag in the CLI reference
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
docs/Reference/Trident-CLI.md |
Added documentation for the --runtime flag in the update command reference |
crates/trident_api/src/error.rs |
Added AbUpdateRuntimeFlagMismatch error variant with descriptive error message |
crates/trident/src/cli.rs |
Added runtime: bool field to the Update command struct |
crates/trident/src/main.rs |
Extracted and passed the runtime flag to the update function |
crates/trident/src/lib.rs |
Updated update function signature and hardcoded false for gRPC call |
crates/trident/src/engine/update.rs |
Implemented logic to check runtime flag and return error when A/B update is determined |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| host_config: &HostConfiguration, | ||
| state: &mut DataStore, | ||
| allowed_operations: &Operations, | ||
| expect_runtime: bool, |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name expect_runtime is inconsistent with the CLI flag name runtime used elsewhere in the codebase. For clarity and consistency, consider renaming this parameter to runtime to match the CLI flag name used in cli.rs, main.rs, and lib.rs.
| expect_runtime: bool, | |
| runtime: bool, |
| if expect_runtime { | ||
| return Err(TridentError::new( | ||
| InvalidInputError::AbUpdateRuntimeFlagMismatch, | ||
| )); | ||
| } |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new AbUpdateRuntimeFlagMismatch error behavior lacks test coverage. Given that this repository has comprehensive test coverage for other error cases and the update function handles critical update logic, this new error path should be tested to ensure it correctly prevents A/B updates when the --runtime flag is set.
| Default: `stage,finalize` | ||
|
|
||
|
|
||
| #### <span>--runtime <RUNTIME></span> |
Copilot
AI
Dec 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation header incorrectly shows --runtime <RUNTIME> for a boolean flag. Since this is a boolean flag (defined with #[clap(long)] without a value parser), it should not show a parameter placeholder in the header. It should be --runtime instead of --runtime <RUNTIME>.
| #### <span>--runtime <RUNTIME></span> | |
| #### <span>--runtime</span> |
--runtime flag--runtime flag
🔍 Description
--runtimeflag ontrident updatecommand indicates that a runtime update is expected. If Trident determines than an A/B update is necessary, Trident will error out.🤔 Rationale
Serves as a safety check so that users can prevent unexpected reboots.