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

[BUGFIX beta] Remove chaining in Observable.set #11213

Merged
merged 3 commits into from
Jun 15, 2015

Conversation

cibernox
Copy link
Contributor

Ignore this for now

@stefanpenner
Copy link
Member

yes please :P. Although I have no idea how to deprecate...

That being said, we can provide an add-on that restores this functionality for those who experience this as a pain point.

@cibernox
Copy link
Contributor Author

For consistency, this also has to be done with setProperties (and maybe something else).

I'd been trying hard to test this but I just ember s is just broken for me, it hangs forever. I've nombom'ed everything and I still don't know what's going on.

@stefanpenner
Copy link
Member

We may want to slide this into the current beta. If it turns out to cause lots of grief we can roll it back, but i suspect it wont, and for the ones who may, it is a mechanical change.

That way the 1.13 -> 2.0 upgrade statement of minimal pain remains true

@cibernox I'll look into your tests failure today.

@cibernox
Copy link
Contributor Author

I'm kind-of blocked on this because I can't run the tests locally. ember s just freezes forever without any error message, and I've tried usual suspects (nombom'ed everything) in node 0.10 and ember still fails in node12/iojs :(

I'll try to reinstall node itself. Have you heard of this before?

@stefanpenner
Copy link
Member

I'll try to reinstall node itself. Have you heard of this before?

currently you must still use node 0.10.35. Until we finish upgrading all the micro-libs to the latest transpiler.

@cibernox
Copy link
Contributor Author

So the problem can come from using 0.10.38 ?

@stefanpenner
Copy link
Member

Not a known problem.

The problem I am aware of is new node versions that have Symbols. Old traceur attempts to coerce them, which causes a hard crash.

Your problem appears in related?

@cibernox
Copy link
Contributor Author

No, that's the problem with node 0.12/iojs. My problem is that ember s just hangs with no error message (and the process seems to be idle)

@stefanpenner
Copy link
Member

No, that's the problem with node 0.12/iojs. My problem is that ember s just hangs with no error message (and the process seems to be idle)

i'll give it a try momentarily, just noming

@stefanpenner
Copy link
Member

Unfortunately, I could not reproduce your issues. Everything appears to boot :(

let me see if i can fix your test failures though

stefanpenner added a commit to stefanpenner/ember.js that referenced this pull request May 19, 2015
@stefanpenner
Copy link
Member

@cibernox for some reason i can't send you a PR, feel free to cherry-pick 48aad1d

@cibernox
Copy link
Contributor Author

I couldn't cherry-pick it either, but I applied the changes as a .patch file

@cibernox cibernox force-pushed the remove-set-chaining branch from 9703338 to dd52c66 Compare May 19, 2015 21:48
@cibernox
Copy link
Contributor Author

Failed in sauce, probably random

@stefanpenner
Copy link
Member

re-running

@stefanpenner
Copy link
Member

likely needs to be bugfix beta

@cibernox cibernox changed the title [WIP] Remove chaining in Observable.set [BUGFIX beta] Remove chaining in Observable.set May 19, 2015
@rwjblue
Copy link
Member

rwjblue commented May 20, 2015

Looks like tests are fixed up.

@stefanpenner - Have time for a final review?

@stefanpenner
Copy link
Member

@stefanpenner - Have time for a final review?

I'm good with this.

Lets bring it up at this weeks meeting.

@stefanpenner
Copy link
Member

resolution:

  • lets land it in this beta cycle
  • someone needs to write a static analysis to warn and report (@mmun may be interested)
  • blog post entry for the beta 1.13 Release Blog Post #11254
    • need to explain why
    • need to explain how to check + upgrade.

@cibernox
Copy link
Contributor Author

I'm very curious about the static analysis. I really don't see a reliable way of warn about this.

@stefanpenner
Copy link
Member

I'm very curious about the static analysis. I really don't see a reliable way of warn about this.

just the obvious

o.set().set() or
o.set().<anything>
o.setPropertyes().<anything>
var a = o.set();

@cibernox
Copy link
Contributor Author

@stefanpenner that analysis be done as part of the build process in ember-cli?

@mmun
Copy link
Member

mmun commented May 22, 2015

@cibernox Basically you want to write a babel transform that looks for .set()'s being used as a value, specifically you want to look for CallExpressions with callee.property.name === 'set' and whose parent node is not an ExpressionStatement.

@mmun
Copy link
Member

mmun commented May 22, 2015

@cibernox Yes, we'll build it into ember-cli, but likely also build a node module for non-ember-cli projects to use.

@cibernox
Copy link
Contributor Author

It's amazing the kind of things you can do with esprima. Completely dark magic to me.

@fivetanley
Copy link
Member

Maybe we could start an ES-lint plugin package for ember? http://eslint.org/docs/developer-guide/working-with-rules.html

@fivetanley
Copy link
Member

Ember Watson is also a great place to start if you're new to these kind of transforms using recast, but it sounds like we want a warning instead of an actual transformation. https://github.com/abuiles/ember-watson

@cibernox cibernox force-pushed the remove-set-chaining branch from dd52c66 to dfc31df Compare June 8, 2015 22:28
@cibernox
Copy link
Contributor Author

cibernox commented Jun 8, 2015

Rebased

@mixonic
Copy link
Member

mixonic commented Jun 11, 2015

@stefanpenner @cibernox @mmun is this going into beta? It would need to land asap. I'll happily doc it in the blog post, but I will need guidance.

@cibernox
Copy link
Contributor Author

This should go into beta to align ember get/set with regular ES5 getters/setters, the controversy here is how much of an issue is breaking backwards compatibility, since there's no easy way of deprecate this.

On the other hand, very very few people (if any at all) will be using such an awkward construct like obj.set('foo', bar).set('baz', qux).set('foobar', bazqux)

@mixonic
Copy link
Member

mixonic commented Jun 11, 2015

@cibernox master is currently 2.0- should it just go into 2.0 as a small breaking change?

@cibernox
Copy link
Contributor Author

Personally I'm ok with breaking changes in general as long as they are small and the upgrade path is properly documented.

@stefanpenner
Copy link
Member

i am +1

@mixonic
Copy link
Member

mixonic commented Jun 15, 2015

Merging this into beta (Ember 2.0)

mixonic added a commit that referenced this pull request Jun 15, 2015
[BUGFIX beta] Remove chaining in Observable.set
@mixonic mixonic merged commit 8f53f8e into emberjs:master Jun 15, 2015
@stefanpenner
Copy link
Member

👍

@rwjblue
Copy link
Member

rwjblue commented Jun 15, 2015 via email

@cibernox
Copy link
Contributor Author

Does this deserve an special entry somewhere in the website repo?

@mixonic
Copy link
Member

mixonic commented Jun 15, 2015

@cibernox I would just like to add it to the 2.0 "breaking changes" section of the blog post: emberjs/website#2212

rwjblue pushed a commit that referenced this pull request Jun 21, 2015
With #11213 having just been merged,
the bit about chaining in the docs became wrong.

This PR just deletes it and fixes up the specified return value (in the docs).

(cherry picked from commit 4cc6ab7)
@Kerrick
Copy link
Contributor

Kerrick commented Sep 15, 2016

This broke apps in the wild but still got merged, and the breaking change never got documented--not on the blog, not in the deprecations section, just a silent update to the API docs. I had to read the git the history of set_properties.js and track down these discussions. I'd still like to see this documented somewhere.

@Kerrick
Copy link
Contributor

Kerrick commented Sep 15, 2016

For those who come here after this, I've released an addon that undoes this change! Hope you find it useful: https://github.com/secondstreet/ember-observable-set-chaining

@cibernox
Copy link
Contributor Author

@Kerrick I'm sorry this wasn't documented properly. Maybe it's not too late to add a note in the 2.0 blog post.

Also, deprecate this functionality was almost impossible, since the only way of detecting chaining would be some sort of static code analysis.

However I'd discourage you to restore the old functionality with an addon. The same way this change broke your app, it's likely that undoing it will break addons in the wild, ending up in your app being broken anyway.

@cibernox
Copy link
Contributor Author

@Kerrick I've added a not as the very first line of the changelog for the 2.0 release with big a breaking label, so at least this is easier next time.

@Kerrick
Copy link
Contributor

Kerrick commented Sep 23, 2016

I've added a not as the very first line of the changelog for the 2.0 release with big a breaking label, so at least this is easier next time.

@cibernox Thank you! If anybody else besides us still hasn't upgraded to 2.X and they read the changelog, hopefully they won't be confused by this now. 👍

However I'd discourage you to restore the old functionality with an addon. The same way this change broke your app, it's likely that undoing it will break addons in the wild, ending up in your app being broken anyway.

Yeah, but the only way to find all instances of this to change them across our six Ember apps and 25K+ lines of JavaScript would be some sort of static code analysis. 😝

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.

7 participants