Problem
Yield accrual can become ambiguous or overflow when timestamps, rate changes, or long inactive periods are not bounded.
Objective
Deliver a production-quality improvement to yield calculation and accrual state that creates measurable value for correctness, security, reliability, performance, or maintainability.
Implementation scope
- Define timestamp monotonicity, rate units, compounding or simple-accrual semantics, and maximum accrual interval.
- Prevent duplicate accrual for the same interval and handle clock anomalies safely.
- Expose the last-accrued timestamp and rate version in relevant events.
Acceptance criteria
- Accrual is deterministic for a given state and time.
- Backward timestamps and arithmetic overflow fail safely.
- Rate changes apply exactly at the documented boundary.
Required validation
- Boundary and property tests for zero/maximum rates, long intervals, rate changes, and repeated calls.
- Existing tests and CI remain passing.
- Add regression coverage for the original failure mode.
- Do not weaken, delete, or skip unrelated tests to obtain a green build.
PR quality bar
- Keep the PR focused on this issue and explain design tradeoffs.
- Include test evidence, compatibility impact, and migration or rollout notes where relevant.
- Avoid typo-only, documentation-only, cosmetic-only, or unrelated refactor submissions.
Out of scope
- Broad rewrites not required by the acceptance criteria.
- Changes to unrelated services, contracts, or user flows.
Problem
Yield accrual can become ambiguous or overflow when timestamps, rate changes, or long inactive periods are not bounded.
Objective
Deliver a production-quality improvement to yield calculation and accrual state that creates measurable value for correctness, security, reliability, performance, or maintainability.
Implementation scope
Acceptance criteria
Required validation
PR quality bar
Out of scope