Skip to content

test(#284): hypothesis property tests for the money/numeric logic#307

Merged
VijitSingh97 merged 1 commit into
developfrom
claude/284-property-tests
Jun 18, 2026
Merged

test(#284): hypothesis property tests for the money/numeric logic#307
VijitSingh97 merged 1 commit into
developfrom
claude/284-property-tests

Conversation

@VijitSingh97

Copy link
Copy Markdown
Collaborator

Closes #284 — the last Wave 7 code-quality child. Adds property-based tests (hypothesis) that assert invariants across a wide input range, the class of bug example tests miss (cf. the #70 anti-windup overshoot).

What's covered (the modules #284 names)

  • earnings (xmr_per_hs_day) — non-negativity, linearity in block reward, monotonic-decreasing in difficulty, zero on non-positive inputs.
  • metrics windowed averages — non-negativity, empty→0, and conservation (routed p2pool + xvb sum to the total when no legacy fallback).
  • XvB controller (_fraction_to_ms, _routed_fraction, _max_donation_fraction) — monotonicity, unit-interval routed fraction, and the VIP/PPLNS reserve clamp staying in [0, hard cap].
  • donation simulator (run_algo) — the headline XvB split controller overshoots target tier ~3× (catch-up windup during API ramp) #70 invariant: the closed-loop controller never winds up — the donated fraction is clamped to [0, 1] every cycle, so p2pool efficiency stays in [0, 1] across randomized scenarios.

hypothesis added to the test extra (uv.lock relocked); 11 new tests, suite now 543 passed, 94%.

Typing roadmap — deferred (documented)

The ruff ANN ratchet → ty/pyright adoption is captured as a post-1.0 follow-up in the dashboard README, not a v1.1 blocker (the app is lightly annotated and ty is pre-1.0) — matching #284's "ty deferred" acceptance.

With this, Wave 7 (#279) is complete save the deferred typing work.

🤖 Generated with Claude Code

Wave 7 correctness. Adds property-based tests (hypothesis) asserting invariants across a wide
input range — the class of bug example tests miss (cf. the #70 anti-windup overshoot):

- earnings (`xmr_per_hs_day`): non-negativity, linearity in block reward, decreasing in difficulty,
  zero on non-positive inputs.
- metrics windowed averages: non-negativity, empty->0, and conservation (routed p2pool + xvb sum to
  the total when no legacy fallback).
- XvB controller (`_fraction_to_ms`, `_routed_fraction`, `_max_donation_fraction`): monotonicity,
  unit-interval routed fraction, and the VIP/PPLNS reserve clamp staying in [0, hard cap].
- donation simulator (`run_algo`): the closed-loop controller never winds up — the donated fraction
  is clamped to [0, 1] every cycle, so p2pool efficiency stays in [0, 1] across randomized scenarios.

hypothesis added to the test extra (uv.lock relocked). The ruff `ANN` -> `ty` typechecker on-ramp is
documented as a deferred post-1.0 follow-up (dashboard README) — not a v1.1 blocker (ty is pre-1.0).

Dashboard suite green: 543 passed, 94% coverage. Closes #284.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@VijitSingh97 VijitSingh97 merged commit 67d3027 into develop Jun 18, 2026
16 checks passed
@VijitSingh97 VijitSingh97 deleted the claude/284-property-tests branch June 18, 2026 13:22
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.

tooling: correctness — hypothesis property tests + ruff ANN→ty roadmap

1 participant