I believe this is different than #1451056: [policy] How to handle unforeseen diversion of Symfony code in stable/API-locked Drupal core? (which is very Symfony-specific), but it's definitely related. I wanted to discuss this topic in the context of some recent issues. (Not picking on any of these projects specifically, but they present valid use cases.)

Sometimes, you find bugs in upstream libraries. And sometimes, despite supplying a fix right away with these upstream libraries, that fix can languish for days/weeks/months. For any number of reasons. Often because our project is very different than other projects that use those upstream libraries (our audience is in general less technical, our modular architecture might stretch these libraries outer boundaries of what they were intended to do, etc.)

So you have a few choices in this scenario:

1) Sit and wait until the upstream patch is committed. That's what we did with #2138867: Allow dangling commas in annotations. Since it wasn't critical, merely extremely aggravating, we lived with that. It was eventually merged in after about 3 months, though I think mostly because chx chose to publicly chastise them on Twitter and then some Drupalistas went in and started pig-piling in that issue. I'd love us not to get into the habit of doing this, since it does not make us very collaborative. :\

2) Make the fix to Drupal and then hope that upstream eventually pulls it in. That's what we did with #2151829: Doctrine annotation parsing takes an unacceptable amount of time/memory on install, and what we will probably do with #2083547: PSR-4: Putting it all together if PSR-4 moves forward (assuming Composer doesn't beat us to figuring out what we want to do). In these cases, the impact on Drupal is quite significant, so it makes sense to move forward while we wait for upstream.

I think those two paths are basically fine: evaluate the "criticality/impact" of a given fix, then choose one or the other path.

However, for path #2, we've started down this road e.g. in #2151829: Doctrine annotation parsing takes an unacceptable amount of time/memory on install of linking to individual developers' sandboxes on Github as the "authoritative" source for these libraries. However, this does not seem like a wise precedent to go with long-term, because:

- The core maintainers can't commit to those repos to make other changes we might need.
- It's probably not good for people who like to blitz vendor and build from composer from scratch to have those sources changing on them (not sure about this one)
- If such a developer "rage quits" the project, or their cat goes tromping over their keyboard one evening, they could presumably take the entire repo down with them, leaving core in a state unable to build the next time we go to update composer.js. (such as right before a release)

It seems like we might be better off with e.g. drupal.org/project/drupal_vendor (or some similar thing) to hold these types of forks, which has the same commit access as core does. I'm not sure if we could collabroate as easily with Github-hosted projects that way, though. If it needs to be on Github to collaborate on Github PRs, then perhaps we could re-purpose https://github.com/drupal for that? (We'd need the core maintainers to get access to that.)

Another approach is sub-classing the specific code in question. Mark Sonnabaum seemed to think that this was a good thing to do for any "public-facing" library code. I'm not quite sure how to distinguish public-facing versus internal-facing since each of these projects are fairly ambiguous in their use, but another approach worth considering. If the main things (e.g. autoloader, annotation parser, etc.) were already sub-classed, it'd be trivial to add our own code when necessary. However, dawehner voiced concerns that this would be less collaborative; effectively amounting to "hacking core" and harder to submit / pull back in upstream fixes.

Not sure what the answers are, but figured I'd start the discussion. :)

Comments

klausi’s picture

Please also note that if we host those forks on drupal.org then the produced patches are automatically GPLv2+, which you can only contribute back upstream to MIT-licensed projects if all people involved in writing the patch approve/consent.

So keeping the forks on github under their original license sounds like a less painful approach.

webchick’s picture

That's a very good point! github might be the way to go then, since they don't discriminate.

Crell’s picture

I was going to say what Klausi said. Hosting forks on d.o is a total no-go from a licensing-safety standpoint.

The correct, IMO, approach is for Dries et al to get control of https://github.com/drupal, and we put our "local" forks there. Access can be handled however we want, and we can even file the PRs to upstream directly from the exact code we're using. Then we twiddle our composer.json file as needed.

I would say that's superior to just monkey-patching the in-repo vendor directory in all circumstances.

Note that this also remains exactly the same if we ever get around to taking the vendor libs back out of the main repository the way we should. :-)

Composer itself is a bit of an oddball, and right now the plan is basically the "subclass" strategy. I don't expect that to be typical, though, since other than PSR-4 support I don't think there's any Composer variation we'd need to think about, plus it's not "in" our code base in the first place, per se.

webchick’s picture

So how would the mechanics of that work? https://github.com/drupal/doctrine, https://github.com/drupal/composer, etc?

catch’s picture

@webchick yes something like that. That'd let us pull in PRs from for example dawhener's fork, then have an 'official' upstream PR where follow-ups etc. could be handled centrally. And at the same time we'd be running the fork in core.

