The following issue can cause inconsistencies in query indices and permission store, in case the DocumentStore is used, in combination with a large commit and many children:
In oak 1.2 when doing a diffManyChildren as part of running the CommitHooks as part of a branch commit, not all child paths are taken into account in some cases.
The problem seems to be related to the _modified calculation when doing the query for affected child paths. It seems that minValue is not correctly calculated when doing compareAgainstBaseState as part of a persisted branch.
Note that the problem can be reproduced very good on 1.2.14, less good but still on the latest 1.2 and not in trunk (ie almost 1.6.0).
Attaching a test case to reproduce