Serialize two-device CFU updates - #957
Merged
asasine merged 3 commits intoSep 9, 2026
Merged
Conversation
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>
asasine
requested review from
RobertZ2011,
felipebalbi,
kurtjd,
madeleyneVaca and
williampMSFT
September 9, 2026 17:53
kurtjd
previously approved these changes
Sep 9, 2026
Contributor
There was a problem hiding this comment.
🟡 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_joinwhen mapping exactly two items (removingjoinusage), while retainingjoin3/join4concurrency 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_joinsilently truncates work ifoutputis shorter thaninputbecausezip(input, output)stops at the shorter slice. That can lead to returningtruewhile 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.
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>
kurtjd
approved these changes
Sep 9, 2026
asasine
enabled auto-merge (squash)
September 9, 2026 19:29
RobertZ2011
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
None, and retain concurrentjoin3/join4behaviorTesting
cargo test --locked -p cfu-servicecargo fmt --checkcargo clippy --locked --testscargo hack -p cfu-service --feature-powerset --mutually-exclusive-features=log,defmt,defmt-timestamp-uptime clippy --locked --target x86_64-unknown-linux-gnucargo hack -p cfu-service --feature-powerset --mutually-exclusive-features=log,defmt,defmt-timestamp-uptime clippy --locked --target thumbv8m.main-none-eabihfcargo check --locked -p cfu-service -F log --target x86_64-unknown-linux-gnucargo check --locked -p cfu-service -F defmt --target thumbv8m.main-none-eabihfcargo machete