test coverage over bundles#11100
Conversation
Deploying agoric-sdk with
|
| Latest commit: |
ea9dcce
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://fe9fd11d.agoric-sdk.pages.dev |
| Branch Preview URL: | https://1817-bundle-coverage.agoric-sdk.pages.dev |
608f963 to
6f954ac
Compare
| moduleFormat: 'test', | ||
| [Symbol.for('exports')]: exports, | ||
| }); | ||
| id = `b1-test-exports-${Math.random()}`; |
There was a problem hiding this comment.
Interesting, this will also ensure that bundleAndInstall is only used from the privileged start compartment.
I'd like to emphasize this one. The next Endo version introduces a revamped bundler, and maintaining coverage through the endo sync will be invaluable for @kriskowal |
| // Copy all the properties so this object can be hardened. | ||
| const exports = { ...pathOrExports }; | ||
| return bundleTestExports(exports); |
There was a problem hiding this comment.
Does anyone harden the returned bundle?
There was a problem hiding this comment.
not presently.
If you think that's necessary I'd request that it be done in ^ so the current example code suffices:
https://github.com/endojs/endo/blob/84716b7fb874f790000b96953ef6fe194c4a2f85/packages/import-bundle/README.md?plain=1#L81-L82
There was a problem hiding this comment.
I think my question is can we get away with dropping the spread if no code would harden the bundle.
If there is such code, then my question for @kriskowal is whether bundleTestExports should create a getter for the Symbol.for('exports') property instead of a data property so that it's compatible with hardening? That should be a compatible change. It will not make the bundle passable but that is just not possible with this design.
There was a problem hiding this comment.
Given that this doesn't hurt, and is probably helpful (no-one should expect a live binding here), I'm ok with keeping the spread here.
addd80a to
64eb491
Compare
64eb491 to
65c6cf4
Compare
65c6cf4 to
6487f51
Compare
kriskowal
left a comment
There was a problem hiding this comment.
@turadg It’s fantastic we can get coverage analysis for contracts this way. Do you feel that, after this change, we still have an adequate canary for changes the contract that will only be evident if it’s bundled, like runtime censorship errors?
I’ve filed a work item for Endo, to make the bundler do a SES censorship simulation after transforms, such that the act of bundling in CI would detect that failure mode without having to execute the bundle.
endojs/endo#2756
That might be enough.
Yes, this is just letting us integrate with a fake Zoe and we have a more integration levels above this.
|
Catching early would still be better, so endojs/endo#2756 would be a nice to have |
| // Copy all the properties so this object can be hardened. | ||
| const exports = { ...pathOrExports }; | ||
| return bundleTestExports(exports); |
There was a problem hiding this comment.
I think my question is can we get away with dropping the spread if no code would harden the bundle.
If there is such code, then my question for @kriskowal is whether bundleTestExports should create a getter for the Symbol.for('exports') property instead of a data property so that it's compatible with hardening? That should be a compatible change. It will not make the bundle passable but that is just not possible with this design.
6487f51 to
ea9dcce
Compare
mhofman
left a comment
There was a problem hiding this comment.
Thanks for getting us this coverage!
| // Copy all the properties so this object can be hardened. | ||
| const exports = { ...pathOrExports }; | ||
| return bundleTestExports(exports); |
There was a problem hiding this comment.
Given that this doesn't hurt, and is probably helpful (no-one should expect a live binding here), I'm ok with keeping the spread here.
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks: You may have to fix your CI before adding the pull request to the queue again. |
| import { commonSetup } from '../supports.js'; | ||
|
|
||
| const dirname = path.dirname(new URL(import.meta.url).pathname); | ||
| import * as contractExports from '../../src/examples/stake-ica.contract.js'; |
There was a problem hiding this comment.
Why doesn't import path from 'path'; get dropped here and in most, if not all of these files?
There was a problem hiding this comment.
Because unused imports aren't automatically cleaned up. It's passing CI because there's no lint rule for it.
I would expect no-unused-vars to but it's not. typescript-eslint/no-unused-vars works but isn't worth the effort to adopt rn, imo. Maybe updating eslint will fix the built in one.
noUsedLocals in tsconfig would catch it but make it harder to work with jsdoc @import.
closes: #1817
Description
Code coverage for bundles in unit tests!
Security Considerations
none
Scaling Considerations
none
Documentation Considerations
none
Testing Considerations
per se
Upgrade Considerations
none