grist-core
grist-core copied to clipboard
:warning: "Any" columns are subject to data corruption (via Python mutability)!
TL;DR
References in a formula column to another (Any type) field actually reference the in-memory python object contained there and can semi-permanently modify that value (in volatile memory).
Steps to reproduce:
- Copy this public Grist document.
- Modify it according to this screencast, or, specifically:
- Add a value to a new row of the
Stowaway
column. - Notice the new value appended to the
Ship
column (mutable) even thoughShip
is defined as a static python literal. - Edit an existing value in the
Stowaway
column. - Notice nothing seems to change.
- Refresh the page.
- Notice the new value appears after the refresh (indirect link between python object and displayed value).
- "Duplicate" (or save an unsaved copy of) the document.
- Notice that the original value of
Stowaway
disappears fromShip
(volatile memory), - ... and your new value remains (reloaded from storage)
Implications
- very tricky bug to trace when you accidentally modify a column via another one
- very hard to (ab)use as a feature since it exists only in volatile memory