From a95633c6caaa65120ebe7cc4b4c8e12b784bac38 Mon Sep 17 00:00:00 2001 From: martbost Date: Wed, 23 Sep 2026 05:46:00 -0500 Subject: [PATCH] Day page: a past date with no activity is not found, and never written to disk Probing any old date returned an empty page with a 200 and left a junk file behind for it. Co-Authored-By: Claude Opus 5 --- daysnap.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/daysnap.js b/daysnap.js index cdb16a3..8717c39 100644 --- a/daysnap.js +++ b/daysnap.js @@ -90,7 +90,13 @@ function get(key) { if (key > today) return null; } const d = compute(key); - if (d && key !== today) save(d); + if (!d) return null; + if (key !== today) { + // a past day with nothing in it is either before the contract or beyond the index's reach: + // say not found rather than serving an empty page, and never write a file for it + if (d.totals.payouts + d.totals.joins === 0) return null; + save(d); + } return d; } function save(d) { try { fs.writeFileSync(dayFile(d.key), JSON.stringify(d)); } catch (e) {} }