FAILURE MAP
← Case archive

FA-761 / Queues / Open access

Reserve a queued message for delivery: A second worker reserves a currently leased message · case 01

The queue reservation operation is admitted even though a second worker reserves a currently leased message.

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

ROOT CAUSE

The admission path omits the no live reservation invariant while validating the other operation preconditions.

VERIFIED REPAIR

Require r['no_live_reservation'][0] is None or r['no_live_reservation'][1] >= r['no_live_reservation'][0] together with every other stated precondition before accepting the operation.

Unsuccessful approach: Adding the no live reservation check repairs the reported defect, but replacing the adjacent consumer credit 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['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 messageTrueFalseFailed
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 / d4c6193a29f2c6b92304693ac7f8dc112db5e97546c999c4db29ce99efed41b9

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['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

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

Case digest / 372b37f3b95587356378c3a44c47b0ca673d236d6fa31a95fbd560c45db109e4