-
Notifications
You must be signed in to change notification settings - Fork 217
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
Thread stack traces to console, add entangled assert #1884
Conversation
@kriskowal , As a result of the 2nd commit I am getting the following error everywhere. Looks to me like some packager is turning some esm into cjs with
|
packages/assert/src/assert.js
Outdated
/* | ||
// TODO Somehow, use the `assert` exported by the SES-shim | ||
import { assert } from 'ses'; | ||
import { assert } from 'ses/src/error/assert'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work and we do not expect to make it work without making ses/assert
part of the public API. The reason is the opposite of what you describe.
RESM operates by lowering all modules down to CommonJS (whereas SES Compartment lifts all modules up to the level of ECMAScirpt modules).
When an RESM reaches for ses
, it gets a version of SES that was compiled down CommonJS by Rollup. When it reaches for ses/src/error/assert[.js]
it gets the original source, RESM compiles it down to CommonJS, Node.js attempts to load the resulting .js
file, but since SES has {"type": "module"}
, it is expecting that file to be in ESM format, not CJS.
It should be sufficient to import ses
and use the globalThis.assert
here. If we need to reach for the module from source, we will have to add ses/assert
to the exported modules of SES and add build rules for Rollup.
522fc8e
to
9138d06
Compare
@kriskowal |
@warner I need to understand |
The best option is probably to use “npm pack” to make a tarball of SES,
check that into SDK, and yarn add the archive with a file URL.
See
https://classic.yarnpkg.com/en/docs/cli/add/
…On Mon, Oct 19, 2020 at 8:12 PM Mark S. Miller ***@***.***> wrote:
@kriskowal </~https://github.com/kriskowal>
Of course with the first commit hardwiring things to paths on my local
file system, nothing passes under CI. Is there any way to get things
working under CI ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1884 (comment)>,
or unsubscribe
</~https://github.com/notifications/unsubscribe-auth/AAAOXBXGMJ54CF5HEJLZUP3SLT5YLANCNFSM4SWTAXKA>
.
|
59987cd
to
c6cc1a6
Compare
504aab1
to
cad0634
Compare
* @param {*} syscall Vat's syscall object, used to access the `vatstoreGet` | ||
* and `vatstoreSet` operations. | ||
* @param {() => number} allocateExportID Function to allocate the next object | ||
* export ID for the enclosing vat. | ||
* @param valToSlotTable {*} The vat's table that maps object identities to their | ||
* corresponding export IDs | ||
* @param m {*} The vat's marshaler. | ||
* @param cacheSize {number} How many virtual objects this manager should cache | ||
* export ID for the enclosing vat. | ||
* @param {*} valToSlotTable The vat's table that maps object identities to | ||
* their corresponding export IDs | ||
* @param {*} m The vat's marshaler. | ||
* @param {number} cacheSize How many virtual objects this manager should cache | ||
* in memory. | ||
* | ||
* @returns a new virtual object manager. | ||
* @returns {*} a new virtual object manager. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FUDCo I adjusted this to appease the linter. It appears to have become more picky.
I’m recusing myself as a reviewer, since I’m now a coäuthor. @michaelfig Perhaps we can get your review, particularly for the TS changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
In case we have to revert this PR, please ensure that you Squash and Merge. Then, since the yarn.lock
change is included, we will go back to the old implementation without having to pin anything explicitly.
This change upgrades Agoric SDK packages to use the new SES 0.11.0, which includes the newly entangled Error, assert, and console objects, which collectively hide error details including the stack from callers, while safely revealing them to the console.
To facilitate this, the implementation of the
@agoric/assert
package shifts into SES, while the package remains useful as a vehicle for TypeScript definitions. All compartments that use@agoric/assert
must now be endowed with the globalassert
.Much of this change is mechanical, except for the
assert.js
module itself which may benefit from closer review.