grist-core icon indicating copy to clipboard operation
grist-core copied to clipboard

:warning: "Any" columns are subject to data corruption (via Python mutability)!

Open combinatorist opened this issue 11 months ago • 3 comments

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:

  1. Copy this public Grist document.
  2. Modify it according to this screencast, or, specifically:
  3. Add a value to a new row of the Stowaway column.
  4. Notice the new value appended to the Ship column (mutable) even though Ship is defined as a static python literal.
  5. Edit an existing value in the Stowaway column.
  6. Notice nothing seems to change.
  7. Refresh the page.
  8. Notice the new value appears after the refresh (indirect link between python object and displayed value).
  9. "Duplicate" (or save an unsaved copy of) the document.
  10. Notice that the original value of Stowaway disappears from Ship (volatile memory),
  11. ... 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

combinatorist avatar Feb 29 '24 19:02 combinatorist