gristlabs_grist-core/sandbox/grist
Cyprien P 2b2e19c5b5 (core) Fix issue with summary update.
Summary:
The problem is that the implementation for a summary update was relying on type consistency to get columns (ie: matches agains colId and type).

Type consistency is an attempt at maintaining consistent type across same-named column for summaries of same table.

But the problem is that the consistency of types is NOT a strict guarantee or an invariant, more of a best-effort attempt (there are too many possible sequences of operations possible with renaming/adding/removing in summary tables and the underlying table).

With current implementation and with a document violating the type consistency, a summary table could end up with fields referencing columns to the former summary table (more detail below(1)). Which is a bad state (yields js errors on the client).

This diff fixes this issue by relaxing the type comparison when search for same-named column.

(1) __Below is a description of how a violation of type consistency could end-up in bad state document (example taken from the reported bug):__

> In this document, let's assume two summary tables `Table1 [by A]` and `Table1 [Totals]`. Let's also assume Table1 and `Table1 [Totals]` both have an `Amount(Numeric)` column, and that `Table1 [by A]` has one `Amount(Any)` column (violating the type consistency principle). Now when users wanted to change the `Table1 [Totals]` section to group by 'A', grist found that there is already a summary table with same grouping. But it couldn't find a matching column for `Amount(Numeric)` so it created a new one. Except that because there was still an `Amount(Any)` the new column was named `Amount2` which caused following code to ignore it and in particular forgetting to update it's corresponding section's field which was then pointing toward the column of a different table (which is bad).

Test Plan: Added python test.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3809
2023-03-15 13:54:15 +01:00
..
functions (core) Fix an issue due to a missing function which turns out to be necessary 2023-03-01 02:39:57 -05:00
imports (core) Fix issue that ints would be imported with a trailing ".0" from Google Sheets. 2023-02-26 15:24:15 -05:00
acl_formula.py (core) Support for $ syntax in ACL rules 2022-11-09 16:33:11 +01:00
acl.py
action_obj.py
action_summary.py
actions.py
autocomplete_context.py
codebuilder.py (core) Support for $ syntax in ACL rules 2022-11-09 16:33:11 +01:00
column.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
csv_patch.py
depend.py
docactions.py
docmodel.py (core) Comments 2022-10-17 13:38:21 +02:00
engine.py
formula_prompt.py (core) Porting back AI formula backend 2023-02-08 17:15:59 +01:00
friendly_errors.py (core) Upgrade friendly-traceback and its dependencies 2022-10-28 14:44:14 +02:00
gencode.py
grist.py
identifiers.py
import_actions.py
logger.py
lookup.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
main.py (core) Porting back AI formula backend 2023-02-08 17:15:59 +01:00
match_counter.py
migrations.py feat(ColumnDesc): create column description in database and link it to visual behaviors 2023-01-26 14:54:37 +01:00
moment.py
objtypes.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
parse_data.py (core) Fix issue that ints would be imported with a trailing ".0" from Google Sheets. 2023-02-26 15:24:15 -05:00
records.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
relabeling.py
relation.py
runtests.py
sandbox.py add a pyodide-based "sandbox" flavor (#437) 2023-03-06 16:56:25 -05:00
schema.py feat(ColumnDesc): create column description in database and link it to visual behaviors 2023-01-26 14:54:37 +01:00
sort_specs.py
summary.py (core) Fix issue with summary update. 2023-03-15 13:54:15 +01:00
table_data_set.py
table.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
test_acl_formula.py (core) Support for $ syntax in ACL rules 2022-11-09 16:33:11 +01:00
test_acl_renames.py
test_actions.py
test_codebuilder.py
test_column_actions.py
test_completion.py (core) Adding new column in users table "ref" with unique identifier. 2022-10-04 15:19:28 +02:00
test_default_formulas.py
test_depend.py
test_derived.py
test_display_cols.py
test_docmodel.py
test_engine.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
test_find_col.py
test_formula_error.py
test_formula_prompt.py (core) Attempt to fix test_formula_prompt test broken by a merge 2023-02-13 08:51:54 -05:00
test_formula_undo.py
test_functions.py (core) Don't swallow TypeErrors in functions like SUM 2022-10-25 12:15:13 +02:00
test_gencode.py
test_import_actions.py
test_logger.py
test_lookups.py (core) Respect sort_by in lookupOne, and allow reverse sorting 2022-10-24 20:10:08 +02:00
test_match_counter.py
test_migrations.py
test_moment.py
test_record_func.py
test_recordlist.py
test_reflist_rel.py
test_relabeling.py
test_renames2.py (core) Two fixes to tests affected by changes that came from grist-core. 2023-03-14 11:57:01 -04:00
test_renames.py (core) Adding new column in users table "ref" with unique identifier. 2022-10-04 15:19:28 +02:00
test_replay.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
test_requests.py
test_rules_grid.py
test_rules.py
test_side_effects.py
test_sort_spec.py
test_summary2.py (core) Fix issue with summary update. 2023-03-15 13:54:15 +01:00
test_summary_choicelist.py
test_summary_undo.py
test_summary.py
test_table_actions.py
test_table_data_set.py
test_temp_rowids.py
test_textbuilder.py
test_treeview.py
test_trigger_formulas.py (core) Restoring separated transform columns 2023-01-03 17:54:16 +01:00
test_twowaymap.py
test_types.py
test_undo.py
test_urllib_patch.py
test_user.py (core) Adding new column in users table "ref" with unique identifier. 2022-10-04 15:19:28 +02:00
test_useractions.py (core) Update sort and filter UI 2022-11-17 15:33:45 -05:00
testsamples.py
testscript.json
testutil.py
textbuilder.py
treeview.py
twowaymap.py
tzdata.data
urllib_patch.py
user.py (core) Adding new column in users table "ref" with unique identifier. 2022-10-04 15:19:28 +02:00
useractions.py (core) Restoring separated transform columns 2023-01-03 17:54:16 +01:00
usercode.py
usertypes.py (core) Python optimizations to speed up data engine 2023-02-09 12:49:58 -05:00
xmlrunner.py