-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Ac/pm 25823/vnext policy upsert pattern #6426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ces into their own file
New Issues (2)Checkmarx found the following issues in this Pull Request
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6426 +/- ##
==========================================
+ Coverage 50.55% 50.72% +0.16%
==========================================
Files 1854 1866 +12
Lines 82184 82696 +512
Branches 7262 7307 +45
==========================================
+ Hits 41547 41944 +397
- Misses 39047 39154 +107
- Partials 1590 1598 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
||
private static Dictionary<PolicyType, IEnforceDependentPoliciesEvent> MapToDictionary(IEnumerable<IEnforceDependentPoliciesEvent> policyValidationEventHandlers) | ||
{ | ||
var policyValidationEventsDict = new Dictionary<PolicyType, IEnforceDependentPoliciesEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure if this is needed since it’s from the old pattern. I think it was meant to prevent duplicates, but that was when everything was in one interface. Now we have four interfaces, so I’m not sure it makes sense anymore. I’m happy to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great, but since it’s a complex solution, I think it would really benefit from thorough documentation.
- add xmldoc to every new interface clarifying what it represents and when its called
VNextSavePolicyCommand
explain the execution flow
Policy? currentPolicy) | ||
{ | ||
await ExecutePolicyEventAsync<IPolicyValidationEvent>( | ||
currentPolicy!.Type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we always expect the currentPolicy
to not be null? What happens when we're setting up a policy the first time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that should have used the type from the request object.
|
||
private static void ValidateEnablingRequirements( | ||
IEnforceDependentPoliciesEvent validator, | ||
Policy? currentPolicy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentPolicy
is not used
public interface IOnPolicyPreUpdateEvent : IPolicyUpdateEvent | ||
{ | ||
/// <summary> | ||
/// Performs side effects before a policy is upserted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I’m addressing your comments here so we can have a thread on it.
Original comment
add xmldoc to every new interface clarifying what it represents and when its called
I added documentation to the method in the interface, would that be sufficient? I’m happy to adjust it if needed, but I’d prefer to avoid duplicating the same text in two places.
src/Core/AdminConsole/OrganizationFeatures/Policies/Implementations/VNextSavePolicyCommand.cs
Show resolved
Hide resolved
src/Core/AdminConsole/OrganizationFeatures/Policies/Implementations/VNextSavePolicyCommand.cs
Show resolved
Hide resolved
src/Core/AdminConsole/OrganizationFeatures/Policies/Implementations/VNextSavePolicyCommand.cs
Show resolved
Hide resolved
...nsole/OrganizationFeatures/Policies/PolicyUpdateEvents/Interfaces/IVNextSavePolicyCommand.cs
Show resolved
Hide resolved
...nsole/OrganizationFeatures/Policies/PolicyUpdateEvents/Interfaces/IVNextSavePolicyCommand.cs
Show resolved
Hide resolved
...le/OrganizationFeatures/Policies/PolicyUpdateEvents/Interfaces/IPolicyEventHandlerFactory.cs
Show resolved
Hide resolved
...le/OrganizationFeatures/Policies/PolicyUpdateEvents/Interfaces/IPolicyEventHandlerFactory.cs
Show resolved
Hide resolved
…teEvents/Interfaces/IVNextSavePolicyCommand.cs Co-authored-by: Rui Tomé <[email protected]>
…teEvents/Interfaces/IPolicyEventHandlerFactory.cs Co-authored-by: Rui Tomé <[email protected]>
…teEvents/Interfaces/IPolicyEventHandlerFactory.cs Co-authored-by: Rui Tomé <[email protected]>
…teEvents/Interfaces/IVNextSavePolicyCommand.cs Co-authored-by: Rui Tomé <[email protected]>
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-25823
📔 Objective
Add a new version of SavePolicyCommand to enable
This code isn’t consumed yet and therefore isn’t testable.
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes