-
Notifications
You must be signed in to change notification settings - Fork 72
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
Unable to import 'tape' v4 or v5 after lockdown #293
Comments
This is the override mistake. It is not an attempt to modify a primordial. The relevant code in callBind.js is module.exports = function callBind() {
return bind.apply($call, arguments);
};
module.exports.apply = function applyBind() {
return bind.apply($apply, arguments); This is merely trying to create an own At https://github.com/Agoric/SES-shim/blob/master/packages/ses/src/enablements.js is our whitelist of primordial properties for Try adding |
Repairing |
I think I ran into the identity-discontinuity problem when importing import { test } from 'tape';
import './install-ses.js';
function parse() {
throw TypeError('Error parsing');
}
test('parse', t => {
t.throws(parse, /Error parsing/, 'expected failure');
t.end();
}); fails with:
and I believe it's because |
I tried upgrading to
which feels like another instance of the override mistake, as tape is (for some reason I don't understand) replacing the error's (tape/lib/test.js around line 584) try {
fn();
} catch (err) {
caught = { error: err };
if (Object(err) === err && (!isEnumerable(err, 'message') || !has(err, 'message'))) {
var message = err.message;
delete err.message;
err.message = message;
}
} |
Is I see at https://github.com/Agoric/SES-shim/blob/23d21d185f3a6e067b44ae9f5652136916510efe/packages/ses/src/enablements.js#L78 that we repair We should add to the whitelist a repair of On the identity discontinuity, the only good solution is to load |
As you expand this whitelist, please continue the tradition of adding a comment saying what case triggered the need for each additional repair. |
Yes, I believe |
* disable typescript checking, which used a trick to swap 'harden' out for one that was annotated, but now 'harden' is a (frozen) global and cannot be swapped out like that * replace tape's t.throws with one from node's built-in 'assert' module, since tape's version is broken by the identity discontinuity that results from importing tape before lockdown() (and importing it *after* lockdown() runs into an override mistake problem, see endojs/endo#293 for details)
Adding |
Adding
I'm still investigating what it's trying to do. The code in 'use strict';
var defineProperties = require('define-properties');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var polyfill = getPolyfill();
defineProperties(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = polyfill; and it's the
The export of module.exports = function getPolyfill() {
if (!Object.assign) {
return implementation;
}
if (lacksProperEnumerationOrder()) {
return implementation;
}
if (assignHasPendingExceptions()) {
return implementation;
}
return Object.assign;
}; which means it's trying to modify properties of the (frozen) Feels like a shim gone wrong. |
Adding Still don't know how to make tape-5.0.0 work. |
This adds `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes, to the enablements list. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
This adds `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes, to the enablements list. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
This adds `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes, to the enablements list. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
This adds `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes, to the enablements list. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
This adds `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes, to the enablements list. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
This adds `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes, to the enablements list. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
This repairs the override mistake in `FunctionPrototype.apply`, as well as `.message` for all the various Error prototypes. This allows tape-4.x to be imported after lockdown, as well as fixing tape's t.throws() method. refs #293, but does not close it because tape-5.x is still broken
From the code you show, I think you diagnosed the tape 5 problem correctly. Is the following summary correct? This is not the override mistake. Rather, it is an attempt to directly modify a primordial in a way that is publicly visible, that modifies the primordial API surface in a way that does not serve to shim and proposed standard. Specifically, it will make the following properties visible on the If we are in a hurry to switch to tape 5, we should fork, repair, and then send them a PR citing our bug report. Otherwise we should just wait for them to fix the bug. |
Moved from "Backlog" to "Reassess" to determine whether we still care about Tape 5. |
cc @ljharb This is the issue that we encountered while using |
I just checked briefly, the same error is currently reported in both tape-4.13.3 and tape-5.0.1, running against ses-0.10.4
It looks like the specific assignment is happening in $ cat node_modules/es-abstract/helpers/callBind.js
'use strict';
var bind = require('function-bind');
var GetIntrinsic = require('../GetIntrinsic');
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
module.exports = function callBind() {
return $reflectApply(bind, $call, arguments);
};
module.exports.apply = function applyBind() {
return $reflectApply(bind, $apply, arguments);
}; |
In summary, we discussed this at the Agoric SES meeting, and we do care about about tape versions running under SES. |
I plan to publish a fixed |
Does the closing of ljharb/object.assign#79 mean we can now close this one too? Who wants to check? (Also, @ljharb , thanks for ljharb/object.assign#79 !) |
It should! I've published |
@warner @kriskowal I'm closing this as irrelevant, but reopen if I'm missing something or you disagree. |
This program:
when run against SES-0.7.7, with a
node_modules
that hastape-4.11.0
, fails like this:I tried disabling various taming options in
lockdown()
and it didn't help.I'm guessing that
tape
is using some module (es-abstract
?) which thinks it can modify the primordials. We could find a way to accomodate that, or find a way to make it stop.I'm able to import
tape
before lockdown, and tests seem to work normally, which is what I'll do for now. That makes it a 'vetted shim', though, and it's neither vetted nor a shim. Discuss.The text was updated successfully, but these errors were encountered: