Fix a broken case of Worklist calculation when using security_uid columns
With some combinations of worklists using two additional security_uid columns coming from local role groups, some documents might be excluded from worklists, without the fix, when running with a random PYTHONHASHSEED, the test can fail with: FAIL: test_worklist_exclusionlist_collision (erp5.component.test.erp5_version.testERP5CatalogSecurityUidOptimization.TestSecurityUidOptimizationWorklist) ---------------------------------------------------------------------- Traceback (most recent call last): File "<portal_components/test.erp5.testERP5CatalogSecurityUidOptimization>", line 370, in test_worklist_exclusionlist_collision 'security_uid_or_alternate_security_uid_draft': 1, File "<portal_components/test.erp5.testERP5CatalogSecurityUidOptimization>", line 213, in assertWorklistCount expected_count_by_worklist_id, AssertionError: {'security_uid_or_alternate_security_uid_draft': 1} != {'collision_worklist': 1, 'security_uid_or_alternate_security_uid_draft': 1} - {'security_uid_or_alternate_security_uid_draft': 1} + {'collision_worklist': 1, 'security_uid_or_alternate_security_uid_draft': 1} ? +++++++++++++++++++++++++ What happens in sumCatalogResultByWorklist is something like this: (Pdb) pp criterion_dict {'alternate_security_uid': <ExclusionList [11, 14]>, 'other_security_uid': frozenset([13L]), 'portal_type': frozenset(['Person']), 'validation_state': frozenset(['draft'])} (Pdb) pp catalog_result.dictionaries() [{'alternate_security_uid': 12, 'count': Decimal('1'), 'other_security_uid': 13, 'portal_type': 'Person', 'validation_state': 'draft'}] Depending on the worklists grouped together in grouped_worklist_dict and the order this dict is iterated, we may reach a situation where criterion_id_list contains 'alternate_security_uid', because for another worklist it was not an ExclusionList but a list to be applied, in this case, this if condition is false: for criterion_id in criterion_id_list: criterion_value_set = criterion_dict[criterion_id] if result_line[criterion_id] not in criterion_value_set: is_candidate = False and the row is not counted in collision_worklist worklist. Co-authored-by: Jérome Perrin <jerome@nexedi.com>
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
failed |
#660187
external
|
ERP5.CodingStyleTest-TestRunner2 |
02:16:53
|
||||||
failed |
#660186
external
|
ERP5.UnitTest-TestRunner2 |
06:57:28
|
||||||
failed |
#659861
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
12:45:48
|
||||||
failed |
#659165
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
11:43:33
|
||||||
failed |
#660100
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
02:38:16
|
||||||
failed |
#659739
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
03:19:24
|
||||||
passed |
#660024
external
retried
|
ERP5.UnitTest-TestRunner2 |
14:26:08
|
||||||
failed |
#659166
external
retried
|
ERP5.UnitTest-TestRunner2 |
00:13:13
|
||||||
failed |
#659736
external
retried
|
ERP5.UnitTest-TestRunner2 |
08:32:01
|
||||||
passed |
#659215
external
retried
|
ERP5.UnitTest-TestRunner2 |
14:05:06
|
||||||
failed |
#659189
external
retried
|
ERP5.UnitTest-TestRunner2 |
00:19:52
|
||||||