test(#284): hypothesis property tests for the money/numeric logic#307
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
xmr_per_hs_day) — non-negativity, linearity in block reward, monotonic-decreasing in difficulty, zero on non-positive inputs._fraction_to_ms,_routed_fraction,_max_donation_fraction) — monotonicity, unit-interval routed fraction, and the VIP/PPLNS reserve clamp staying in[0, hard cap].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.hypothesisadded to thetestextra (uv.lock relocked); 11 new tests, suite now 543 passed, 94%.Typing roadmap — deferred (documented)
The ruff
ANNratchet →ty/pyrightadoption is captured as a post-1.0 follow-up in the dashboard README, not a v1.1 blocker (the app is lightly annotated andtyis 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