Skip to content

Conversation

@scouten-adobe
Copy link
Collaborator

@scouten-adobe scouten-adobe commented Feb 21, 2025

Having StatusTracker as a non-object-safe trait made it impossible to use in further trait APIs.

See early draft of #936 for an example of this problem.

This PR changes StatusTracker to be a struct. It uses a new enum ErrorBehavior to describe the only two implementations of StatusTracker that have ever existed.

Having `StatusTracker` as a non-object-safe trait made it impossible to use in further trait APIs.

See early draft of #936 for an example of this problem.

This PR changes `StatusTracker` to use an enum to describe the only two implementations of `StatusTracker` that have ever existed.
@codecov
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 93.53612% with 17 lines in your changes missing coverage. Please review.

Project coverage is 78.78%. Comparing base (1cc1066) to head (bf83aac).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sdk/src/manifest_store.rs 70.58% 5 Missing ⚠️
sdk/src/store.rs 95.90% 5 Missing ⚠️
internal/crypto/src/cose/ocsp.rs 33.33% 2 Missing ⚠️
sdk/src/manifest_store_report.rs 75.00% 2 Missing ⚠️
sdk/src/reader.rs 50.00% 2 Missing ⚠️
sdk/src/validation_status.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #937   +/-   ##
=======================================
  Coverage   78.78%   78.78%           
=======================================
  Files         148      146    -2     
  Lines       35085    35096   +11     
=======================================
+ Hits        27643    27652    +9     
- Misses       7442     7444    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

///
/// Primarily intended for use by [`LogItem::success()`]
/// or [`LogItem::informational()`].
pub fn add_non_error(&mut self, mut log_item: LogItem) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that LogItem now contains a kind field, there's no need for separate add_non_error and add_error. We should have an add() method that does the right thing. If we aren't ready to update all the calling code, the add_non_error and add_error should simply call add().

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is carried over from the existing APIs. The primary difference is that add_error can trigger an Err result if the status tracker is configured to stop on first error and in that case, we need to have an Error type ready to use.

The add_non_error case has no return value, so we don't need to pass in an Error.

Copy link
Collaborator

@mauricefisher64 mauricefisher64 left a comment

Choose a reason for hiding this comment

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

Good simplification

@scouten-adobe scouten-adobe merged commit 16b2a31 into main Feb 26, 2025
31 checks passed
@scouten-adobe scouten-adobe deleted the simplify-status-tracker branch February 26, 2025 22:17
@scouten-adobe scouten-adobe mentioned this pull request Feb 26, 2025
This was referenced Mar 12, 2025
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