Skip to content

Commit fbd97e7

Browse files
authored
fix(daemon,cli): Fix #2700 use endo/init to prepare async hooks (#2708)
Closes: #2700 Refs: #2701 ## Description Implements exactly @mhofman 's suggestion at #2700 (comment) Alternative to #2701 Changes some occurrences of `import 'ses';` to `import '@endo/init';` so that the async hooks are properly prepared so that things work in an interactive debug session -- at least in vscode. See #2700 However, there are many other bare `import 'ses';` occurrences in endo. How many for of these need to `import '@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` in `ses`, perhaps as a repair, so all existing `import '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 than `import '@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 to `import '@endo/init';` because of the other things bundled into `@endo/init`. ### Upgrade Considerations I think none. ***Reviewers: please double check me on this.***
2 parents 82dc112 + 52c97f3 commit fbd97e7

File tree

6 files changed

+6
-14
lines changed

6 files changed

+6
-14
lines changed

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@endo/exo": "workspace:^",
4040
"@endo/far": "workspace:^",
4141
"@endo/import-bundle": "workspace:^",
42+
"@endo/init": "workspace:^",
4243
"@endo/lockdown": "workspace:^",
4344
"@endo/pass-style": "workspace:^",
4445
"@endo/patterns": "workspace:^",

packages/cli/src/endo.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
/* eslint-disable no-await-in-loop, no-bitwise, no-throw-literal */
44

55
// Establish a perimeter:
6-
import 'ses';
7-
import '@endo/eventual-send/shim.js';
8-
import '@endo/lockdown/commit.js';
6+
import '@endo/init';
97

108
import fs from 'fs';
119
import url from 'url';

packages/daemon/src/daemon-node.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
/* global process */
33

44
// Establish a perimeter:
5-
import 'ses';
6-
import '@endo/eventual-send/shim.js';
7-
import '@endo/promise-kit/shim.js';
8-
import '@endo/lockdown/commit.js';
5+
import '@endo/init';
96

107
import crypto from 'crypto';
118
import net from 'net';

packages/daemon/src/worker-node.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
/* global process */
33

44
// Establish a perimeter:
5-
import 'ses';
6-
import '@endo/eventual-send/shim.js';
7-
import '@endo/promise-kit/shim.js';
8-
import '@endo/lockdown/commit.js';
5+
import '@endo/init';
96

107
import fs from 'fs';
118
import url from 'url';

packages/daemon/test/endo.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
/* global process */
33

44
// Establish a perimeter:
5-
import 'ses';
6-
import '@endo/eventual-send/shim.js';
7-
import '@endo/lockdown/commit-debug.js';
5+
import '@endo/init/debug.js';
86

97
import test from 'ava';
108
import url from 'url';

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ __metadata:
374374
"@endo/exo": "workspace:^"
375375
"@endo/far": "workspace:^"
376376
"@endo/import-bundle": "workspace:^"
377+
"@endo/init": "workspace:^"
377378
"@endo/lockdown": "workspace:^"
378379
"@endo/pass-style": "workspace:^"
379380
"@endo/patterns": "workspace:^"

0 commit comments

Comments
 (0)