Skip to content

Usage history: test the thinning gap >= 0 check (#502 lens) #504

Closed

Description

@scuttletoby

Follow-up from the lens on #502 (#502 (comment); SAFE).

  1. The gap >= 0 check in thinning has no test (apps/server/src/usage/UsageReadingsHistory.ts, thinning loop). Removing it keeps all tests green, and usage history: keep clock step-backs through thinning; test clock guards #502 now relies on it. The lens wrote a test that shows the risk: readings at day −31, the clock steps back to day −36 (that reading ages out), then readings resume at day −31 minus 20 minutes. Without the check, all 30 readings after the step are dropped, along with the break. Add that test (it must fail without the check). Same kind of gap as usage history: two clock-deletion guards have no test #38.
  2. PR usage history: keep clock step-backs through thinning; test clock guards #502's body overstates one proof: removing edges.add(previous) fails 2 thinning tests, not 3. Description only; nothing to change in code.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions