follow-up(statistics): P3 cleanups from #122 review (baseline rules) #124

Closed
opened 2026-09-25 22:11:36 +00:00 by gabogg · 0 comments
Owner

Follow-ups from the pass-2 review of #122 (#105 usual weekday baseline rules). All P3; both pass-1 P2s were fixed before merge.

Standards

  • Hidden ordering precondition. get_counted_cycle_quality_range_async bounds its audit CTE with BETWEEN cycles[0][0] AND cycles[-1][0], so newest-first input silently drops audit rows. Use min/max of the dates inside the repository (or document the precondition).
  • Remaining literals. database.py seeds still hard-code '10:00', '18:00' and "08:00", "21:00" next to DEFAULT_HOLIDAY_HOURS / DEFAULT_WEEKDAY_HOURS.
  • Missing config row. update_config_fields_async raises TypeError (→ 500) if row 1 is missing; init_schema always seeds it, so theoretical — guard or assert with a clear message.
  • Trust reads per candidate. Baseline selection still reads the trust verdict one candidate at a time (up to lookback_weeks queries when many days are untrusted), and the summary re-reads each selected day's flow. A batched trust query would finish the job.

🤖 Generated with Claude Code

Follow-ups from the pass-2 review of #122 (#105 usual weekday baseline rules). All P3; both pass-1 P2s were fixed before merge. ## Standards - [ ] **Hidden ordering precondition.** `get_counted_cycle_quality_range_async` bounds its audit CTE with `BETWEEN cycles[0][0] AND cycles[-1][0]`, so newest-first input silently drops audit rows. Use `min`/`max` of the dates inside the repository (or document the precondition). - [ ] **Remaining literals.** `database.py` seeds still hard-code `'10:00', '18:00'` and `"08:00", "21:00"` next to `DEFAULT_HOLIDAY_HOURS` / `DEFAULT_WEEKDAY_HOURS`. - [ ] **Missing config row.** `update_config_fields_async` raises `TypeError` (→ 500) if row 1 is missing; `init_schema` always seeds it, so theoretical — guard or assert with a clear message. - [ ] **Trust reads per candidate.** Baseline selection still reads the trust verdict one candidate at a time (up to `lookback_weeks` queries when many days are untrusted), and the summary re-reads each selected day's flow. A batched trust query would finish the job. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#124
No description provided.