Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Major
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
15 Aug 2015 at 19:20 UTC
Updated:
3 Sep 2015 at 15:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersComment #3
dawehnerQuestion: So we need to not change that many places, because we use url.query_args in other places already?
Comment #4
wim leersYes, or
url.urlimpliesurl.*, i.e.url.query_args,url.query_args:foo, et cetera. See https://www.drupal.org/developing/api/8/cache/contexts#optimizingComment #5
dawehnerDo we need some explicit test coverage for this issue? I mean adding the expected cache contexts is one thing, but having a real case is another.
Comment #6
wim leersGreat question!
I'd say: — but… we only set the
X-Drupal-Cache-Contextsheader forCacheableResponseInterfaceresponses. And… onlyHtmlResponseimplements that. NotAjaxResponse(which is what AJAX/dialog/modal all use). So we cannot actually test this. AFAICT this is also why #2472323: Move modal / dialog to query parameters didn't introduce test coverage for this.So… not sure what to do. Ideas? It feels like this patch's test coverage updates are sufficient for now, until other wrapper formats have cacheable responses?
Comment #7
dawehnerTo be honest it feels like the code could still be broken in theory now after reading your latest comment. We could for sure write a test wrapper which implements the
CacheableResponseInterfaceComment #8
wim leersOk, let's do that.
Comment #9
borisson_#2476407: Use CacheableResponseInterface to determine which responses should be cached will also introduce a
CacheableJsonResponsethat also implementsCacheableResponseInterface. So adding a test could be a followup to that issue?Comment #10
wim leers#9: but we still won't be able to render a render array into a JSON response. Except, of course, we could do that for testing purposes. We'd have to come up with a fairly silly wrapper format anyway.
How about this: I'll adopt the
CacheableJsonResponseclass from the patch over there in this patch, and whichever patch lands first then makes the other patch smaller :)Comment #11
wim leersEt voilà.
Comment #13
wim leersThis too is failing with the same random fails: #2552687: Test failures in ConfigFormOverrideTest and ContainerRebuildWebTest on newly spun up testbot instances.
Comment #14
wim leersComment #16
dawehnerIf we would have missed that cache context we would have served the wrong kind of context, therefore I think we should have an integration test coverage
which ensures that you can cache two different wrapper formats and get different output.
Comment #17
wim leersd'oh, of course!
Comment #20
wim leersComment #21
dawehnerCool. Thank you!
Comment #22
catchCommitted/pushed to 8.0.x, thanks!