{"abstract":"The semaphore grant operation is admitted even though the grant exceeds the configured total permit count.","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.","contract_signature":"r","evaluation_group":"xd-semaphore-grant","failed_approach":"Adding the permit capacity check repairs the reported defect, but replacing the adjacent positive request check loses that independent invariant.","family":"xd-semaphore-grant-permit_capacity","id":"FA-1376","implementations":{"attempt":{"sha256":"2438cb4b2fa93168131114187e195f410b37c3964c5c22c26e9a829f0f38b6e3","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['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"},"broken":{"sha256":"1948061f19f7b7d659a1d56bf08c0a23183402a9a2568b0c39d3747f4d1398ed","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(r):\n    return (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-permit_capacity","generated_at":"2026-09-29T14:37:01.713615+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.","root_cause":"The admission path omits the permit capacity invariant while validating the other operation preconditions.","sha256":"6b292f77ff4c0ee2a5b4336879d52ed79ce68618610564cb7a5d31aec1eb981f","title":"Grant permits from a distributed semaphore: The grant exceeds the configured total permit count · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":129.124,"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":true,"check":"A zero or negative grant corrupts permit accounting","expected":false,"passed":false},{"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":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\": true, \"expected\": false, \"passed\": false}, {\"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\": false}\n"},"broken":{"elapsed_ms":30.002,"exit_code":1,"observations":[{"actual":true,"check":"valid operation","expected":true,"passed":true},{"actual":true,"check":"The grant exceeds the configured total permit count","expected":false,"passed":false},{"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":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"valid operation\", \"actual\": true, \"expected\": true, \"passed\": true}, {\"check\": \"The grant exceeds the configured total permit count\", \"actual\": true, \"expected\": false, \"passed\": false}, {\"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\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}