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

Add metadata transformations with metadata tuples #1148

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AndreKurait
Copy link
Member

Description

[Describe what this change achieves]

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
  • Why these changes are required?
  • What is the old behavior before changes and new behavior after changes?

Issues Resolved

[List any issues this PR will resolve]

Is this a backport? If so, please add backport PR # and/or commits #

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Andre Kurait <akurait@amazon.com>
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.84%. Comparing base (892990a) to head (488c664).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1148      +/-   ##
============================================
+ Coverage     80.78%   80.84%   +0.06%     
- Complexity     2947     2983      +36     
============================================
  Files           399      406       +7     
  Lines         15089    15215     +126     
  Branches       1017     1019       +2     
============================================
+ Hits          12190    12301     +111     
- Misses         2288     2289       +1     
- Partials        611      625      +14     
Flag Coverage Δ
unittests 80.84% <ø> (+0.06%) ⬆️

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.


🚨 Try these New Features:


import lombok.extern.slf4j.Slf4j;

/** Shared functionality between migration and evaluation commands */
@Slf4j
public abstract class MigratorEvaluatorBase {
public static final String NOOP_TRANSFORMATION_CONFIG = "[" +
Copy link
Member

Choose a reason for hiding this comment

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

Lets remove this, if there is no transformation config why create and use the factory?

Copy link
Member

@chelma chelma left a comment

Choose a reason for hiding this comment

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

Thanks for the work here! Looking forward to seeing some tests to help understand the user experience a bit better. Overall, feels like a good first step as we continue to iterate and evolve our vision for transformations.

Comment on lines +120 to +125
var transformedTemplates = Stream.concat(Stream.concat(
legacyTemplates.stream(),
indexTemplates.stream()),
componentTemplates.stream()
)
.map(this::transformMigrationItem).collect(Collectors.toList());
Copy link
Member

Choose a reason for hiding this comment

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

Why combine all the different migration item types into an undifferentiated stream, transform, then split them up again? Wouldn't it be easier and more efficient to just apply the transform to each class individually?

Comment on lines +102 to +104
log.atInfo().setMessage("BeforeJsonGlobal: {}").addArgument(() -> printMap(inputJson)).log();
var afterJson = transformer.transformJson(inputJson);
log.atInfo().setMessage("AfterJsonGlobal: {}").addArgument(() -> printMap(afterJson)).log();
Copy link
Member

Choose a reason for hiding this comment

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

It's interesting to have a pre-processor transform for the global metadata but not the index settings. Is this an opinionated stance or just a matter of current necessity? Also - how does this fit into the bigger picture we previously discussed of having user-supplied bulk pre/post processing transforms then line-item transforms for each individual MigrationItem between those two steps?

Comment on lines +13 to +15
@NoArgsConstructor(force = true) // For Jackson
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "type")
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for cleaning up all the Jackson marshalling for these data classes!

Signed-off-by: Andre Kurait <akurait@amazon.com>
Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Thanks for the tests, looks like maybe there is some kind of refactoring we can do in the future to cleanup the setup / verification that is very similar between the tests, but this gives me a lot of confidence that we will know when we break something - much appreciated.

Seems like there is a one off system index that is causing the new test cases to fail and some style cop changes, but the bones of this good to me once CI is passing.

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.

3 participants