(core) Sort table._back_references in set to fix nondeterminism in tests

Summary: Title

Test Plan: Fixed a test that was failing inconsistently

Reviewers: georgegevoian, paulfitz

Reviewed By: georgegevoian, paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4122
pull/765/head
Alex Hall 6 months ago
parent cea0404a22
commit 89e1a4af10

@ -2382,8 +2382,8 @@
"ACTIONS": {
"stored": [
["BulkRemoveRecord", "_grist_Views_section", [1, 2, 3]],
["UpdateRecord", "_grist_Tables", 4, {"recordCardViewSectionRef": 0}],
["UpdateRecord", "_grist_Tables", 4, {"rawViewSectionRef": 0}],
["UpdateRecord", "_grist_Tables", 4, {"recordCardViewSectionRef": 0}],
["RemoveRecord", "_grist_TabBar", 1],
["RemoveRecord", "_grist_Pages", 1],
["RemoveRecord", "_grist_Views", 1],
@ -2397,8 +2397,8 @@
["BulkAddRecord", "_grist_Views_section", [1, 2, 3],
{"borderWidth": [1, 1, 1], "defaultWidth": [100, 100, 100], "parentId": [1, 0, 0],
"parentKey": ["record", "record", "single"], "sortColRefs": ["[]", "", ""], "tableRef": [4, 4, 4]}],
["UpdateRecord", "_grist_Tables", 4, {"recordCardViewSectionRef": 3}],
["UpdateRecord", "_grist_Tables", 4, {"rawViewSectionRef": 2}],
["UpdateRecord", "_grist_Tables", 4, {"recordCardViewSectionRef": 3}],
["AddRecord", "_grist_TabBar", 1, {"tabPos": 1.0, "viewRef": 1}],
["AddRecord", "_grist_Pages", 1, {"pagePos": 1.0, "viewRef": 1}],
["AddRecord", "_grist_Views", 1, {"name": "Foo", "type": "raw_data"}],

@ -1072,7 +1072,7 @@ class UserActions(object):
# Also remove any references to this row from other tables.
row_id_set = set(row_ids)
for ref_col in table._back_references:
for ref_col in sorted(table._back_references, key=lambda c: c.node):
if ref_col.is_formula() or not isinstance(ref_col, column.BaseReferenceColumn):
continue
updates = ref_col.get_updates_for_removed_target_rows(row_id_set)

Loading…
Cancel
Save