Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
cache system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 May 2015 at 08:43 UTC
Updated:
1 Jul 2015 at 07:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
catchGood idea.
Comment #2
mitalimehta commentedComment #3
wim leersThanks for taking this on, @mitalimehta!
Comment #4
mitalimehta commentedDrupalCon LA 2015
Comment #5
mitalimehta commentedFirst Patch for this issue with the Changes to Cache Contexts.
At DrupalCon LA 2015 Sprints
Comment #7
borisson_2 files that used a cache context but didn't have the new namespace in their use statements.
Comment #9
borisson_Looks like I forgot one.
Comment #11
borisson_The remaining fatal errors seem to work locally, hopefully testbot agrees.
Comment #13
borisson_I can't seem to reproduce the current errors locally when running tests.
Comment #14
rbayliss commentedLooks like some mocked objects were missed in the conversion. Hopefully this fixes the failures.
Comment #15
wim leersPlease reroll with
git diff -M10%, that records these moves as … moves, instead of deletions/additions. Will make this patch a hundred times easier to review.Comment #16
joshi.rohit100Rerolled
Comment #17
dawehner+1
Comment #18
wim leersNot 100% sure we wanted to move
CacheContextsManageras well, but I'm completely fine with it.RTBC++
Comment #19
fabianx commentedIf we move the CacheContextsManager, should we not move this one as well?
Comment #20
dawehnerYeah we better do.
Comment #21
wim leersComment #22
pounardWhy use plural into the "Context" namespace ? Just trolling but it feel very weird, Validator/Validate or Contraint namespaces are not plural if I remember correctly.
Comment #23
dawehnerGood point @pounard!
Comment #24
wim leersGood point. Let's go with singular for consistency.
Comment #25
pounardThanks, I'm +42 for this change, last time I was working on the Redis cache backend for D8, contextes where everywhere seriously polluting the overall cache design when I was navigating in the code, this change makes everything clearer.
Comment #26
catchI'm wondering a bit why we don't make this \Drupal\Core\CacheContext - it's a completely separate API to the backends. But then we could also eventually do \Drupal\Core\Cache\Backend eventually. Do not mind very much, having everything at the same folder level is indeed confusing though.
Comment #27
fabianx commented#26: Because \Drupal\Core\Cache\Cache deals also with cache contexts I think the current proposal is better.
It is part of the caching subsystem and yes indeed having a subfolder for backends would be good.
Comment #28
rbayliss commentedSo just to recap the changes needed:
Comment #29
fabianx commented#28: Yes, that is correct.
Comment #30
rbayliss commentedHere are the changes listed in #28
Comment #31
wim leersLooks perfect! Thank you!
Note to committers: this will conflict very mildly with #1805054: Cache localized, access filtered, URL resolved, and rendered menu trees, so preferably this would only be committed after that one has landed.
Comment #32
xjmThis issue is a normal task that introduces a BC break, and per https://www.drupal.org/core/beta-changes, we need to outline how it fits within the allowable Drupal 8 beta criteria. Can someone add Drupal 8 beta phase evaluation template to the issue summary. Also a bit clearer summary would be helpful since the issue it links to is very long. :)
Comment #33
wim leersAll done.
Note that the IS linked to a specific comment, not just an issue in general.
Comment #35
wim leersComment #36
cilefen commentedRerolled because of #2493021: Remove unused & useless services from HtmlRenderer.
Comment #37
wim leersThanks!
Comment #38
catchFor the beta criteria I think this is an acceptable change because the class structure at the moment makes it quite difficult to know what's necessary to implement for what bits of the cache API - i.e. it's hard to see what's for backends/tags and what's for contexts, and this makes both clearer. Should have zero actual contrib impact since the API is very new and most modules won't need to interact with the classes/interfaces at all.
Assigning to xjm though in case I'm being overly generous.
Comment #39
fabianx commentedHowever we definitely need a change record and change record updates.
Comment #40
wim leersExisting change records were all unaffected, as expected, because this only affects people writing their own cache contexts.
Unaffected:
CR created: https://www.drupal.org/node/2495707.
Comment #44
wim leersDarn!
Comment #45
cilefen commentedComment #46
dawehner@cilefen
Yeah, you need to update that class reference as well
Comment #47
cilefen commentedComment #48
wim leersThank you!
Comment #49
xjmHrm. Unfortunately, while I can see why the reorganization of the classes would be a DX improvement, I don't really think this passes the beta criteria: https://www.drupal.org/core/beta-changes#flowchart
So even if the disruption is small, it seems to me we shouldn't make this change anymore at this point.
Not postponing just yet; going to check with @Wim Leers and @catch first.
Comment #50
dawehnerOn the other hand we don't treat existing random classes as API, and which cache context is basically a random class.
Comment #51
xjmSo I talked about this more with @catch for the background information on this and why it's important. catch pointed out that this issue is a followup to a recent critical (#2335661: Outbound path & route processors must specify cacheability metadata) which is potentially a prioritized change. It's a bit borderline, because the namespace itself is not new, but the interface is new as of #2428563: Introduce parameter-dependent cache contexts and having loads of different cache context is even more recent.
So there is a case for it to go in. I've updated the beta evaluation clarifying why. (For the beta evaluations of the future: "DX" is not a prioritized beta change on its own; that's a priority for 8.1.x and 9.x depending on the BC. Cleaning up stuff that's introduced by fixing criticals, however is important and in scope, because the sooner the better once the critical lands, but without blocking it.) :D
One thing I'm not sure of is whether or not we should provide BC. See: https://www.drupal.org/core/beta-changes#bc
We could reduce the disruption of the change by making all the changers in this patch, but also retaining a
\Drupal\Core\Cache\CacheContextInterfacethat is an empty extension of\Drupal\Core\Cache\Context\CacheContextInterface. I wasn't sure whether that would be better or worse than just moving the interface. We'd still move the child classes. Since those will typically be used via the core services provided for them, that'd mean the only disruption would be for subclasses of existing context which are even less likely to exist.I see a case for just moving the interface since it's only three months old anyway. Setting NR for that. If others think that's best then just set it back to RTBC with that consensus.
Thanks everyone for your patience and your help explaining the change here in the issue and in IRC.
Comment #52
dawehnerWell yeah, having those kind of BC layers is not a bad idea. This would also allows us to put @deprecated on the class and then let people figure things out automatically.
But I agree with you, the interface is quite new, and the amount of contrib modules implementing that won't be that high. I vote for sanity.
Comment #53
berdirBased on the /modules folder of d8status.md-systems.ch, which doesn't contain everything, but a lot (around 75 projects at the moment), that amount is currently 0 :)
There probably are some use cases around access and modules like organic groups, but those few modules haven't picked this concept/interface up yet.
From that perspective, moving it seems fine.
Comment #54
wim leersComment #55
xjmAlright, in it goes then. Committed and pushed to 8.0.x. Thanks!
Comment #57
xjmI also published the CR.
Comment #58
dawehnerAwesome! Thank you for letting this in!!! This makes things sane ...
Comment #59
wim leersAlso updated https://www.drupal.org/developing/api/8/cache/contexts.