Found during store-screenshot QA on v2.6.0 (Pixel 3, 90 consecutive days of imported demo data):
- Home and Statistics show: 61-day streak / best 61
- Insights shows: 90 days current streak / longest 90 / 90 entries logged
Same database, same days, two streak implementations disagree. Likely suspect: one path day-keys via SQL date functions and the other via localDateString() (SQL day-keying is the documented anti-pattern in this repo, see CLAUDE.md / frontend/databases). The demo data also surfaced a possible contributing artifact: frontend/scripts/make-demo-data.js can emit a 1-day gap ~2 months back when the generating laptop's timezone differs from the device's (local-noon pinning edge), the 61 vs 90 split point coincides with it. The Insights implementation appears to bridge the gap; Home/Stats does not (or vice versa, needs tracing).
Fix should:
- Unify streak computation into ONE shared, unit-tested transform used by all three surfaces.
- Decide the honest semantic for a 1-day gap (streak broken) and make all surfaces agree.
- Add a regression test with a gapped dataset.
- Optionally fix the TZ edge in make-demo-data.js.
🤖 Generated with Claude Code
Found during store-screenshot QA on v2.6.0 (Pixel 3, 90 consecutive days of imported demo data):
Same database, same days, two streak implementations disagree. Likely suspect: one path day-keys via SQL date functions and the other via
localDateString()(SQL day-keying is the documented anti-pattern in this repo, see CLAUDE.md / frontend/databases). The demo data also surfaced a possible contributing artifact:frontend/scripts/make-demo-data.jscan emit a 1-day gap ~2 months back when the generating laptop's timezone differs from the device's (local-noon pinning edge), the 61 vs 90 split point coincides with it. The Insights implementation appears to bridge the gap; Home/Stats does not (or vice versa, needs tracing).Fix should:
🤖 Generated with Claude Code