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

Much stronger nondeterminism detection #7

Merged
merged 49 commits into from
Jun 27, 2024
Merged

Much stronger nondeterminism detection #7

merged 49 commits into from
Jun 27, 2024

Conversation

CaspianA1
Copy link
Collaborator

@CaspianA1 CaspianA1 commented Jun 25, 2024

  • Stronger determinism rules (in part due to using ts-morph from a typescript-eslint entrypoint
  • Migrate the codebase to TypeScript
  • More test cases
  • Upgraded version from 0.06 to 1.0.0
  • At the moment working on an action to publish to NPM

CaspianA1 added 30 commits June 19, 2024 09:35
- Replace Chuck's old rules with my new `ts-morph`-based rules
- Comments out the tests for now (will add them back later)
- Move the rules + the tests into their own directories
- Write some tests (will switch the testing framework to jest later)
package.json Outdated Show resolved Hide resolved
type GlobalTools = {eslintContext: EslintContext, parserServices: ParserServicesWithTypeInformation, typeChecker: TypeChecker};
let GLOBAL_TOOLS: GlobalTools | undefined = undefined;

// These included `Transaction` and `TransactionContext` respectively before!
Copy link
Member

Choose a reason for hiding this comment

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

What does this mean? I think we want to add Transaction and TransactionContext in the following lines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes - Peter told me we should leave them out; they were there before, but keeping them in resulted in lots of false positives on the dbos-demo-apps projects

Copy link
Member

@kraftp kraftp Jun 26, 2024

Choose a reason for hiding this comment

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

Yeah, we should only check workflows for now

Copy link
Member

@qianl15 qianl15 Jun 26, 2024

Choose a reason for hiding this comment

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

Okay, let's do it in a future PR.
I think your new rule that allows await on a function with a ctxt param would already eliminate most of the false positives.


try {
if (Node.isSourceFile(tsMorphNode)) {
tsMorphNode.getFunctions().forEach(evaluateFunctionForDeterminism);
Copy link
Member

Choose a reason for hiding this comment

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

Since functions outside of classes can't have decorators, do we still need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes - there might be classes inside of the functions, and the getFunctions and getClasses calls only give you the outermost classes and functions, so you have to recur on the functions and classes inside of all the functions and classes respectively

@CaspianA1 CaspianA1 force-pushed the determinism_rules branch from 984cded to 1beea51 Compare June 25, 2024 23:09
@CaspianA1 CaspianA1 self-assigned this Jun 25, 2024
@CaspianA1 CaspianA1 added the enhancement New feature or request label Jun 25, 2024
@CaspianA1 CaspianA1 force-pushed the determinism_rules branch from 58ce812 to 56ec5ea Compare June 26, 2024 00:01
dbos-rules.test.ts Outdated Show resolved Hide resolved
dbos-rules.ts Outdated Show resolved Hide resolved
dbos-rules.ts Outdated Show resolved Hide resolved
dbos-rules.ts Outdated Show resolved Hide resolved
dbos-rules.ts Outdated Show resolved Hide resolved
dbos-rules.ts Show resolved Hide resolved
dbos-rules.ts Show resolved Hide resolved
@CaspianA1 CaspianA1 merged commit fb62d0e into main Jun 27, 2024
1 check passed
@CaspianA1 CaspianA1 deleted the determinism_rules branch June 27, 2024 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants