FA-64129 / Medication dosing calculations / Member archive
Rolling 24-hour cumulative dose limit: rolling window edge · case 04
A dose given exactly 24 hours ago still blocks a new dose.
Case contract
Input {history [[t_min, mg], ...] (any order), now, request_mg, max_mg, min_interval}. Doses with now - t < 1440 minutes count toward the rolling window (a dose exactly 24 h old has expired). The request is refused with TOO_SOON when now minus the most recent dose time is below min_interval, otherwise with DAILY_LIMIT when window + request exceeds max_mg; else OK. Return {allowed, reason, window_mg, remaining_mg = max(0, max_mg - window)}.
Why this case matters
Cumulative-dose guards are time-window computations over charted administrations; window edges and history ordering are common defect sites.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| dose exactly 24 hours old has expired | {"allowed": false, "reason": "DAILY_LIMIT", "remaining_mg": 400, "window_mg": 3000} | {"allowed": true, "reason": "OK", "remaining_mg": 1400, "window_mg": 2000} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