-
Notifications
You must be signed in to change notification settings - Fork 252
Description
The @endo/errors package assumes that globalThis.assert is the unstructured assert created by the ses package's assert.js module. @endo/errors uses that to build and export a more structured assert which it exports by that name, together with some other exports (e.g., makeError, annotateError) which it derives from the unstructured globalThis.error which it finds. Fortunately, @endo/errors does a sanity check on the globalThis.assert it finds to see if it seems to be the unstructured assert it assumes.
However, attempts to fix #5672 immediately starting running into problems like https://github.com/Agoric/agoric-sdk/actions/runs/9068381384/job/24918442236?pr=8332 with the tell-tale error message
Cannot initialize @endo/errors, missing globalThis.assert methods error, note, details, Fail, quote, makeAssert
These missing methods are exactly the method @endo/errors expects on the unstructured assert is uses and absent on the structured assert it exports. The cause is that the modules gathering endowments for a new Compartment were using a top level assert variable to populate the assert property of the endowments, that then became the globalThis.assert in the spawned Compartment. When these modules were changed to obtain their top-level assert binding by importing it from the @endo/errors module, they changed the assert they were endowing to the wrong assert.