Skip to content

Conversation

@makubacki
Copy link
Collaborator

@makubacki makubacki commented Dec 4, 2025

Description

Implement validation rules for component `Storage`` parameters that follow normal Rust borrowing semantics:

  • Allow multiple &Storage parameters (multiple immutable references)
  • Allow a single &mut Storage parameter (exclusive mutable reference)
  • Prevent mixing &Storage with &mut Storage
  • Prevent duplicate &mut Storage parameters

Adds macro unit tests and UI compilation failure message tests.


Note: This was not clearly handled in the past (since component inception). An error would have been thrown but it would have misrepresented the problem to a conflicting ConfigMut<T> instead of the real issue which is a conflicting &mut Storage parameter.


  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all
  • QEMU platform boot

Integration Instructions

  • N/A - These rules should already be followed by components

@makubacki makubacki self-assigned this Dec 4, 2025
@github-actions github-actions bot added impact:non-functional Does not have a functional impact impact:testing Affects testing labels Dec 4, 2025
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Implement validation rules for component `Storage`` parameters that
follow normal Rust borrowing semantics:

- Allow multiple `&Storage` parameters
  (multiple immutable references)
- Allow a single `&mut Storage` parameter
  (exclusive mutable reference)
- Prevent mixing `&Storage` with `&mut Storage`
- Prevent duplicate `&mut Storage parameters`

Adds macro unit tests and UI compilation failure message tests.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki makubacki force-pushed the add_component_storage_validation_check branch from 8841a27 to 9721861 Compare December 4, 2025 17:52
@makubacki makubacki enabled auto-merge (squash) December 4, 2025 17:55
@makubacki makubacki merged commit 9e380da into OpenDevicePartnership:main Dec 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:non-functional Does not have a functional impact impact:testing Affects testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants