As per #2551419-102: Abstract RenderCache into a separate service that is capable of cache redirects in a non-render array-specific way:

TrackerTest tests code that never adds the user cache context to its content. What it does do, however, is add the user cache context to the local tasks. But those get properly placeholdered now and thus the optimized user.permissions cache context's tags never makes it to the response level (and thus cacheability headers).


To summarize: The current render cache does not properly placeholder the local tasks. Because of this, the following assertions holds TRUE, even though the code that's being tested does not actually add the user cache context which would lead to user.permissions being optimized away:

    // Because the 'user.permissions' cache context is being optimized away.
    $role_tags = [];
    foreach ($this->user->getRoles() as $rid) {
      $role_tags[] = "config:user.role.$rid";
    }
    $expected_tags = Cache::mergeTags($expected_tags, $role_tags);

Solution: Stop testing for the 'user' cache context because the code being tested does not add it. This way, if the placeholdering system is updated to properly placeholder the local tasks block, then these tests don't start failing for seemingly unrelated changes.

Comments

kristiaanvandeneynde created an issue. See original summary.

kristiaanvandeneynde’s picture

Status: Active » Closed (won't fix)

Actually, I just realized we can't fix this in a separate issue because the current system will add these wrong cache tags to the header. This needs to go into the main patch.