The Cavu Reader

Don't mail a backlog: stamp releases that predate delivery

The production database came up with two releases from Aug 19 and Aug 26 whose fanned_out_at was NULL purely because the column had just been added. The sweep cannot tell that from a release that happened a minute ago, so the first reader to confirm an address would have been mailed about chapters up to two weeks old as if they were new — and the whole promise of the feature is that a message means there is something new to read. Stamping them at migration time closes it. Fresh databases update nothing; an upgrade stamps exactly the backlog, which is right, because at the moment of upgrade nothing has ever been delivered and nothing should be. This is the delivery-side twin of the NULL-prior guard in shelfIndex upsert(), whose comment already says it exists to avoid "a release storm on migration day". That guard stops the storm at detection; this one stops it at delivery, which is the step that didn't exist when it was written. Verified against a copy of the production database: two unfanned releases before, zero after, books intact. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>


Author Chris Pardy Co-author Claude Opus 5 (1M context) Date Commit Parent 20ab52e3
+34 -1
2 changed files
+34 -1
2 changed files