From 0f9a32855265edec723c78e412a3bbdeb1dadec5 Mon Sep 17 00:00:00 2001 From: Rain Date: Thu, 26 Feb 2026 13:28:53 -0800 Subject: [PATCH] [spr] initial version Created using spr 1.3.6-beta.1 --- .github/workflows/ci.yml | 4 +- AGENTS.md | 4 +- Cargo.toml | 2 +- crates/oxide-update-engine-display/README.md | 2 +- .../src/group_display.rs | 24 ++-- crates/oxide-update-engine-types/README.md | 2 +- .../src/buffer/imp.rs | 132 +++++++++--------- .../oxide-update-engine-types/tests/buffer.rs | 22 +-- crates/oxide-update-engine/README.md | 2 +- e2e-example/src/app.rs | 15 +- 10 files changed, 101 insertions(+), 108 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd2ff9f..ed90086 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,8 +42,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - # 1.85 is the MSRV. - rust-version: ["1.85", "stable"] + # 1.88 is the MSRV. + rust-version: ["1.88", "stable"] fail-fast: false env: RUSTFLAGS: -D warnings diff --git a/AGENTS.md b/AGENTS.md index df2518b..179e26f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,7 @@ This file provides guidance to LLMs when working with code in this repository. - **Feature powerset verification**: `just powerset check` or `just powerset nextest run` (uses `cargo hack --feature-powerset`; CI runs this) - **Build docs**: `just rustdoc` -CI runs clippy and tests against the full feature powerset on both MSRV (1.85) and stable. `RUSTFLAGS=-D warnings` is enforced. +CI runs clippy and tests against the full feature powerset on both MSRV (1.88) and stable. `RUSTFLAGS=-D warnings` is enforced. ## Project overview @@ -83,5 +83,5 @@ Converts push-based events into pull-based `EventReport`s. Uses a `petgraph::DiG ## Style notes - `rustfmt.toml` uses `max_width = 80` and `use_small_heuristics = "max"`. -- Rust edition 2024, MSRV 1.85. +- Rust edition 2024, MSRV 1.88. - Optional feature: `schemars08` for JSON Schema generation. diff --git a/Cargo.toml b/Cargo.toml index 641dacb..6bcdc1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ [workspace.package] edition = "2024" license = "MPL-2.0" -rust-version = "1.85" +rust-version = "1.88" repository = "https://github.com/oxidecomputer/oxide-update-engine" [workspace.lints.rust] diff --git a/crates/oxide-update-engine-display/README.md b/crates/oxide-update-engine-display/README.md index 9f8a4a2..cefa09e 100644 --- a/crates/oxide-update-engine-display/README.md +++ b/crates/oxide-update-engine-display/README.md @@ -5,7 +5,7 @@ ![License: MPL-2.0](https://img.shields.io/crates/l/oxide-update-engine-display.svg?) [![crates.io](https://img.shields.io/crates/v/oxide-update-engine-display.svg?logo=rust)](https://crates.io/crates/oxide-update-engine-display) [![docs.rs](https://img.shields.io/docsrs/oxide-update-engine-display.svg?logo=docs.rs)](https://docs.rs/oxide-update-engine-display) -[![Rust: ^1.85.0](https://img.shields.io/badge/rust-^1.85.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) +[![Rust: ^1.88.0](https://img.shields.io/badge/rust-^1.88.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) Displayers for the update engine. diff --git a/crates/oxide-update-engine-display/src/group_display.rs b/crates/oxide-update-engine-display/src/group_display.rs index 6e0da04..34034fa 100644 --- a/crates/oxide-update-engine-display/src/group_display.rs +++ b/crates/oxide-update-engine-display/src/group_display.rs @@ -159,11 +159,11 @@ impl GroupDisplay { if let Some(state) = self.single_states.get_mut(key) { let result = state.add_event_report(event_report); // Set self.start_sw to the max of root_total_elapsed and the current value. - if let Some(root_total_elapsed) = result.root_total_elapsed { - if self.start_sw.elapsed() < root_total_elapsed { - self.start_sw = - TokioSw::with_elapsed_started(root_total_elapsed); - } + if let Some(root_total_elapsed) = result.root_total_elapsed + && self.start_sw.elapsed() < root_total_elapsed + { + self.start_sw = + TokioSw::with_elapsed_started(root_total_elapsed); } self.stats.apply_result(result); @@ -500,13 +500,13 @@ impl SingleState { event_buffer: &mut EventBuffer, event_report: EventReport, ) -> ApplyReportResult { - if let Some(root_execution_id) = event_buffer.root_execution_id() { - if event_report.root_execution_id != Some(root_execution_id) { - // The report is for a different execution ID -- assume that - // this event is completed and mark our current execution as - // completed. - return ApplyReportResult::Overwritten; - } + if let Some(root_execution_id) = event_buffer.root_execution_id() + && event_report.root_execution_id != Some(root_execution_id) + { + // The report is for a different execution ID -- assume + // that this event is completed and mark our current + // execution as completed. + return ApplyReportResult::Overwritten; } event_buffer.add_event_report(event_report); diff --git a/crates/oxide-update-engine-types/README.md b/crates/oxide-update-engine-types/README.md index 8c1d039..f694e06 100644 --- a/crates/oxide-update-engine-types/README.md +++ b/crates/oxide-update-engine-types/README.md @@ -5,7 +5,7 @@ ![License: MPL-2.0](https://img.shields.io/crates/l/oxide-update-engine-types.svg?) [![crates.io](https://img.shields.io/crates/v/oxide-update-engine-types.svg?logo=rust)](https://crates.io/crates/oxide-update-engine-types) [![docs.rs](https://img.shields.io/docsrs/oxide-update-engine-types.svg?logo=docs.rs)](https://docs.rs/oxide-update-engine-types) -[![Rust: ^1.85.0](https://img.shields.io/badge/rust-^1.85.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) +[![Rust: ^1.88.0](https://img.shields.io/badge/rust-^1.88.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) Types for `oxide-update-engine`. diff --git a/crates/oxide-update-engine-types/src/buffer/imp.rs b/crates/oxide-update-engine-types/src/buffer/imp.rs index d036bf7..e7c56c8 100644 --- a/crates/oxide-update-engine-types/src/buffer/imp.rs +++ b/crates/oxide-update-engine-types/src/buffer/imp.rs @@ -406,28 +406,26 @@ impl EventStore { } } - if let Some(key) = actions.progress_key { - if let Some(value) = self.map.get_mut(&key) { - // Set progress *before* adding the step event so that it can - // transition to the running state if it isn't there already. - if let Some(current_progress) = event.progress_event() { - value.set_progress(current_progress); - } + if let Some(key) = actions.progress_key + && let Some(value) = self.map.get_mut(&key) + { + // Set progress *before* adding the step event so that it + // can transition to the running state if it isn't there + // already. + if let Some(current_progress) = event.progress_event() { + value.set_progress(current_progress); } } - if let Some(key) = actions.step_key { - if let Some(value) = self.map.get_mut(&key) { - match event.kind.priority() { - StepEventPriority::High => { - value.add_high_priority_step_event(event); - } - StepEventPriority::Low => { - value.add_low_priority_step_event( - event, - max_low_priority, - ); - } + if let Some(key) = actions.step_key + && let Some(value) = self.map.get_mut(&key) + { + match event.kind.priority() { + StepEventPriority::High => { + value.add_high_priority_step_event(event); + } + StepEventPriority::Low => { + value.add_low_priority_step_event(event, max_low_priority); } } } @@ -439,10 +437,10 @@ impl EventStore { return; } - if let Some(key) = Self::step_key_for_progress_event(&event) { - if let Some(value) = self.map.get_mut(&key) { - value.set_progress(event); - } + if let Some(key) = Self::step_key_for_progress_event(&event) + && let Some(value) = self.map.get_mut(&key) + { + value.set_progress(event); } } @@ -705,18 +703,17 @@ impl EventStore { let mut dfs = DfsPostOrder::new(&self.event_tree, EventTreeNode::Step(root_key)); while let Some(key) = dfs.next(&self.event_tree) { - if let EventTreeNode::Step(key) = key { - if key != root_key { - if let Some(value) = self.map.get_mut(&key) { - value.mark_completed( - CompletionReason::ParentCompleted { - parent_step: root_key, - parent_info: info.clone(), - }, - root_event_index, - ); - } - } + if let EventTreeNode::Step(key) = key + && key != root_key + && let Some(value) = self.map.get_mut(&key) + { + value.mark_completed( + CompletionReason::ParentCompleted { + parent_step: root_key, + parent_info: info.clone(), + }, + root_event_index, + ); } } } @@ -741,31 +738,30 @@ impl EventStore { EventTreeNode::Root(root_key.execution_id), ); while let Some(key) = dfs.next(&self.event_tree) { - if let EventTreeNode::Step(key) = key { - if key != root_key { - if let Some(value) = self.map.get_mut(&key) { - // There's two kinds of nodes reachable from - // EventTreeNode::Root that could be marked as - // completed: subsequent steps within the same - // execution, and steps in child executions. - if key.execution_id == root_key.execution_id { - value.mark_completed( - CompletionReason::SubsequentStarted { - later_step: root_key, - root_total_elapsed: info.root_total_elapsed, - }, - root_event_index, - ); - } else { - value.mark_completed( - CompletionReason::ParentCompleted { - parent_step: root_key, - parent_info: info.clone(), - }, - root_event_index, - ); - } - } + if let EventTreeNode::Step(key) = key + && key != root_key + && let Some(value) = self.map.get_mut(&key) + { + // There's two kinds of nodes reachable from + // EventTreeNode::Root that could be marked as + // completed: subsequent steps within the same + // execution, and steps in child executions. + if key.execution_id == root_key.execution_id { + value.mark_completed( + CompletionReason::SubsequentStarted { + later_step: root_key, + root_total_elapsed: info.root_total_elapsed, + }, + root_event_index, + ); + } else { + value.mark_completed( + CompletionReason::ParentCompleted { + parent_step: root_key, + parent_info: info.clone(), + }, + root_event_index, + ); } } } @@ -886,10 +882,10 @@ impl EventStore { let mut dfs = DfsPostOrder::new(&self.event_tree, EventTreeNode::Step(root_key)); while let Some(key) = dfs.next(&self.event_tree) { - if let EventTreeNode::Step(key) = key { - if let Some(value) = self.map.get_mut(&key) { - (cb)(value, MarkStepFailedImplKind::Descendant); - } + if let EventTreeNode::Step(key) = key + && let Some(value) = self.map.get_mut(&key) + { + (cb)(value, MarkStepFailedImplKind::Descendant); } } @@ -901,10 +897,10 @@ impl EventStore { EventTreeNode::Root(root_key.execution_id), ); while let Some(key) = dfs.next(&self.event_tree) { - if let EventTreeNode::Step(key) = key { - if let Some(value) = self.map.get_mut(&key) { - (cb)(value, MarkStepFailedImplKind::Subsequent); - } + if let EventTreeNode::Step(key) = key + && let Some(value) = self.map.get_mut(&key) + { + (cb)(value, MarkStepFailedImplKind::Subsequent); } } } diff --git a/crates/oxide-update-engine-types/tests/buffer.rs b/crates/oxide-update-engine-types/tests/buffer.rs index 74d5cec..8b29c38 100644 --- a/crates/oxide-update-engine-types/tests/buffer.rs +++ b/crates/oxide-update-engine-types/tests/buffer.rs @@ -382,17 +382,17 @@ impl BufferTestContext { }) .unwrap(); - if let Event::Step(event) = event { - if event_added { - check_last_root_event_index(event, &buffer).with_context( - || { - format!( - "{description}, at index {i}: \ - error with last root event index" - ) - }, - )?; - } + if let Event::Step(event) = event + && event_added + { + check_last_root_event_index(event, &buffer).with_context( + || { + format!( + "{description}, at index {i}: \ + error with last root event index" + ) + }, + )?; } receive_buffer.add_event_report(report.clone()); diff --git a/crates/oxide-update-engine/README.md b/crates/oxide-update-engine/README.md index 773c3d1..2f2f55c 100644 --- a/crates/oxide-update-engine/README.md +++ b/crates/oxide-update-engine/README.md @@ -5,7 +5,7 @@ ![License: MPL-2.0](https://img.shields.io/crates/l/oxide-update-engine.svg?) [![crates.io](https://img.shields.io/crates/v/oxide-update-engine.svg?logo=rust)](https://crates.io/crates/oxide-update-engine) [![docs.rs](https://img.shields.io/docsrs/oxide-update-engine.svg?logo=docs.rs)](https://docs.rs/oxide-update-engine) -[![Rust: ^1.85.0](https://img.shields.io/badge/rust-^1.85.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) +[![Rust: ^1.88.0](https://img.shields.io/badge/rust-^1.88.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field) An engine for declaring and executing sequential update steps with diff --git a/e2e-example/src/app.rs b/e2e-example/src/app.rs index 15ea128..585b326 100644 --- a/e2e-example/src/app.rs +++ b/e2e-example/src/app.rs @@ -395,15 +395,12 @@ fn register_nested_write_steps<'a>( { // Only send progress up to 50% to demonstrate // not receiving full progress. - if let Event::Progress(event) = &event { - if let Some(counter) = event.kind.progress_counter() - { - if let Some(total) = counter.total { - if counter.current > total / 2 { - break; - } - } - } + if let Event::Progress(event) = &event + && let Some(counter) = event.kind.progress_counter() + && let Some(total) = counter.total + && counter.current > total / 2 + { + break; } buffer.add_event(event);