FAILURE MAP
← Case archive

FA-85602 / Ride-hailing fare and surge pricing / Member archive

Ride credits consumed on the pre-discount fare · case 02

A rider with credits and a promo is charged negative amounts and loses credit balance.

Member previewVariant 2 · 3 implementations · 7 checks per implementation

Case contract

Validate a promo in order: expired if now_day is after expires_day (the expiry day itself is valid), exhausted if no uses remain, not_first if first-ride-only and the rider has prior rides, min_fare if the fare (cents) is below min_fare. A valid pct promo takes value% of the fare (floored), capped at cap cents when cap is not None (a cap of 0 means a zero discount); a flat promo takes value but never more than the fare. Ride credits then cover up to the remaining fare. Return discount, credit used, amount due and reason.

Why this case matters

Ride-hailing prices are computed per trip at scale; ordering, unit and boundary slips become systematic over- or under-charging.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
regression: credits after discount{"credit_used": 3646, "discount": 1823, "due": -1823, "reason": null}{"credit_used": 1823, "discount": 1823, "due": 0, "reason": null}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 ↗