Skip to content
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

chore: add support for system label application rules #235

Merged
merged 5 commits into from
Sep 2, 2024

Conversation

saxenakshitiz
Copy link
Contributor

No description provided.

@saxenakshitiz saxenakshitiz requested a review from a team as a code owner August 30, 2024 18:25
Copy link

github-actions bot commented Aug 30, 2024

Test Results

132 tests  +5   132 ✅ +5   55s ⏱️ -3s
 31 suites +1     0 💤 ±0 
 31 files   +1     0 ❌ ±0 

Results for commit 959ac0d. ± Comparison against base commit 9519fa1.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 82.92683% with 7 lines in your changes missing coverage. Please review.

Project coverage is 78.92%. Comparing base (7a59a85) to head (d6d3c34).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...service/LabelApplicationRuleConfigServiceImpl.java 82.92% 3 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #235      +/-   ##
============================================
- Coverage     79.93%   78.92%   -1.01%     
- Complexity      496      524      +28     
============================================
  Files            55       57       +2     
  Lines          2432     2567     +135     
  Branches        108      120      +12     
============================================
+ Hits           1944     2026      +82     
- Misses          427      471      +44     
- Partials         61       70       +9     
Flag Coverage Δ
integration 78.92% <82.92%> (-1.01%) ⬇️
unit 77.34% <82.92%> (-1.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@saxenakshitiz saxenakshitiz enabled auto-merge (squash) August 30, 2024 18:36
labelApplicationRuleConfig.getInt(MAX_DYNAMIC_LABEL_APPLICATION_RULES_PER_TENANT);
}
Config labelApplicationRuleConfig =
config.hasPath(LABEL_APPLICATION_RULE_CONFIG_SERVICE_CONFIG)
Copy link
Contributor

Choose a reason for hiding this comment

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

hasPath checks aren't necessary - just put an empty array as a default value in application.conf (which is less code and makes the config easier to understand anyway). Same goes for the other configs, although they're pre-existing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keeping it as is. May require changes across multiple application.conf

Copy link
Contributor

Choose a reason for hiding this comment

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

Separate PR is fine, but please come back to this. It will only require a change in the default application conf to explicitly declare the default values rather than having the defaults defined across code, conf, and helm.

@@ -140,6 +173,12 @@ public void deleteLabelApplicationRule(
try {
RequestContext requestContext = RequestContext.CURRENT.get();
this.requestValidator.validateOrThrow(requestContext, request);
String labelApplicationRuleId = request.getId();
if (systemLabelApplicationRulesMap.containsKey(labelApplicationRuleId)) {
// Deleting a system label application rule is not allowed
Copy link
Contributor

Choose a reason for hiding this comment

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

We generally allow users to delete default config. Why is this different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be done. However deleting a default rule will require a new config store to persist it. Will add it if need arises.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do it in separate PR

@@ -44,20 +43,26 @@
import org.junit.jupiter.api.Test;

public class LabelApplicationRuleConfigServiceImplTest {
private static final String SYSTEM_LABEL_APPLICATION_RULE_STR =
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is mocking the config, so mock it (i.e. return a prebuilt rule) rather than do the real parse logic and put it behind a mock. Not only is that not the responsibility of this class/test, but if a change were added to the rule structure this test would miss it silently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Hopefully last review comment to address ;-)

@saxenakshitiz saxenakshitiz merged commit 834e663 into main Sep 2, 2024
9 checks passed
@saxenakshitiz saxenakshitiz deleted the support_system_rules branch September 2, 2024 08:29
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.

2 participants