{"abstract":"The semaphore grant operation is admitted even though a later small request overtakes the queued weighted head.","category":"Concurrency","checks":9,"contract":"Return a Boolean admission decision for grant permits from a distributed semaphore. The record r must satisfy all of: r['permit_capacity'][0]+r['permit_capacity'][1] <= r['permit_capacity'][2]; r['positive_request'] > 0; r['request_not_granted'][0] not in r['request_not_granted'][1]; r['weighted_fifo'][0] == r['weighted_fifo'][1][0]; r['grant_session'] in ['active']. Extra tracing fields are ignored; validation does not mutate the record.","evaluation_group":"xd-semaphore-grant","failed_approach":"Adding the weighted fifo check repairs the reported defect, but replacing the adjacent grant session check loses that independent invariant.","family":"xd-semaphore-grant-weighted_fifo","id":"FA-1391","implementations":{"attempt":{"sha256":"8c4a361fcc16f209274c33dbf4af0c7d4b0f8a10c12b6340533b75c8a2dacf08","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(r):\n    return (r['permit_capacity'][0]+r['permit_capacity'][1] <= r['permit_capacity'][2]) and (r['positive_request'] > 0) and (r['request_not_granted'][0] not in r['request_not_granted'][1]) and (r['weighted_fifo'][0] == r['weighted_fifo'][1][0])\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nr = {'permit_capacity': [3, 2, 5], 'positive_request': 1, 'request_not_granted': ['r2', ['r1']], 'weighted_fifo': ['big', ['big', 'small']], 'grant_session': 'active'}\ncheck('valid operation', solve(r), True)\ncheck('The grant exceeds the configured total permit count', solve(dict(r, **{'permit_capacity': [4, 2, 5]})), False)\ncheck('A zero or negative grant corrupts permit accounting', solve(dict(r, **{'positive_request': 0})), False)\ncheck('A retried grant allocates the same request twice', solve(dict(r, **{'request_not_granted': ['r1', ['r1']]})), False)\ncheck('A later small request overtakes the queued weighted head', solve(dict(r, **{'weighted_fifo': ['small', ['big', 'small']]})), False)\ncheck('A session destroyed while waiting receives permits', solve(dict(r, **{'grant_session': 'closed'})), False)\ncheck('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)\ncheck('repeat validation is pure', solve(r), True)\ninvalid = {'permit_capacity': [4, 2, 5], 'positive_request': 0, 'request_not_granted': ['r1', ['r1']], 'weighted_fifo': ['small', ['big', 'small']], 'grant_session': 'closed'}\nkeys = list(invalid)\npair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}\ncheck('two independent violations in variant', solve(dict(r, **pair)), False)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"63e47c28a578f188a99371c649df7d952a6e0a78fa25a99f849422b62ea66363","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(r):\n    return (r['permit_capacity'][0]+r['permit_capacity'][1] <= r['permit_capacity'][2]) and (r['positive_request'] > 0) and (r['request_not_granted'][0] not in r['request_not_granted'][1]) and (r['grant_session'] in ['active'])\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nr = {'permit_capacity': [3, 2, 5], 'positive_request': 1, 'request_not_granted': ['r2', ['r1']], 'weighted_fifo': ['big', ['big', 'small']], 'grant_session': 'active'}\ncheck('valid operation', solve(r), True)\ncheck('The grant exceeds the configured total permit count', solve(dict(r, **{'permit_capacity': [4, 2, 5]})), False)\ncheck('A zero or negative grant corrupts permit accounting', solve(dict(r, **{'positive_request': 0})), False)\ncheck('A retried grant allocates the same request twice', solve(dict(r, **{'request_not_granted': ['r1', ['r1']]})), False)\ncheck('A later small request overtakes the queued weighted head', solve(dict(r, **{'weighted_fifo': ['small', ['big', 'small']]})), False)\ncheck('A session destroyed while waiting receives permits', solve(dict(r, **{'grant_session': 'closed'})), False)\ncheck('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)\ncheck('repeat validation is pure', solve(r), True)\ninvalid = {'permit_capacity': [4, 2, 5], 'positive_request': 0, 'request_not_granted': ['r1', ['r1']], 'weighted_fifo': ['small', ['big', 'small']], 'grant_session': 'closed'}\nkeys = list(invalid)\npair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}\ncheck('two independent violations in variant', solve(dict(r, **pair)), False)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"a11e2ba6a0891119d35921dbf86a983fbccb1841608df63888f86a6c46b994a6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(r):\n    return (r['permit_capacity'][0]+r['permit_capacity'][1] <= r['permit_capacity'][2]) and (r['positive_request'] > 0) and (r['request_not_granted'][0] not in r['request_not_granted'][1]) and (r['weighted_fifo'][0] == r['weighted_fifo'][1][0]) and (r['grant_session'] in ['active'])\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nr = {'permit_capacity': [3, 2, 5], 'positive_request': 1, 'request_not_granted': ['r2', ['r1']], 'weighted_fifo': ['big', ['big', 'small']], 'grant_session': 'active'}\ncheck('valid operation', solve(r), True)\ncheck('The grant exceeds the configured total permit count', solve(dict(r, **{'permit_capacity': [4, 2, 5]})), False)\ncheck('A zero or negative grant corrupts permit accounting', solve(dict(r, **{'positive_request': 0})), False)\ncheck('A retried grant allocates the same request twice', solve(dict(r, **{'request_not_granted': ['r1', ['r1']]})), False)\ncheck('A later small request overtakes the queued weighted head', solve(dict(r, **{'weighted_fifo': ['small', ['big', 'small']]})), False)\ncheck('A session destroyed while waiting receives permits', solve(dict(r, **{'grant_session': 'closed'})), False)\ncheck('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)\ncheck('repeat validation is pure', solve(r), True)\ninvalid = {'permit_capacity': [4, 2, 5], 'positive_request': 0, 'request_not_granted': ['r1', ['r1']], 'weighted_fifo': ['small', ['big', 'small']], 'grant_session': 'closed'}\nkeys = list(invalid)\npair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}\ncheck('two independent violations in variant', solve(dict(r, **pair)), False)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":" 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xd-semaphore-grant-weighted_fifo","generated_at":"2026-09-29T14:37:01.719433+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic local contract for concurrency. Each negative fixture violates exactly one invariant. No transport timing, persistence, cryptographic verification, or full protocol implementation is claimed.","repair":"Require r['weighted_fifo'][0] == r['weighted_fifo'][1][0] together with every other stated precondition before accepting the operation.","root_cause":"The admission path omits the weighted fifo invariant while validating the other operation preconditions.","sha256":"93b6234f6e5e712021fcd3c7d48c497ca8ec5a0dea441e050be886a7ec48f3f6","title":"Grant permits from a distributed semaphore: A later small request overtakes the queued weighted head · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":30.172,"exit_code":1,"observations":[{"actual":true,"check":"valid operation","expected":true,"passed":true},{"actual":false,"check":"The grant exceeds the configured total permit count","expected":false,"passed":true},{"actual":false,"check":"A zero or negative grant corrupts permit accounting","expected":false,"passed":true},{"actual":false,"check":"A retried grant allocates the same request twice","expected":false,"passed":true},{"actual":false,"check":"A later small request overtakes the queued weighted head","expected":false,"passed":true},{"actual":true,"check":"A session destroyed while waiting receives permits","expected":false,"passed":false},{"actual":true,"check":"unrelated tracing metadata","expected":true,"passed":true},{"actual":true,"check":"repeat validation is pure","expected":true,"passed":true},{"actual":false,"check":"two independent violations in variant","expected":false,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"valid operation\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"The grant exceeds the configured total permit count\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A zero or negative grant corrupts permit accounting\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A retried grant allocates the same request twice\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A later small request overtakes the queued weighted head\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A session destroyed while waiting receives permits\", \"actual\": true, \"expected\": false, \"passed\": false}, {\"check\": \"unrelated tracing metadata\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"repeat validation is pure\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"two independent violations in variant\", \"actual\": false, \"expected\": false, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.481,"exit_code":1,"observations":[{"actual":true,"check":"valid operation","expected":true,"passed":true},{"actual":false,"check":"The grant exceeds the configured total permit count","expected":false,"passed":true},{"actual":false,"check":"A zero or negative grant corrupts permit accounting","expected":false,"passed":true},{"actual":false,"check":"A retried grant allocates the same request twice","expected":false,"passed":true},{"actual":true,"check":"A later small request overtakes the queued weighted head","expected":false,"passed":false},{"actual":false,"check":"A session destroyed while waiting receives permits","expected":false,"passed":true},{"actual":true,"check":"unrelated tracing metadata","expected":true,"passed":true},{"actual":true,"check":"repeat validation is pure","expected":true,"passed":true},{"actual":false,"check":"two independent violations in variant","expected":false,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"valid operation\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"The grant exceeds the configured total permit count\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A zero or negative grant corrupts permit accounting\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A retried grant allocates the same request twice\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A later small request overtakes the queued weighted head\", \"actual\": true, \"expected\": false, \"passed\": false}, {\"check\": \"A session destroyed while waiting receives permits\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"unrelated tracing metadata\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"repeat validation is pure\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"two independent violations in variant\", \"actual\": false, \"expected\": false, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":35.951,"exit_code":0,"observations":[{"actual":true,"check":"valid operation","expected":true,"passed":true},{"actual":false,"check":"The grant exceeds the configured total permit count","expected":false,"passed":true},{"actual":false,"check":"A zero or negative grant corrupts permit accounting","expected":false,"passed":true},{"actual":false,"check":"A retried grant allocates the same request twice","expected":false,"passed":true},{"actual":false,"check":"A later small request overtakes the queued weighted head","expected":false,"passed":true},{"actual":false,"check":"A session destroyed while waiting receives permits","expected":false,"passed":true},{"actual":true,"check":"unrelated tracing metadata","expected":true,"passed":true},{"actual":true,"check":"repeat validation is pure","expected":true,"passed":true},{"actual":false,"check":"two independent violations in variant","expected":false,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"valid operation\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"The grant exceeds the configured total permit count\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A zero or negative grant corrupts permit accounting\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A retried grant allocates the same request twice\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A later small request overtakes the queued weighted head\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"A session destroyed while waiting receives permits\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"unrelated tracing metadata\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"repeat validation is pure\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"two independent violations in variant\", \"actual\": false, \"expected\": false, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}