Skip to content
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

[object Object] obscure form in xsnap console #3844

Closed
dckc opened this issue Sep 17, 2021 · 7 comments · Fixed by #3856
Closed

[object Object] obscure form in xsnap console #3844

dckc opened this issue Sep 17, 2021 · 7 comments · Fixed by #3856
Assignees
Labels
bug Something isn't working devex developer experience xsnap the XS execution tool

Comments

@dckc
Copy link
Member

dckc commented Sep 17, 2021

Describe the bug

In un-redacted console messages, our xsnap console shim prints [object Object] where we're used to more detail from the node.js console.

Error#4: Withdrawal of [object Object] failed because the purse only contained [object Object]

To Reproduce

for example: Agoric/testnet-load-generator#30

Expected behavior

something more like inspect.

or perhaps assert.quote from SES?

Platform Environment

  • what version of the Agoric-SDK are you using? d48e6a7

Additional context

originally discussed in Agoric/testnet-load-generator#30

cc @kriskowal @katelynsills @mhofman

@dckc dckc added bug Something isn't working devex developer experience xsnap the XS execution tool labels Sep 17, 2021
@dckc dckc self-assigned this Sep 17, 2021
@kriskowal
Copy link
Member

This probably requires a virtual-terminal console emulation backed by print to run inside XS. I believe ava has one and there is a util shim. We may need to find and use the lightest of these options.

@kriskowal
Copy link
Member

We may also have to adapt an existing one to XS or adapt XS to provide process.stderr. We should also not have console.log going to stdout like the Node.js prior-art.

@dckc
Copy link
Member Author

dckc commented Sep 17, 2021

virtual-terminal? process.stderr? I am not following at all.

assert.quote() seems like The Right Thing, to me.

@kriskowal
Copy link
Member

If quote transpires not to be the right thing, as it won’t in every case, the underlying object should still be rendered in a useful way thru the powerful console in the start compartment, and in that case, we’ll want a more expressive console. Perhaps not so far as using one that does TV100 like Node.js, but one that at least renders like quote.

@dckc
Copy link
Member Author

dckc commented Sep 17, 2021

In what case will assert.quote not be the right thing? Can't we just decide that it is correct?

@kriskowal
Copy link
Member

assert.quote should not be used if the underlying value should not be revealed to intermediate stack frames, and may be revealed to the powerful console.

@dckc
Copy link
Member Author

dckc commented Sep 17, 2021

I meant this issue to be only about un-redacted console messages. I clarified the description.

My suggestion is not that the caller of console.log() should use assert.quote in the situation in question, but that assert.quote might replace the implementation of the actual console in our console shim, which is currently an ad-hoc combination of whatever XS's print does with some .toString() calls and exception catching.

dckc added a commit that referenced this issue Sep 21, 2021
…3856)

fixes #3844

* test(xsnap): xsnap console formats complex objects nicely
* refactor(xsnap): factor bootSESWorker out of several tests

Co-authored-by: Mark S. Miller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working devex developer experience xsnap the XS execution tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants