FAILURE MAP
← Case archive

FA-64147 / Medication dosing calculations / Member archive

Rolling 24-hour cumulative dose limit: remaining amount clamp · case 02

Over-limit patients are shown a negative remaining allowance.

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
over limit remaining clamped{"allowed": false, "reason": "DAILY_LIMIT", "remaining_mg": -450, "window_mg": 3500}{"allowed": false, "reason": "DAILY_LIMIT", "remaining_mg": 0, "window_mg": 3500}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 ↗