Skip to content

Barback should allow secondary inputs to be overwritten #14554

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
nex3 opened this issue Oct 28, 2013 · 7 comments
Closed

Barback should allow secondary inputs to be overwritten #14554

nex3 opened this issue Oct 28, 2013 · 7 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@nex3
Copy link
Member

nex3 commented Oct 28, 2013

Right now, if a transformer reads a secondary input and emits an output with the same name, that's considered an error, since the output conflicts with the pass-through version of that asset. This should instead be allowed as long as the output asset is read by the transformer as a secondary input (it's already allowed for primary input, since those are consumed and rendered unavailable).

@lrhn
Copy link
Member

lrhn commented Jan 14, 2014

Removed Area-Library label.
Added Area-Pkg label.

@anders-sandholm
Copy link
Contributor

Removed Library-Barback label.
Added Pkg-Barback label.

@munificent
Copy link
Member

Merging this with 16612. I think the way this will work is that if a transformer explicitly consumes a secondary input, then it won't be an error to output an asset with that ID.

If it doesn't exclude that input, I think by default that should be an error to make sure the user knows the transformer is stepping on something.


Added Duplicate label.
Marked as being merged into #16612.

@nex3
Copy link
Member Author

nex3 commented Feb 13, 2014

I don't think this should be marked as a duplicate. We don't know without diving in whether the fix for issue #16612 will fix this automatically or not -- it's very possible this will require some additional support.

If it doesn't exclude that input, I think by default that should be an error to make sure the user knows the transformer is stepping on something.

I disagree. I think if a user has requested something as a primary or secondary import, they should be allowed to overwrite it without explicitly consuming it. Otherwise I think we're imposing a bunch of unnecessary busywork on common transformer cases.


Added Triaged label.
Marked as being merged into #.

@nex3
Copy link
Member Author

nex3 commented Feb 14, 2014

After some thought, we've decided not to support this. It broke several important guarantees that Barback would otherwise offer. From my email to Bob:

Right now Barback has two very nice properties which are mutually incompatible
with either consuming or overwriting secondary inputs. The first nice property
is that when a user requests an asset, they don't need to wait for the entire
world to build; they just need to wait for that asset. The second is that if a
user makes a change and requests an asset affected by that change, that
request will block until the requested asset is available.

Now, suppose we allow secondary inputs to be overwritten. You have some
intermediate phase with inputs A and B, and a transformer T for which A is
primary. Now suppose A changes, and we start to re-run T. We're faced with a
choice: do we mark B as dirty?

If we don't mark B as dirty, any requests to B (or anything generated using B)
will continue to succeed while T is chugging along. If T then decides to use B
as a secondary input and overwrite it, those requests will have served stale
data -- this violates the property #­2 above and forces the user to constantly
refresh the page to get the latest version of their app.

On the other hand, if we do mark B as dirty, then if T doesn't overwrite B it
will have been marked dirty and then available again despite no changes. This
will cause every transform using B to re-run itself. On a large scale, it will
mean that any change to any file will effectively require a re-compilation of
the entire package in which that file resides.

Both of these are serious usability issues for user that reach beyond just
transformers that want to overwrite secondary inputs. We should take a close
look at the use-cases for this sort of overwriting and see if we can come up
with a way of addressing them that has less troublesome consequences.

We discussed use-cases and alternatives and decided that there aren't any critical use-cases that require this functionality. The most concrete use-case we have is of a spriting transformer that wants to remove all the PNGs that it used to construct a sprite, but issue #4 should address that case sufficiently.


Added WontFix label.

@nex3
Copy link
Member Author

nex3 commented Mar 26, 2014

Issue #17843 has been merged into this issue.

@DartBot
Copy link

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/barback#17.

@kevmoo kevmoo added closed-not-planned Closed as we don't intend to take action on the reported issue and removed priority-unassigned labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

6 participants