FAILURE MAP
← Case archive

FA-66691 / Airline fare rule evaluation / Open access

Only the outbound surcharge multiplied by passengers · case 01

A family of four is charged four outbound weekend surcharges but a single inbound one.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The passenger multiplier is applied to the outbound amount only.

THE FAILURE

The passenger multiplier is applied to the outbound amount only.

Unsuccessful approach: Keeping the final multiplier as well squares the outbound passenger count.

Case contract

Input {'outbound','inbound' (ISO or None),'weekend_days' ISO digits,'surcharge','rt_rule' EACH|OUTBOUND,'pax'}. Each direction is surcharged by its own departure weekday; with OUTBOUND only the outbound direction is assessed. The per-passenger total is multiplied by pax.

Why this case matters

Day-of-week surcharges are assessed per fare component on its own travel date, and the rule may restrict assessment to the outbound direction.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    wk = x['weekend_days']
    def sur(ds):
        return x['surcharge'] if str(datetime.date.fromisoformat(ds).isoweekday()) in wk else 0
    total = sur(x['outbound']) * x['pax']
    if x['inbound'] is not None and x['rt_rule'] == 'EACH':
        total += sur(x['inbound'])
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['weekday out weekend back', {'outbound': '2027-03-02', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-16', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 1}, 30], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-14', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-04', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2027-08-29', 'inbound': '2027-09-14', 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 5}, 125], ['sampled case 2', {'outbound': '2029-05-04', 'inbound': '2029-05-06', 'weekend_days': '7', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 4}, 40], ['sampled case 3', {'outbound': '2029-02-23', 'inbound': '2029-03-13', 'weekend_days': '57', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 1}, 10]], [['weekday out weekend back', {'outbound': '2027-03-03', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-17', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 2}, 60], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-03', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2029-10-08', 'inbound': None, 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 2', {'outbound': '2028-10-14', 'inbound': '2028-10-29', 'weekend_days': '57', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 4}, 0], ['sampled case 3', {'outbound': '2027-01-22', 'inbound': '2027-01-27', 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 3}, 0]], [['weekday out weekend back', {'outbound': '2027-03-01', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-15', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 3}, 90], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-14', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-04', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2028-10-14', 'inbound': None, 'weekend_days': '7', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 5}, 0], ['sampled case 2', {'outbound': '2027-03-30', 'inbound': '2027-04-13', 'weekend_days': '7', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 4}, 0], ['sampled case 3', {'outbound': '2028-09-18', 'inbound': '2028-09-29', 'weekend_days': '67', 'surcharge': 10, 'rt_rule': 'OUTBOUND', 'pax': 4}, 0]], [['weekday out weekend back', {'outbound': '2027-03-02', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-16', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 4}, 120], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-03', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2029-09-11', 'inbound': '2029-09-13', 'weekend_days': '57', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 4}, 0], ['sampled case 2', {'outbound': '2027-09-08', 'inbound': None, 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 4}, 0], ['sampled case 3', {'outbound': '2028-08-06', 'inbound': '2028-08-16', 'weekend_days': '57', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 2}, 60]], [['weekday out weekend back', {'outbound': '2027-03-03', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-17', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 5}, 150], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-14', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-04', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2029-06-29', 'inbound': '2029-07-16', 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 2}, 0], ['sampled case 2', {'outbound': '2028-01-20', 'inbound': None, 'weekend_days': '57', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 1}, 0], ['sampled case 3', {'outbound': '2028-07-21', 'inbound': None, 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 4}, 100]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
weekday out weekend back2550Failed
weekend out weekday back2525Passed
outbound-only rule3030Passed
one-way weekend9090Passed
both weekend family100160Failed
no surcharge00Passed
sampled case 1125125Passed
sampled case 21040Failed
sampled case 31010Passed

SHA-256 / 478f546583e768a7ff9cc7b3577a379084cf857a3702310662ef0ecc1884eee2

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
N = 1
observations = []
def solve(x):
    wk = x['weekend_days']
    def sur(ds):
        return x['surcharge'] if str(datetime.date.fromisoformat(ds).isoweekday()) in wk else 0
    total = sur(x['outbound']) * x['pax']
    if x['inbound'] is not None and x['rt_rule'] == 'EACH':
        total += sur(x['inbound'])
    return total * x['pax']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['weekday out weekend back', {'outbound': '2027-03-02', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-16', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 1}, 30], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-14', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-04', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2027-08-29', 'inbound': '2027-09-14', 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 5}, 125], ['sampled case 2', {'outbound': '2029-05-04', 'inbound': '2029-05-06', 'weekend_days': '7', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 4}, 40], ['sampled case 3', {'outbound': '2029-02-23', 'inbound': '2029-03-13', 'weekend_days': '57', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 1}, 10]], [['weekday out weekend back', {'outbound': '2027-03-03', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-17', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 2}, 60], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-03', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2029-10-08', 'inbound': None, 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 2', {'outbound': '2028-10-14', 'inbound': '2028-10-29', 'weekend_days': '57', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 4}, 0], ['sampled case 3', {'outbound': '2027-01-22', 'inbound': '2027-01-27', 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 3}, 0]], [['weekday out weekend back', {'outbound': '2027-03-01', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-15', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 3}, 90], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-14', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-04', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2028-10-14', 'inbound': None, 'weekend_days': '7', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 5}, 0], ['sampled case 2', {'outbound': '2027-03-30', 'inbound': '2027-04-13', 'weekend_days': '7', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 4}, 0], ['sampled case 3', {'outbound': '2028-09-18', 'inbound': '2028-09-29', 'weekend_days': '67', 'surcharge': 10, 'rt_rule': 'OUTBOUND', 'pax': 4}, 0]], [['weekday out weekend back', {'outbound': '2027-03-02', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-16', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 4}, 120], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-03', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2029-09-11', 'inbound': '2029-09-13', 'weekend_days': '57', 'surcharge': 10, 'rt_rule': 'EACH', 'pax': 4}, 0], ['sampled case 2', {'outbound': '2027-09-08', 'inbound': None, 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 4}, 0], ['sampled case 3', {'outbound': '2028-08-06', 'inbound': '2028-08-16', 'weekend_days': '57', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 2}, 60]], [['weekday out weekend back', {'outbound': '2027-03-03', 'inbound': '2027-03-13', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 2}, 50], ['weekend out weekday back', {'outbound': '2027-03-12', 'inbound': '2027-03-17', 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'EACH', 'pax': 1}, 25], ['outbound-only rule', {'outbound': '2027-03-13', 'inbound': '2027-03-20', 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 5}, 150], ['one-way weekend', {'outbound': '2027-03-14', 'inbound': None, 'weekend_days': '67', 'surcharge': 30, 'rt_rule': 'EACH', 'pax': 3}, 90], ['both weekend family', {'outbound': '2027-03-12', 'inbound': '2027-03-14', 'weekend_days': '567', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 4}, 160], ['no surcharge', {'outbound': '2027-03-02', 'inbound': '2027-03-04', 'weekend_days': '67', 'surcharge': 20, 'rt_rule': 'EACH', 'pax': 2}, 0], ['sampled case 1', {'outbound': '2029-06-29', 'inbound': '2029-07-16', 'weekend_days': '7', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 2}, 0], ['sampled case 2', {'outbound': '2028-01-20', 'inbound': None, 'weekend_days': '57', 'surcharge': 30, 'rt_rule': 'OUTBOUND', 'pax': 1}, 0], ['sampled case 3', {'outbound': '2028-07-21', 'inbound': None, 'weekend_days': '567', 'surcharge': 25, 'rt_rule': 'OUTBOUND', 'pax': 4}, 100]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
weekday out weekend back5050Passed
weekend out weekday back2525Passed
outbound-only rule3030Passed
one-way weekend27090Failed
both weekend family400160Failed
no surcharge00Passed
sampled case 1625125Failed
sampled case 24040Passed
sampled case 31010Passed

SHA-256 / 3efae9bb9af563d4b705108062c3b0edc3ed6d73aab24e49f2e750902677128a

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A stipulated toy fare-rule contract with invented constants; it is not an ATPCO or carrier tariff implementation and makes no claim of industry-standard conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:46.182048+00:00.

Case digest / da741a9d03642bfb853df48cd575f23292700bbb557b828164c01c71ff189b82