Skip to content

Regression in 3.13: multiple arguments in use:action #3923

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

Closed
ItalyPaleAle opened this issue Nov 14, 2019 · 8 comments
Closed

Regression in 3.13: multiple arguments in use:action #3923

ItalyPaleAle opened this issue Nov 14, 2019 · 8 comments
Labels

Comments

@ItalyPaleAle
Copy link
Contributor

ItalyPaleAle commented Nov 14, 2019

Starting 3.13.0, Svelte introduced a regression that broke use:action when there are more than 1 argument being passed.

See ItalyPaleAle/svelte-spa-router#59

You can see the REPL here, and open the console to see the result:

@Conduitry
Copy link
Member

If this once worked, it was by accident. The docs have never mentioned a syntax for passing multiple arguments. You can use a single array or object to pass multiple things to an action.

I imagine this changed in 3.13 because of the switch to AST-based rather than string-based code generation in the compiler. "hello", "world" is now getting more correctly handled as a sequence expression, which evaluates to the final expression in the sequence. If you look at the generated code, you can see how this is being called: test_action = test.call(null, span, ("hello", "world")) || ({}); As of 3.13, the parentheses are added around ("hello", "world") so it properly becomes one argument.

@ItalyPaleAle
Copy link
Contributor Author

ItalyPaleAle commented Nov 14, 2019

Thanks for the context. You’re right that it wasn’t a documented behavior and I am not sure why it was working in the first place.

I will update my router, then. I am just a bit disappointed that I’ll have to release a breaking change, just like svelte 3.13 had an (unintentional) breaking change that happened on a minor release.

Given how Svelte is growing and its ecosystem is expanding, might it make sense to start building a “canary in the goldmine” test suite to avoid issues like these in the future? For context: https://github.com/nodejs/citgm

@tanhauhau tanhauhau changed the title Regression in 2.13: multiple arguments in use:action Regression in 3.13: multiple arguments in use:action Nov 14, 2019
@tanhauhau
Copy link
Member

updated the title, you meant 3.13 right?

@ItalyPaleAle
Copy link
Contributor Author

Yes I’m very sorry. The post said 3.13 but I made a typo in the title

@Conduitry
Copy link
Member

I'm not sure having a CITGM suite is something that I'd be ready to embrace. If we'd had one in place, and your library happened to be one of the libraries being used, then - what? We wouldn't have been allowed to fix this bug? We'd have to document it as it's now been forced to be considered a feature?

CITGM suites likely make sense for something like Node - where the user base is so vast, and there are often many layers of abstraction between a user and some library using a potentially undocumented feature/bug, and where planned breaking changes happen every six months - but I don't think I'd want one here.

@ItalyPaleAle
Copy link
Contributor Author

A CITGM would help developers that are working on the ecosystem as well as end users. The idea isn’t that bugs wouldn’t be fixed, but that we would be able to spot issues downstream more easily and give advanced warning to maintainers so they don’t have to find themselves fighting fires.

In this specific case, I learnt about the breaking change because one user reported the issue on my repo. I expect that others were impacted before but didn’t bother reporting the issue, so there’s been a delay. It took me a day to acknowledge the issue and open this one upstream. I now know I need to make a new release, but I won’t be able to work on this until the weekend (I don’t work as developer in my full-time job and I’m on business travel this week). Of course, this is now a high-priority fire I need to deal with that is impacting my users.

With a CITGM, ideally we would have been notified days (if not weeks) ago. I would have been able to work on a new release at a more comfortable pace, making sure the new code was published before the Svelte update came out. The experience for downstream developers would be much better.

The CITGM can also be used to identify accidental breaking changes and consider wether they should require an update in the major version number as per semver. In this case, the breaking change was on un-document behavior so I’m not sure if it would qualify for a major version update, but there might be other situations where the issue is more real.

Just my .02. Agree Svelte isn’t Node yet, but we are a growing community :)

@pngwn
Copy link
Member

pngwn commented Dec 14, 2019

I don't think this is really practical.

Firstly, it is down to library authors to ensure that they are using Svelte APIs correctly, undocumented or internal APIs are not public in my view and could change at any moment. If authors choose to use them, then that is on them.

Secondly, you wouldn't have got as much time as you think. We cut new releases relatively often and you might have got a few days notice at best. Hardly much of an improvement.

@ghost
Copy link

ghost commented Dec 14, 2019

Our CI test workstream works pretty well and it's almost trivial effort to write, debug, and publish new ones without a whole lot of bootstrapping. I've straightened out some of the tests for bugs that escaped into the wild and plan to do a major sweep in a week or two.

I'd rather put any efforts into expanding what already works, personally.
Also, nothing is stopping library maintainers from cloning the Svelte CI process and running their own tests in addition to ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants