We need to refine context definitions when checking integrity. This needs to cover refined context for used context, such that it is verified proper context is going to be passed. Then, this needs to cover refined context for provided context such that subsequent plugins pickup the right context.

Comments

fago created an issue. See original summary.

fago’s picture

Status: Active » Needs work

Test case proving the problem: https://github.com/fago/rules/pull/422

fago’s picture

Status: Needs work » Needs review

In order for being able to solve this and all related issues, I re-worked all the metadata processing code to have one central logic that is used by the metadata state preparations and integrity checks. As integrity checking requires metadata state preparations I incorporated it in checkIntegrity() as this greatly simplifies tree traversal while checking integrity.

Quite some re-factoring, but that should be a solid base for solving all the related issues and allowing the addition of metadata assertions.

Note: While working on this, I ran into exceptions due to #2677162: Context::getContextValue() violates ContextInterface by throwing an unexpected exception once refineContextDefinitions() was used. A review there would be helpful also!

fago’s picture

oh, https://github.com/fago/rules/pull/422 is a bit bigger now ;)

  • fago committed 0632db5 on 8.x-3.x
    Issue #2677034 by fago: Simplify preparation of metadata state logic and...
  • fago committed 3a24053 on 8.x-3.x
    Issue #2677034 by fago: Make type checking strict while there is no type...
  • fago committed 3c17965 on 8.x-3.x
    Issue #2677034 by fago: Make checking integrity work with preparing...
  • fago committed 44d1880 on 8.x-3.x
    Issue #2677034: Update ContextHandlerTraitTest to recent changes.
    
  • fago committed 7f51cd4 on 8.x-3.x
    Issue #2677034: Add a test case to ensure context is refined when...
  • fago committed f3234cf on 8.x-3.x
    Issue #2677034: Add test case to verify provided variables use refined...
  • fago committed fe2186e on 8.x-3.x
    Issue #2677034 by fago: Document how integrity checks and exeuction...
fago’s picture

Status: Needs review » Fixed

Merged.

Status: Fixed » Closed (fixed)

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