Skip to content

Conversation

@cretz
Copy link
Member

@cretz cretz commented Dec 26, 2024

What was changed

Added initial temporal-workflowcheck project. This is currently considered "beta". See the README for more about the project.

TODO in the near future:

  • Turn the TODO at the bottom of temporal-workflowcheck/README.md into a set of issues
  • After we have published our first release of this...
    • Update primary README with link to the project in the child dir
    • Update the 3 sample projects herein to reference the project
    • Update samples-java to incorporate workflowcheck

}

// Need all-in-one JAR
shadowJar {
Copy link
Member Author

Choose a reason for hiding this comment

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

Unlike the -shaded project, we just need the -all.jar this generates, and we only have one real dependency anyways

Comment on lines +3 to +5
// Add the workflowcheck project as a composite build. We are only doing this
// for the sample, normally this is not needed.
includeBuild '../../../' No newline at end of file
Copy link
Member Author

Choose a reason for hiding this comment

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

This and the other two samples will be updated when a version of this project is published

System.err.println("Unrecognized argument: " + invalidArg);
}

System.err.println("Analyzing classpath for classes with workflow methods...");
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why I do System.err here and System.out below, probably just need to pick one

@cretz cretz marked this pull request as ready for review December 26, 2024 21:12
@cretz cretz requested a review from a team as a code owner December 26, 2024 21:12

# Quite a few internal libraries catch interrupts just to re-interrupt, so we
# will mark thread interrupt as safe (other thread stuff is not)
temporal.workflowcheck.invalid.java/lang/Thread.currentThread=false
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 check my understand of the format here, so above you said thread was not deterministic and here you are allowlisting these specific methods is that fair to say? So all other static method in Thread are not allowed.

Copy link
Member Author

@cretz cretz Dec 4, 2025

Choose a reason for hiding this comment

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

Yes, that is fair to say. Correct, other static methods in thread are not allowed (i.e. considered "invalid" and set to true) due to the higher level rule above. This works because of the order of checking from most specific to least specific until it finds a decision. This is admittedly a bit complicated, but I think it's a very sane/flexible approach. The "Configuration" section of the README goes over how it works.

So even if a user wanted to set one thread method allowed in their config on top of this, they can.

@Quinn-With-Two-Ns
Copy link
Contributor

Note, we should remove the copyright notice from the top of the files

@Quinn-With-Two-Ns
Copy link
Contributor

There are a few todo's scatter around, do you plan to address these?

# limitations under the License.
#

#### Invalid Calls ####
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that would be nice to add is a suggested resolution for a violation, ie if the used called Clock we should suggest they use Workflow.currentMillis(). I don't think you need to add that right now, but can you suggest how we would add that in the future with this format?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hrmm, yeah I suppose in addition to false and true, we could accept any arbitrary string and that would be implied true and be the error message. Or even better, the value is prefixed with message: to future proof it and have more clear true/false/message: validation.

@cretz
Copy link
Member Author

cretz commented Dec 4, 2025

Note, we should remove the copyright notice from the top of the files

Can do. Want me to do that here in PR, or want to do that as part of some project move to another repo?

There are a few todo's scatter around, do you plan to address these?

No, not part of initial release, they should be opened as separate issues IMO or decided not worth doing. And the entire "TODO" section of the README should be removed (and maybe the TODOs in code too, less concerned about those). I can open these, but I'm guessing we should confirm the home for this first.

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