Skip to content

Serialize two-device CFU updates - #957

Merged
asasine merged 3 commits into
OpenDevicePartnership:stable-v0.1.yfrom
asasine:serialize-two-device-cfu
Sep 9, 2026
Merged

Serialize two-device CFU updates#957
asasine merged 3 commits into
OpenDevicePartnership:stable-v0.1.yfrom
asasine:serialize-two-device-cfu

Conversation

@asasine

@asasine asasine commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • await two CFU splitter targets sequentially so shared-bus device update state machines cannot interleave
  • still attempt target 1 when target 0 returns None, and retain concurrent join3/join4 behavior
  • add focused poll-order tests and host-test feature wiring

Testing

  • cargo test --locked -p cfu-service
  • cargo fmt --check
  • cargo clippy --locked --tests
  • cargo hack -p cfu-service --feature-powerset --mutually-exclusive-features=log,defmt,defmt-timestamp-uptime clippy --locked --target x86_64-unknown-linux-gnu
  • cargo hack -p cfu-service --feature-powerset --mutually-exclusive-features=log,defmt,defmt-timestamp-uptime clippy --locked --target thumbv8m.main-none-eabihf
  • cargo check --locked -p cfu-service -F log --target x86_64-unknown-linux-gnu
  • cargo check --locked -p cfu-service -F defmt --target thumbv8m.main-none-eabihf
  • cargo machete

Await the first of two splitter targets before starting the second so shared-bus CFU state machines cannot interleave. Cover ordering and failure behavior while retaining three- and four-target concurrency.

Assisted-by: GitHub Copilot:gpt-5.6-sol

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 9, 2026 17:53
@asasine
asasine requested review from a team as code owners September 9, 2026 17:53
kurtjd
kurtjd previously approved these changes Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new helper still silently truncates work if output is shorter than input, and the added concurrency tests are brittle by asserting a specific join3/join4 poll order rather than the required concurrency property.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adjusts the CFU splitter’s internal fan-out helper to serialize the two-device case (preventing interleaving on shared-bus update state machines) while keeping the 3/4-device cases concurrent, and adds targeted tests plus dev-dependency wiring to support host testing.

Changes:

  • Serialize map_slice_join when mapping exactly two items (removing join usage), while retaining join3/join4 concurrency for 3–4 items.
  • Add unit tests that validate sequential behavior for 2 items and concurrency characteristics for 3–4 items.
  • Add std-enabled dev-dependencies for host test builds.
File summaries
File Description
cfu-service/src/splitter.rs Serializes the 2-item async mapping path; adds poll-order tests for sequential vs concurrent behavior.
cfu-service/Cargo.toml Adds dev-dependencies with std features to enable host testing.
Cargo.lock Records the new critical-section dependency for cfu-service.
Review details

Suppressed comments (1)

cfu-service/src/splitter.rs:208

  • map_slice_join silently truncates work if output is shorter than input because zip(input, output) stops at the shorter slice. That can lead to returning true while leaving some input items unprocessed. Add an explicit length check so the function fails deterministically when the slices don’t match.
async fn map_slice_join<'i, 'o, I, O, F: Future<Output = Option<O>>>(
    input: &'i [I],
    output: &'o mut [O],
    f: impl Fn(&'i I) -> F,
) -> bool {
    let mut iter = zip(input.iter(), output.iter_mut());
    loop {
  • Files reviewed: 2/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cfu-service/src/splitter.rs Outdated
Only assert that all Started occurs before any Completed

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Close the helper after the relaxed ordering assertions and use slice contains checks required by the workspace clippy configuration.

Assisted-by: GitHub Copilot:gpt-5.6-sol

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@asasine
asasine requested a review from kurtjd September 9, 2026 19:27
@asasine
asasine enabled auto-merge (squash) September 9, 2026 19:29
@asasine
asasine merged commit 194de89 into OpenDevicePartnership:stable-v0.1.y Sep 9, 2026
15 checks passed
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.

4 participants