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

ENG-48446: Implementation for new Filter condition and filter conversion #228

Merged
merged 11 commits into from
Aug 21, 2024

Conversation

harshit-kumar-v2
Copy link
Contributor

Description

Please include a summary of the change, motivation and context.

Testing

Please describe the tests that you ran to verify your changes. Please summarize what did you test and what needs to be tested e.g. deployed and tested helm chart locally.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Documentation

Make sure that you have documented corresponding changes in this repository or hypertrace docs repo if required.

@harshit-kumar-v2 harshit-kumar-v2 requested a review from a team as a code owner August 20, 2024 17:50
// reject create config with condition
if (optionalPreviousConfig.isEmpty() && request.hasUpsertCondition()) {
throw Status.INVALID_ARGUMENT
.withDescription("No upsert condition required for creating config")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably treat this the same as an update operation where the condition doesn't hold. At least the same status, even if a specific message.

Copy link
Contributor

Choose a reason for hiding this comment

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

So given the latest change, that'd be a failed precondition

Copy link

github-actions bot commented Aug 21, 2024

Test Results

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

Results for commit cdbd390. ± Comparison against base commit 7a59a85.

This pull request removes 1 and adds 6 tests. Note that renamed tests count towards both.
org.hypertrace.config.service.store.DocumentConfigStoreTest ‑ writeConfig()
org.hypertrace.config.service.store.DocumentConfigStoreTest ‑ WriteConfigForCreate()
org.hypertrace.config.service.store.DocumentConfigStoreTest ‑ WriteConfigForUpdateWithUpsertCondition()
org.hypertrace.config.service.store.DocumentConfigStoreTest ‑ WriteConfigForUpdateWithoutUpsertCondition()
org.hypertrace.config.service.store.FilterBuilderTest ‑ buildDocStoreFilter1()
org.hypertrace.config.service.store.FilterBuilderTest ‑ buildDocStoreFilter2()
org.hypertrace.config.service.store.FilterBuilderTest ‑ buildDocStoreFilter3()

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 63.38028% with 26 lines in your changes missing coverage. Please review.

Project coverage is 79.52%. Comparing base (49d70b0) to head (718756f).
Report is 15 commits behind head on main.

Files Patch % Lines
...hypertrace/config/service/store/FilterBuilder.java 59.25% 19 Missing and 3 partials ⚠️
...race/config/service/store/DocumentConfigStore.java 75.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #228      +/-   ##
============================================
- Coverage     79.92%   79.52%   -0.40%     
+ Complexity      488      407      -81     
============================================
  Files            54       56       +2     
  Lines          2416     2496      +80     
  Branches        106      110       +4     
============================================
+ Hits           1931     1985      +54     
- Misses          425      446      +21     
- Partials         60       65       +5     
Flag Coverage Δ
integration 79.52% <63.38%> (-0.40%) ⬇️
unit ?

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.

// reject create config with condition
if (optionalPreviousConfig.isEmpty() && request.hasUpsertCondition()) {
throw Status.INVALID_ARGUMENT
.withDescription("No upsert condition required for creating config")
Copy link
Contributor

Choose a reason for hiding this comment

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

So given the latest change, that'd be a failed precondition

@@ -262,7 +285,7 @@ private Filter buildConfigResourceContextsFilter(
.map(this::getConfigResourceFieldContextFilter)
.collect(Collectors.toUnmodifiableList());
Filter configResourceFieldContextFilter = new Filter();
configResourceFieldContextFilter.setOp(Filter.Op.OR);
configResourceFieldContextFilter.setOp(OR);
Copy link
Contributor

Choose a reason for hiding this comment

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

In this PR or another - it'd be good to move this filter building into the filter builder class now that there's a dedicated class for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok making those refactor in a different PR

@harshit-kumar-v2 harshit-kumar-v2 merged commit 20f405e into main Aug 21, 2024
9 checks passed
@harshit-kumar-v2 harshit-kumar-v2 deleted the ENG-48446 branch August 21, 2024 16:19
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