Skip to content

Rename fw-update-interface-mocks to fw-update-interface-test-mocks#905

Open
RobertZ2011 wants to merge 1 commit into
OpenDevicePartnership:mainfrom
RobertZ2011:name-fw-update-interface-mocks
Open

Rename fw-update-interface-mocks to fw-update-interface-test-mocks#905
RobertZ2011 wants to merge 1 commit into
OpenDevicePartnership:mainfrom
RobertZ2011:name-fw-update-interface-mocks

Conversation

@RobertZ2011

Copy link
Copy Markdown
Contributor

Rename to better match crate purpose and other test mock crates.

@RobertZ2011 RobertZ2011 self-assigned this Jun 25, 2026
@RobertZ2011 RobertZ2011 requested a review from Copilot June 25, 2026 18:41
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Cargo Vet Audit Passed

cargo vet has passed in this PR. No new unvetted dependencies were found.

@github-actions github-actions Bot added the cargo vet PRs pending auditor review label Jun 25, 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.

Pull request overview

This PR introduces a new firmware-update interface test-mocks crate and updates a CFU service test to import it, along with adjusting CI configuration to exclude the std-only mock crate from embedded-target checks. The intent matches the existing pattern used by other *-interface-test-mocks crates (e.g., Type-C). However, the rename is currently incomplete/inconsistent: the new crate’s Cargo.toml still declares the old package name, while downstream code and CI use the new name.

Changes:

  • Add fw-update-interface-test-mocks crate with a basic FwUpdate mock and unit tests.
  • Update CFU service basic tests to import the new mock crate.
  • Update CI STD_EXCLUDED_CRATES to exclude the renamed std-only test-mocks crate.

Step-by-step review guide

  1. New FwUpdate mock crate

    • Adds a Mock implementing fw_update_interface::basic::FwUpdate that records calls and can inject a one-shot error via set_next_error.
    • This is consistent with other test-mocks patterns in the repo (std-backed VecDeque call recording).
  2. Downstream usage in CFU service tests

    • The CFU service test switches its import path to fw_update_interface_test_mocks::basic::{..., ...}.
    • This requires the workspace dependency graph to be updated to reference the renamed package consistently (package name, workspace member path, and any dev-deps).
  3. CI exclusion for embedded-target clippy/hack

    • The workflow updates STD_EXCLUDED_CRATES to exclude fw-update-interface-test-mocks.
    • Because --exclude is keyed on the Cargo package name, this only works once the crate’s [package].name matches that value.

Potential issues

# Severity File Description Code
1 High fw-update-interface-test-mocks/Cargo.toml:2 Package name is still fw-update-interface-mocks, but the directory/imports/CI use fw-update-interface-test-mocks / fw_update_interface_test_mocks, so the rename won’t actually take effect and references won’t line up. name = "fw-update-interface-mocks"
2 High cfu-service/src/basic/test.rs:24 Import was updated to fw_update_interface_test_mocks, but the workspace/dev-dependency graph still refers to fw-update-interface-mocks (workspace root + cfu-service dev-deps), so the dependency rename is inconsistent. use fw_update_interface_test_mocks::basic::{FnCall as FwFnCall, Mock};
3 Medium .github/workflows/check.yml:36 --exclude uses Cargo package names; excluding fw-update-interface-test-mocks won’t work until the mock crate’s Cargo package name is updated to match, which may cause embedded-target hack/clippy runs to attempt building a std-only crate. STD_EXCLUDED_CRATES: "--exclude fw-update-interface-test-mocks ..."

Reviewed changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
fw-update-interface-test-mocks/src/lib.rs New crate root exporting the basic mock module.
fw-update-interface-test-mocks/src/basic.rs Adds a FwUpdate mock implementation with call recording and tests.
fw-update-interface-test-mocks/Cargo.toml Defines the new test-mocks crate (currently with an inconsistent package name).
cfu-service/src/basic/test.rs Switches CFU tests to import the renamed firmware-update test mock crate.
.github/workflows/check.yml Updates CI exclusion list for std-only crates on embedded targets.

Comment thread cfu-service/src/basic/test.rs
Comment thread .github/workflows/check.yml
@RobertZ2011 RobertZ2011 force-pushed the name-fw-update-interface-mocks branch 2 times, most recently from 9e503e3 to f5c978a Compare June 25, 2026 20:17
@RobertZ2011 RobertZ2011 marked this pull request as ready for review June 25, 2026 20:22
@RobertZ2011 RobertZ2011 requested review from a team as code owners June 25, 2026 20:22
@RobertZ2011 RobertZ2011 enabled auto-merge (squash) June 25, 2026 20:22
@RobertZ2011 RobertZ2011 requested a review from jerrysxie June 25, 2026 20:22
Rename to better match crate purpose and other test mock crates.
@RobertZ2011 RobertZ2011 force-pushed the name-fw-update-interface-mocks branch from f5c978a to a518905 Compare June 25, 2026 20:23
@RobertZ2011 RobertZ2011 changed the title Rename fw-update-interface-mocks to fw-update-test-interface-mocks Rename fw-update-interface-mocks to fw-update-interface-test-mocks Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cargo vet PRs pending auditor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants