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

build: resolve all floating promise warnings #7465

Closed
wants to merge 1 commit into from

Conversation

samsiegart
Copy link
Contributor

@samsiegart samsiegart commented Apr 20, 2023

refs: #6000

Description

Resolve all violations of @typescript-eslint/no-floating-promises in all packages (except for SwingSet and swingset-runner, see discussion below).

Change rule from warn to error to ensure more instances don't come up after this effort.

Security Considerations

N/A

Scaling Considerations

N/A

Documentation Considerations

N/A

Testing Considerations

Ran NODE_OPTIONS='--max-old-space-size=8192' AGORIC_ESLINT_TYPES=true yarn lint:eslint in each package.

Unit tests should still pass.

Anything with a change to add explicit void will not change any behavior. However, it's possible that there are still hidden bugs resulting from not awaiting or catching these promises. Is it in our best interest to use void anywhere then? By doing so, we risk sweeping those bugs under the rug, despite appeasing the lint rule. If we must remove all void, then this is a much larger task.

@samsiegart samsiegart force-pushed the floating-promise branch 2 times, most recently from f31d865 to 1fc7cb5 Compare April 20, 2023 05:02
@samsiegart samsiegart requested a review from turadg April 20, 2023 05:30
@samsiegart samsiegart marked this pull request as ready for review April 20, 2023 05:30
@samsiegart samsiegart force-pushed the floating-promise branch 2 times, most recently from 76b4ac6 to 6774abc Compare April 20, 2023 05:58
@samsiegart
Copy link
Contributor Author

Some packages, like SwingSet and swingset-runner, seem to get stuck on NODE_OPTIONS='--max-old-space-size=8192' AGORIC_ESLINT_TYPES=true yarn lint:eslint. I'm not sure how to proceed @turadg

@turadg
Copy link
Member

turadg commented Apr 20, 2023

not sure how to proceed

Maybe due to cycles. Try restricting the linting to subpaths to see what report you can get without hanging.

@samsiegart
Copy link
Contributor Author

Maybe due to cycles. Try restricting the linting to subpaths to see what report you can get without hanging.

I ran again with --debug and it doesn't seem to be hitting any cycles, but for every file it takes a long time and spits out an error like this: https://gist.github.com/samsiegart/cee3e57ed41dee3643d80084247d0666.

Before looking further into this, I'll note to @ivanlei that I've hit the 1-day-of-work timebox for this task. And, I have some doubts (see bottom of PR description) of the benefit of this PR.

@samsiegart
Copy link
Contributor Author

@turadg Ivan says "for stuff that stalls i think just skip them". Given that I've run the command on a per-package basis for each package that doesn't stall, I think it makes sense to merge (after review) these changes at least.

@turadg
Copy link
Member

turadg commented Apr 20, 2023

think it makes sense to merge (after review) these changes at least

Fair enough. Please update the description so that it doesn't close the ticket to complete the work. (I was going to say that anyway since we shouldn't close the ticket, an audit, until just before release since the code is still changing.)

@samsiegart
Copy link
Contributor Author

Please update the description so that it doesn't close the ticket to complete the work.

Done

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

I ran into a failure today in zcfZygote because a promise wasn't awaited. I see in here it's marked void.

I notice not all promises here are voided but most of them are, so I suspect there are other voids that really should be awaited or error handled. Can you trim down the changes to files you're confident in the way the promises are handled?

@@ -361,7 +361,7 @@ export const makeZCFZygote = async (
privateArgs = undefined,
) => {
zoeInstanceAdmin = instanceAdminFromZoe;
initSeatMgrAndMintFactory();
void initSeatMgrAndMintFactory();
Copy link
Member

Choose a reason for hiding this comment

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

this should be awaited. if it fails the contract should not restart

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -417,7 +417,7 @@ export const makeZCFZygote = async (
prepare || Fail`prepare must be defined to upgrade a contract`;
zoeInstanceAdmin = zcfBaggage.get('zcfInstanceAdmin');
instanceRecHolder = zcfBaggage.get('instanceRecHolder');
initSeatMgrAndMintFactory();
void initSeatMgrAndMintFactory();
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@samsiegart
Copy link
Contributor Author

Having some trouble with commit history so started a new PR for just the changes I'm confident about #7485

@samsiegart samsiegart closed this Apr 24, 2023
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