Also allows to run two patches at once (say we'd needed to hotfix both the tokenize change and trailing commas at the same).

IMO this needs to be reserved for critical bugs, because it's going to be tricky to keep track of multiple different PRs and forks, and we should concentrate efforts on getting the upstream fixes merged. But clearly there's going to be issues which are very critical for us, and less for others, and it's good to have something in place to handle it.

I think there's a much older issue about this somewhere, but couldn't find it.

Crell’s picture

Agreed that an upstream fork should be for exceptional cases, such as major performance changes (as in the most recent case), 0-day security issues (where we can't wait for upstream because it's already known), etc. Most of the time we should just work upstream and be polite but pushy about getting things merged. :-)

We could also give extra access to particular repos, so if we wanted to, e.g., give dawehner access to our doctrine fork to manage the PR, that can be done temporarily on GitHub without any impact on d.o's security or access settings.

kim.pepper’s picture

I'm in favour of Crell's suggestion in #3.

chx’s picture

Where we host is a red herring. This "get off the island" thing totally failed. The upstream projects stall us or move to new pastures and refuse to help us. The licenses are very permissive. We should take the (small) pieces from Doctrine Commons and Annotation we use, move it under the core/lib/Drupal folder -- we could, for example, finish the optimization and skip tokenizing altogether.

We should move phpunit in too. At this point, I literally can't write a strict mode (where method calls without expectations set on them cause failures) within our process because despite phpunit supports the necessary templating one needs to put the template in the phpunit directory itself and I am told the vendors directory is hands off. This morning the phpunit lead refused to work with us with something as small as dropping the PHPunit 3.8 requirements from 5.4.7 to 5.4.4 and instead will likely go 5.5 making it downright impossible to use 3.8 for D8 so we are left to our own devices.

In short: any other project that doesn't cooperate in a timely manner should be moved from vendors to lib.

Crell’s picture

Taking a bullying approach won't help us in the long run...

Next step here: Who wants to reach out to see about getting the GitHub group transferred?

chx’s picture

What "bullying approach"? What's the point of adding maintenance burden for core committers of having to commit to multiple repositories? For the (real) enhancements listed in #8 we would need to fork those projects and if we need to fork why not fork into core and simplify?

Crell’s picture

1) We want to un-fork later, in most if not all cases. We're talking about temporary measures here, not total divorces.

2) These are stand-alone libraries. Keeping them as such forces us to think of them as such. Separation of concerns in the infrastructure helps reinforce separation of concerns in software design, which is an area Drupal 8 tries to get much better at.

tim.plunkett’s picture

pfrenssen’s picture

I agree with #12, it should not be more complicated than that.

In that issue @dawehner hosted the fork on his github account. This might be better in a self hosted repo on git.drupal.org though, so that it is managed by the drupal association rather than by a volunteer.

dawehner’s picture

Yeah I should have made a mirror on git.drupal.org though due to the fact that basically al the outside world is using github we will work with them via github forks.

dawehner’s picture

In general I did not had any bad experience yet while working with other projects: symfony-CMF/symfony/doctrine. We tend to overthink the problem here.

catch’s picture

I don't really mind if the forks are on github - it means we can have upstream pull requests from those same forks if we want.

I do think it'd be better if there's a Drupal organisation on github - especially for situations where we need to have two concurrent changes to the same library and etc, and it'll be easier for people looking through composer to tell why we're using a fork if they don't know who dawehner is.

Crell’s picture

There is a Drupal organization on github, owned by mikl. (Danish Drupal dev in good standing.) Can one of the committers just ping him and point to this issue, asking for ownership?

kim.pepper’s picture

I saw that dawehner pinged him on twitter. https://twitter.com/mikl/status/425877106032406528

mikl: @da_wehner hand over? Do you think I stole it or something? It is (of course) available to the community if the devs want to use it.

kim.pepper’s picture

Sorry, shouldn't have posted just one bit of the conversation out of context. It was quite amicable, and Mikl later said:

mikl: @da_wehner yeah, or perhaps the DA. If they want it, they can have it, no problem.

webchick’s picture

It would be really weird IMO to give the DA control over the Drupal project account on Github. It should most likely go to Dries.

webchick’s picture

Also, can mikl maybe comment here, vs. having a conversation on Twitter which will vanish in a day?

kim.pepper’s picture

Looks like this is he https://drupal.org/user/58679

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

klausi’s picture

Status: Active » Fixed

3 years later and we didn't run into big problems with this. Most of the time we got upstream fixes in time, rarely we used personal forks on Github.

So the conclusion of this issue is that we will continue to use temporary personal forks on Github for the rare cases.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.