Skip to content

Test coin refill at the exact one-hour boundary - #318

Merged
robkooper merged 1 commit into
mainfrom
lum-153-test-refill-hour-boundary
Oct 29, 2026
Merged

robkooper merged 1 commit into
mainfrom
lum-153-test-refill-hour-boundary

Conversation

@robkooper

Copy link
Copy Markdown
Member

What changed

  • tests/unit/test_token_refill.py: new test_refills_at_exact_one_hour_boundary. A balance with last_refill_at = now - 1h is refilled once on the next pass (coins_left 50 -> 60, last_refill_at == now).
  • CHANGELOG.md: one line under [Unreleased].

No production code change.

How it was tested

  • uv run pytest tests/unit/test_token_refill.py -x: 15 passed.
  • Plain uv run pytest: 2443 passed, 147 skipped. The full PostgreSQL + Redis run is this PR's CI.
  • Mutation checks, run locally and reverted:
    • lumen/services/token_refill.py:34 (select of due balances) <= changed to <: the new test fails.
    • lumen/services/token_refill.py:110 (UPDATE guard) <= changed to <: the new test fails.

Fixes #312

Pin that a balance whose last_refill_at is exactly one hour before now
is refilled, guarding both <= comparisons in refill_coin_balances.

Fixes #312
@robkooper
robkooper merged commit c77f441 into main Oct 29, 2026
13 of 15 checks passed
@robkooper
robkooper deleted the lum-153-test-refill-hour-boundary branch October 29, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[should-fix] Untested: coin refill due-selection boundary (last_refill_at == one_hour_ago)

1 participant