Closed (fixed)
Project:
JSON:API
Version:
8.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Dec 2018 at 22:50 UTC
Updated:
27 Dec 2018 at 12:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gabesulliceThis test should show the failure on HEAD once it completes: https://www.drupal.org/pift-ci-job/1143538
The result:
Comment #3
gabesulliceI suspect there's an issue with caching because this would be the appropriate response if the entire entity was forbidden instead of just the related field (which is the case before
setUpAuthorization('GET')is called. This should (dis)prove that hunch.Comment #4
wim leersUserTest::testRelated()still fails with #3.Let's see if this fails if we revert both commits for #3014232: [regression] ResourceTypeRepository is significantly slower in JSON:API 2, becomes noticeable when handling hundreds of interlinked resources.
Comment #7
wim leersAlright, #4's failure confirms that this is indeed a regression in 8.5. But
git log origin/8.5.x -- /Users/wim.leers/Work/d8/core/modules/user/src/UserAccessControlHandler.phpshows the last modification toUserAccessControlHandlerwas on November 30, 2017.I dug deeper. And deeper.
I found the root cause.
Commit
e7f061d5d40dca7b4aafabf903652fab1cd436abfor #2773645: Allow hook_entity_field_access() to grant field-level access to User fields: 'forbidden' -> 'neutral' modifiedUserAccessControlHandlersubtly in 8.6. There is only a single line change that matters to us here:Making that same change makes JSON:API 2 pass tests on 8.5. In other words, this is an oversight in the
::testRelated()test coverage wrtview label. Because #2956084, and specifically #2956084-87: Impossible to raise an error when an `include` is requested for an inaccessible relationship field. and later were not tested on Drupal 8.5.Actually, only a subset of that is necessary:
More generally speaking, this was possible to happen because https://www.drupal.org/node/2723491/qa stopped testing against Drupal 8.5. Because that configuration was either screwed up or because that functionality is just broken on d.o. I know I've set up branch tests in the past. I've set up the necessary additional tests, hopefully they continue to work this time … 😬
So … we end up with this ridiculously hacky work-around. But that's good enough for 8.5. This is a difference in an error message, caused by a core improvement. Not JSON:API's fault.
(This took me ~2 hours 😩)
Comment #9
wim leers8.5 is green! 8.6 and 8.7 are red due to a new core change, but that's being fixed in #3019389: MediaTest fails on 8.7 since #2956368. Let's land this.
Comment #10
wim leersComment #12
wim leersComment #13
wim leers