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

IWF-137: Allow to use separate persistency loading policy for waitUntil #448

Merged
merged 16 commits into from
Oct 17, 2024

Conversation

samuel27m
Copy link
Member

@samuel27m samuel27m commented Oct 14, 2024

Description

Checklist

  • Code compiles correctly
  • Tests for the changes have been added
  • All tests passing
  • This PR change is backwards-compatible
  • This PR CONTAINS a (planned) breaking change (it is not backwards compatible)

Related Issue

Closes #387

@samuel27m samuel27m marked this pull request as ready for review October 16, 2024 14:25
Comment on lines 53 to 62
if stateOptions.HasDataObjectsLoadingPolicy() {
return stateOptions.DataObjectsLoadingPolicy
}

if stateOptions.HasDataAttributesLoadingPolicy() {
return stateOptions.DataAttributesLoadingPolicy
}

return stateOptions.WaitUntilApiDataAttributesLoadingPolicy
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the expected behavior is to prefer more specific to override less specific -- waitUntilDALoadingPolicy will override daLoadingPolicy, then DataObjectsLoadingPolicy, then nil

Copy link
Member Author

@samuel27m samuel27m Oct 16, 2024

Choose a reason for hiding this comment

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

When I did this I tried copying from the existing fallback from DataAttributesLoadingPolicy to HasDataObjectsLoadingPolicy:

        if stateOptions.HasDataObjectsLoadingPolicy() {
		return stateOptions.DataObjectsLoadingPolicy
	}
	return stateOptions.DataAttributesLoadingPolicy

However, you're absolutely right, more specific should override less specific, I'll make the changes.
I will also implement a integ test that ensures that the more specific policy is the one being picked up if they're both specified.

Copy link
Member Author

@samuel27m samuel27m Oct 17, 2024

Choose a reason for hiding this comment

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

Done now ✅
More specific policies should override less specific ones

/**
* This test has four states
*
* State1: Creates all Data Attributes keys that will be used in this test
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide details on what does WaitUntil and Execute do? F.g. State1 doesn't do anything in WaitUntil.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done ✅

)

/**
* This test has four states
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! I planned to add documentation to all the exsting integ test workflow, and wondering what is the format. I think it's a great idea that just put it at the beginning.

Nit: This test has four states -> This test workflow has four states, using REST controller to implement the workflow directly.

Copy link
Member Author

@samuel27m samuel27m Oct 16, 2024

Choose a reason for hiding this comment

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

Will make the change! Thanks!

Do you think that is best for the comment to be at the start of the test routers file (where it currently is) or at the start of the actual test file (i.e. wf_state_options_data_attributes_loading_test.go)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done ✅

* - da_other_key
* State2:
* - Declares State Options containing WaitUntilApiDataAttributesLoadingPolicy
* - Asserts that (ApiV1WorkflowStateStart) WaitUntil method will load with expected Data Attributes
Copy link
Contributor

Choose a reason for hiding this comment

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

also better to clarirfy where is the Asserts: in waitUntil or execute

Copy link
Member Author

@samuel27m samuel27m Oct 16, 2024

Choose a reason for hiding this comment

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

I did specify where the Asserts is: - Asserts that (ApiV1WorkflowStateStart) **WaitUntil** method will load with expected Data Attributes

But this probably means that the comment is not very readable. I'll make changes so that this reads better!

Copy link
Member Author

Choose a reason for hiding this comment

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

I made changes to the comment structure so that it is more readable. Let me know what you think, we can also brainstorm about it on a call if you prefer! 👍

Makefile Outdated
@@ -138,7 +138,7 @@ iwf-server:

.PHONY: bins release clean

idl-code-gen: #generate/refresh go clent code for idl, do this after update the idl file
idl-code-gen: #generate/refresh go client code for idl, do this after update the idl file
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

also maybe fix the wording, "client code" may be confusing with our sdk. I would just say "go code for idl(API schema".

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do! Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done ✅

@@ -45,14 +45,62 @@ func GetDecideApiRetryPolicy(stateOptions *iwfidl.WorkflowStateOptions) *iwfidl.
return stateOptions.ExecuteApiRetryPolicy
}

func GetDataObjectsLoadingPolicy(stateOptions *iwfidl.WorkflowStateOptions) *iwfidl.PersistenceLoadingPolicy {
func GetWaitUntilApiDataObjectsLoadingPolicy(stateOptions *iwfidl.WorkflowStateOptions) *iwfidl.PersistenceLoadingPolicy {
Copy link
Contributor

Choose a reason for hiding this comment

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

DataObject is the old name, let's rename it to the new one if possible (there are more we need to do in the repo)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll create a new issue for this 👍

@samuel27m samuel27m merged commit 2b0fabc into main Oct 17, 2024
6 checks passed
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.

Allow to use separate persistency loading policy for waitUntil
2 participants