FAILURE MAP
← Case archive

FA-64137 / Medication dosing calculations / Member archive

Rolling 24-hour cumulative dose limit: minimum interval comparison · case 02

A request made exactly at the minimum interval is refused as too soon.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

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 fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
dose exactly 24 hours old has expired{"allowed": false, "reason": "TOO_SOON", "remaining_mg": 1200, "window_mg": 2000}{"allowed": true, "reason": "OK", "remaining_mg": 1200, "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 ↗