fix(shadow_report): window is days, not seconds #117
Reference in New Issue
Block a user
Delete Branch "fix/shadow-report-window"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
scripts/shadow_report.pyfiltered every query withjulianday(observed_at) >= julianday('now') - ? / 86400.0and bounddays.juliandayis already in days, so the divide made--days 14a 14 SECOND window. Replaced all 10 occurrences with- ?.Evidence
On the live DB, with 5-minute-old shadow rows present, the report printed "No classifier_shadow rows found";
--days 3600(meaning one hour) showed them. The first report also showed 133% coverage because the windows did not line up. After the fix,--days 1on the live DB shows 153 shadow rows and 99.35% coverage.Tests
Two new tests in
tests/test_shadow_encoder.py:days=1;days=1and included withdays=7.Both use
timedeltaoffsets (no day-of-month arithmetic). Against the original buggy script both FAIL; with the fix they pass. The test diff is additions only.Full suite: 2739 passed (2737 + 2).
Not in this PR: the two minor findings from the code-review session (f-string SQL for
chat_since_first,busyrows biasing the coverage figure).🤖 Generated with Claude Code
https://claude.ai/code/session_01XtPLeRkmHJk4VeiTEUfhVR