fix(daemon,cli): fix #2700 use endo/init to prepare async hooks #2708
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #2700
Refs: #2701
Description
Implements exactly @mhofman 's suggestion at #2700 (comment)
Alternative to #2701
Changes some occurrences of
import 'ses';
toimport '@endo/init';
so that the async hooks are properly prepared so that things work in an interactive debug session -- at least in vscode. See #2700However, there are many other bare
import 'ses';
occurrences in endo. How many for of these need toimport '@endo/init';
instead in order to avoid this same problem? For now, I conservatively looked for other occurrences of the common marking comment "Establish a perimeter". I found two additional ones that this PR currently just annotates with a TODO. Reviewers, please advise.If we take this approach, can we avoid needing to teach developers not to
import 'ses';
so they avoid this problem? Or should we move the async-hook preparation somehow from@endo/init
inses
, perhaps as a repair, so all existingimport 'ses';
occurrences become correct?Or should we instead proceed with #2701 after all?
Security Considerations
none
Scaling Considerations
none
Documentation Considerations
Weird to need to teach developers to avoid
import 'ses';
. I hope we can avoid needing to teach this. Reviewers please advise.Testing Considerations
The underlying issue #2700 occurs during an interactive debug session. If this is not fixed, it can impede the run-debug-loop, especially for running tests. In particular, ses-ava currently
import 'ses';
rather thanimport '@endo/init';
. This would perhaps be the highest next priority to change.Compatibility Considerations
Perhaps not all occurrences of
import 'ses';
can or should be switched toimport '@endo/init';
because of the other things bundled into@endo/init
.Upgrade Considerations
I think none. Reviewers: please double check me on this.