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

Improve fastboot debugger/repl experience #15321

Merged
merged 1 commit into from
Jun 2, 2017
Merged

Improve fastboot debugger/repl experience #15321

merged 1 commit into from
Jun 2, 2017

Conversation

stefanpenner
Copy link
Member

FactoryManager debug proxy and nodes formatValue don't play nicely. Basically, we throw when they legitimately try to inspect these objects.

I'm not terribly happy with this solution, we can likely improve it. Maybe we should chat with the node folks to get there pulse on this...

Original issue (this fixes) was from @locks -> stefanpenner/ember-console#8

Log:

TypeError: Cannot convert a Symbol value to a string
> app.instance
TypeError: Cannot convert a Symbol value to a string
    at Object.get (/Users/ricardomendes/src/--ember/ember-cli-developer-tools/dist/assets/vendor/ember/ember.debug.js:9750:1)
    at formatValue (util.js:362:37)
    at formatProperty (util.js:822:15)
    at util.js:681:12
    at Array.map (native)
    at formatObject (util.js:680:15)
    at formatValue (util.js:620:16)
    at formatProperty (util.js:822:15)
    at util.js:681:12
    at Array.map (native)
    at formatObject (util.js:680:15)
    at formatValue (util.js:620:16)
    at formatProperty (util.js:822:15)
    at util.js:681:12
    at Array.map (native)
    at formatObject (util.js:680:15)
    at formatValue (util.js:620:16)
    at Object.inspect (util.js:203:10)
    at REPLServer.self.writer (repl.js:459:19)
    at finish (repl.js:584:38)
    at REPLServer.defaultEval (repl.js:377:5)
    at bound (domain.js:280:14)
    at REPLServer.runBound (domain.js:293:12)
    at REPLServer.eval (/Users/ricardomendes/src/--ember/ember-cli-developer-tools/node_modules/await-outside/index.js:136:29)
    at REPLServer.onLine (repl.js:536:10)
    at emitOne (events.js:96:13)
    at REPLServer.emit (events.js:191:7)
    at REPLServer.Interface._onLine (readline.js:241:10)
    at REPLServer.Interface._line (readline.js:590:8)
    at REPLServer.Interface._ttyWrite (readline.js:869:14)
    at REPLServer.self._ttyWrite (repl.js:609:7)
    at ReadStream.onkeypress (readline.js:120:10)
    at emitTwo (events.js:106:13)
    at ReadStream.emit (events.js:194:7)
    at emitKeys (internal/readline.js:402:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (readline.js:980:36)
    at emitOne (events.js:96:13)
    at ReadStream.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at ReadStream.Readable.push (_stream_readable.js:136:10)
    at TTY.onread (net.js:561:20)

@@ -190,6 +190,13 @@ function wrapManagerInDeprecationProxy(manager) {
if (HAS_NATIVE_PROXY) {
let validator = {
get(obj, prop) {
// make work with node's formatValue
if (!(prop in obj)) { return ; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will obviously now fail if any of the following are actually defined on obj

  • Symbol(util.inspect.custom)
  • Symbol(Symbol.toStringTag)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option, is to never trap:

  • any symbol
  • toString

@@ -190,7 +190,10 @@ function wrapManagerInDeprecationProxy(manager) {
if (HAS_NATIVE_PROXY) {
let validator = {
get(obj, prop) {
if (prop !== 'class' && prop !== 'create') {
if (typeof prop === 'symbol') { return obj[prop]; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think never trapping symbols is perfectly good.

@@ -190,7 +190,10 @@ function wrapManagerInDeprecationProxy(manager) {
if (HAS_NATIVE_PROXY) {
let validator = {
get(obj, prop) {
if (prop !== 'class' && prop !== 'create') {
if (typeof prop === 'symbol') { return obj[prop]; }
if (prop === 'inspect') { return undefined; /* for nodes formatter */ }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not happy about this one though...

@rwjblue
Copy link
Member

rwjblue commented Jun 2, 2017

I am not convinced we need to continue trapping get now that there is no lookupFactory (and therefore no double extend). I believe that trapping the set provides enough feedback around "don't do the bad thing"...

@stefanpenner
Copy link
Member Author

I am not convinced we need to continue trapping get now that there is no lookupFactory (and therefore no double extend).

That would greatly simplify this for-sure. As of what version do you feel comfortable dropping the get trap?

@rwjblue
Copy link
Member

rwjblue commented Jun 2, 2017

As of what version do you feel comfortable dropping the get trap?

We should land your current PR (basically blackholing all symbols and "inspect") directly into beta branch with [BUGFIX release] (for Ember 2.13.x and Ember 2.14.0-beta.x release), and then remove the get trap completely on master.

FactoryManager debug proxy and nodes formatValue don't play nicely. Basically, we throw when they legitimately try to inspect these objects.

I'm not terribly happy with this solution, we can likely improve it. Maybe we should chat with the node folks to get there pulse on this...

Original issue (this fixes) was from @locks -> stefanpenner/ember-console#8

Log:
<details>
  <summary>TypeError: Cannot convert a Symbol value to a string</summary>

```
> app.instance
TypeError: Cannot convert a Symbol value to a string
    at Object.get (/Users/ricardomendes/src/--ember/ember-cli-developer-tools/dist/assets/vendor/ember/ember.debug.js:9750:1)
    at formatValue (util.js:362:37)
    at formatProperty (util.js:822:15)
    at util.js:681:12
    at Array.map (native)
    at formatObject (util.js:680:15)
    at formatValue (util.js:620:16)
    at formatProperty (util.js:822:15)
    at util.js:681:12
    at Array.map (native)
    at formatObject (util.js:680:15)
    at formatValue (util.js:620:16)
    at formatProperty (util.js:822:15)
    at util.js:681:12
    at Array.map (native)
    at formatObject (util.js:680:15)
    at formatValue (util.js:620:16)
    at Object.inspect (util.js:203:10)
    at REPLServer.self.writer (repl.js:459:19)
    at finish (repl.js:584:38)
    at REPLServer.defaultEval (repl.js:377:5)
    at bound (domain.js:280:14)
    at REPLServer.runBound (domain.js:293:12)
    at REPLServer.eval (/Users/ricardomendes/src/--ember/ember-cli-developer-tools/node_modules/await-outside/index.js:136:29)
    at REPLServer.onLine (repl.js:536:10)
    at emitOne (events.js:96:13)
    at REPLServer.emit (events.js:191:7)
    at REPLServer.Interface._onLine (readline.js:241:10)
    at REPLServer.Interface._line (readline.js:590:8)
    at REPLServer.Interface._ttyWrite (readline.js:869:14)
    at REPLServer.self._ttyWrite (repl.js:609:7)
    at ReadStream.onkeypress (readline.js:120:10)
    at emitTwo (events.js:106:13)
    at ReadStream.emit (events.js:194:7)
    at emitKeys (internal/readline.js:402:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (readline.js:980:36)
    at emitOne (events.js:96:13)
    at ReadStream.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at ReadStream.Readable.push (_stream_readable.js:136:10)
    at TTY.onread (net.js:561:20)
```
</details>
@stefanpenner stefanpenner changed the base branch from master to beta June 2, 2017 19:25
@stefanpenner
Copy link
Member Author

@rwjblue done

@stefanpenner
Copy link
Member Author

@rwjblue #15323 for master

@rwjblue rwjblue merged commit 23e2202 into beta Jun 2, 2017
@rwjblue rwjblue deleted the fastboot-niceness branch June 2, 2017 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants