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

Added deprecated domain check to the taskvalidator #5580

Merged
merged 9 commits into from
Jan 6, 2024

Conversation

agautam478
Copy link
Contributor

What changed?

  • Added a check if the workflow's domain exists or if it's not deprecated before sending it for the stale workflow check.
  • Currently the check has no associated action for safety purposes. The plan is to call a delete on such workflows after each validation step.

Why?

  • These changes have been made in order to add validation in the task processing workflows to ensure that they are not corrupted.

How did you test it?
Added a partner unit test.

Potential risks
NA

Release notes
NA

Documentation Changes
NA

common/cache/domainCache.go Outdated Show resolved Hide resolved
common/taskvalidator/validateworkflow.go Outdated Show resolved Hide resolved
common/taskvalidator/validateworkflow.go Outdated Show resolved Hide resolved
common/taskvalidator/validateworkflow.go Outdated Show resolved Hide resolved
common/taskvalidator/validateworkflow.go Outdated Show resolved Hide resolved
common/taskvalidator/validateworkflow_test.go Outdated Show resolved Hide resolved
@agautam478 agautam478 merged commit 0cdd8d0 into cadence-workflow:master Jan 6, 2024
16 checks passed
Comment on lines +43 to +44
{"DomainFetchSuccess", "domain-id-success", "run-id-success"},
{"DomainFetchFailure", "domain-id-failure", "run-id-failure"},
Copy link
Member

Choose a reason for hiding this comment

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

how are these 2 cases different? validations expect no error below

Copy link
Contributor Author

@agautam478 agautam478 Jan 8, 2024

Choose a reason for hiding this comment

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

The main code currently doesn't do anything except for logging the case. The test is for a supporting domain id retrieval check as there's not much to test really. Will be modifying it with something more substantial in the upcoming in-progress PR.

Comment on lines +268 to +271
const (
DeprecatedDomainStatus = 1
DeletedDomainStatus = 2
)
Copy link
Member

Choose a reason for hiding this comment

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

these are still copies of original enum. see my prev comment #5580 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

@Shaddoll what is the pattern we follow for defining a corresponding type in common that is originally defined in persistence package only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried importing the original enum but it didn't work out so ended up defining these in a common file.

Copy link
Member

Choose a reason for hiding this comment

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

they're visible / common/persistence is definitely the place to get them from when looking at persistence-related data. should work the same since they're consts (i.e. same implicit casting whether it's here or persistence folder)

Copy link
Member

Choose a reason for hiding this comment

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

@agautam478 why didn't it work when imported from persistence? cyclic dependency?
We need to figure out a solution than re-defining these because there's no mechanism ensuring these don't go out of sync

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.

4 participants