FAILURE MAP
← Case archive

FA-766 / Queues / Open access

Reserve a queued message for delivery: The broker exceeds consumer in-flight credit · case 01

The queue reservation operation is admitted even though the broker exceeds consumer in-flight credit.

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

ROOT CAUSE

The admission path omits the consumer credit invariant while validating the other operation preconditions.

VERIFIED REPAIR

Require r['consumer_credit'][0] < r['consumer_credit'][1] together with every other stated precondition before accepting the operation.

Unsuccessful approach: Adding the consumer credit check repairs the reported defect, but replacing the adjacent group head check loses that independent invariant.

Case contract

Return a Boolean admission decision for reserve a queued message for delivery. The record r must satisfy all of: r['visible_now'][0] >= r['visible_now'][1]; r['not_expired'][0] < r['not_expired'][1]; r['no_live_reservation'][0] is None or r['no_live_reservation'][1] >= r['no_live_reservation'][0]; r['consumer_credit'][0] < r['consumer_credit'][1]; r['group_head'][0] == min(r['group_head'][1]). Extra tracing fields are ignored; validation does not mutate the record.

Why this case matters

A deterministic local contract for queues. Each negative fixture violates exactly one invariant. No transport timing, persistence, cryptographic verification, or full protocol implementation is claimed.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['visible_now'][0] >= r['visible_now'][1]) and (r['not_expired'][0] < r['not_expired'][1]) and (r['no_live_reservation'][0] is None or r['no_live_reservation'][1] >= r['no_live_reservation'][0]) and (r['group_head'][0] == min(r['group_head'][1]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'visible_now': [10, 10], 'not_expired': [9, 10], 'no_live_reservation': [8, 8], 'consumer_credit': [2, 3], 'group_head': [3, [3, 4]]}
check('valid operation', solve(r), True)
check('A scheduled message is delivered before its visibility instant', solve(dict(r, **{'visible_now': [9, 10]})), False)
check('A message is delivered after its expiration deadline', solve(dict(r, **{'not_expired': [10, 10]})), False)
check('A second worker reserves a currently leased message', solve(dict(r, **{'no_live_reservation': [9, 8]})), False)
check('The broker exceeds consumer in-flight credit', solve(dict(r, **{'consumer_credit': [3, 3]})), False)
check('A FIFO message overtakes an earlier group member', solve(dict(r, **{'group_head': [4, [3, 4]]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'visible_now': [9, 10], 'not_expired': [10, 10], 'no_live_reservation': [9, 8], 'consumer_credit': [3, 3], 'group_head': [4, [3, 4]]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
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
valid operationTrueTruePassed
A scheduled message is delivered before its visibility instantFalseFalsePassed
A message is delivered after its expiration deadlineFalseFalsePassed
A second worker reserves a currently leased messageFalseFalsePassed
The broker exceeds consumer in-flight creditTrueFalseFailed
A FIFO message overtakes an earlier group memberFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / ad34aabd8ab7cc1856924abfa26fb1818839ac7f030324cbfcd2f9d2c4bd4615

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['visible_now'][0] >= r['visible_now'][1]) and (r['not_expired'][0] < r['not_expired'][1]) and (r['no_live_reservation'][0] is None or r['no_live_reservation'][1] >= r['no_live_reservation'][0]) and (r['consumer_credit'][0] < r['consumer_credit'][1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'visible_now': [10, 10], 'not_expired': [9, 10], 'no_live_reservation': [8, 8], 'consumer_credit': [2, 3], 'group_head': [3, [3, 4]]}
check('valid operation', solve(r), True)
check('A scheduled message is delivered before its visibility instant', solve(dict(r, **{'visible_now': [9, 10]})), False)
check('A message is delivered after its expiration deadline', solve(dict(r, **{'not_expired': [10, 10]})), False)
check('A second worker reserves a currently leased message', solve(dict(r, **{'no_live_reservation': [9, 8]})), False)
check('The broker exceeds consumer in-flight credit', solve(dict(r, **{'consumer_credit': [3, 3]})), False)
check('A FIFO message overtakes an earlier group member', solve(dict(r, **{'group_head': [4, [3, 4]]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'visible_now': [9, 10], 'not_expired': [10, 10], 'no_live_reservation': [9, 8], 'consumer_credit': [3, 3], 'group_head': [4, [3, 4]]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
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
valid operationTrueTruePassed
A scheduled message is delivered before its visibility instantFalseFalsePassed
A message is delivered after its expiration deadlineFalseFalsePassed
A second worker reserves a currently leased messageFalseFalsePassed
The broker exceeds consumer in-flight creditFalseFalsePassed
A FIFO message overtakes an earlier group memberTrueFalseFailed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 66da9dd01d43a0e3af80b8cd13127e92a97219d7f24e9f235e3ee5ead0983e2a

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(r):
    return (r['visible_now'][0] >= r['visible_now'][1]) and (r['not_expired'][0] < r['not_expired'][1]) and (r['no_live_reservation'][0] is None or r['no_live_reservation'][1] >= r['no_live_reservation'][0]) and (r['consumer_credit'][0] < r['consumer_credit'][1]) and (r['group_head'][0] == min(r['group_head'][1]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'visible_now': [10, 10], 'not_expired': [9, 10], 'no_live_reservation': [8, 8], 'consumer_credit': [2, 3], 'group_head': [3, [3, 4]]}
check('valid operation', solve(r), True)
check('A scheduled message is delivered before its visibility instant', solve(dict(r, **{'visible_now': [9, 10]})), False)
check('A message is delivered after its expiration deadline', solve(dict(r, **{'not_expired': [10, 10]})), False)
check('A second worker reserves a currently leased message', solve(dict(r, **{'no_live_reservation': [9, 8]})), False)
check('The broker exceeds consumer in-flight credit', solve(dict(r, **{'consumer_credit': [3, 3]})), False)
check('A FIFO message overtakes an earlier group member', solve(dict(r, **{'group_head': [4, [3, 4]]})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'visible_now': [9, 10], 'not_expired': [10, 10], 'no_live_reservation': [9, 8], 'consumer_credit': [3, 3], 'group_head': [4, [3, 4]]}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
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
valid operationTrueTruePassed
A scheduled message is delivered before its visibility instantFalseFalsePassed
A message is delivered after its expiration deadlineFalseFalsePassed
A second worker reserves a currently leased messageFalseFalsePassed
The broker exceeds consumer in-flight creditFalseFalsePassed
A FIFO message overtakes an earlier group memberFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 48333992f7c8ce500cdb511f83a969a0eec47a39be19e230a59947c8b1e5284c

Verification & scope

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:36:55.646214+00:00.

Case digest / 3ec6dcd0d387074c27a8219a69957aa1ad958ba983dc1b5af88cd1474cf8534e