A trash cleanup that deleted records a day early, and how I tested it in 2 minutes
Twenty, the open-source CRM, keeps deleted records in the trash for 14 days before deleting them for good. At least, that's what it says. A record deleted at 23:50 was actually gone after 13 days and 20 minutes. With retention set to 1 day, a record deleted just before midnight UTC disappeared 11 minutes later. The code looked reasonable: private calculateCutoffDate(trashRetentionDays: number):…
The open-source CRM Twenty retains deleted records in the trash for 14 days before permanently deleting them. However, a bug caused a record deleted just before midnight UTC to be permanently deleted 11 minutes later when the retention period was set to 1 day. The issue stemmed from the +1 added to the retention days, which moved the cutoff date forward one day, making it dependent on the server's time zone.
A developer named Asmodeus14 created ChronoStack, a tool that allows users to move the clock forward in a Docker Compose stack, enabling the testing of time-based features without relying on manual timestamp edits or temporary flags. ChronoStack runs a virtual copy of the stack on a separate clock, allowing for quick and repeatable testing of various scenarios.
The developer tested ChronoStack by simulating a bug in the Twenty CRM, and it successfully identified the issue within just two minutes. The tool supports various programming languages and has been tested on Linux, Windows, and Intel Macs. ChronoStack is an open-source project under MIT/Apache-2.0 licenses and can be installed using Homebrew, Scoop, or Cargo.
Rewritten by urgent.news; may contain errors — check the original.