FA-3641 / Binary formats / Open access
A packed field includes adjacent flag bits · case 01
A packed field includes adjacent flag bits.
ROOT CAUSE
The implementation applies an operation whose text or grammar semantics violate this contract: Extract bits 2 through 4 as a three-bit unsigned field.
VERIFIED REPAIR
Implement the complete stated contract, including the boundary fixtures: Extract bits 2 through 4 as a three-bit unsigned field.
Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.
Case contract
Extract bits 2 through 4 as a three-bit unsigned field.
Why this case matters
A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap
N = 1
observations = []
def solve(x):
try:
return x>>2
except Exception as exc:
return {"error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(255), 7)
check('boundary 2', solve(20), 5)
check('boundary 3', solve(3), 0)
check('boundary 4', solve(0), 0)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | 63 | 7 | Failed |
| boundary 2 | 5 | 5 | Passed |
| boundary 3 | 0 | 0 | Passed |
| boundary 4 | 0 | 0 | Passed |
SHA-256 / 2ea17ee39f5a235450f47426b032b09c4c9d369fe84683ec8ee7c11ec4671f8c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap
N = 1
observations = []
def solve(x):
try:
return x&28
except Exception as exc:
return {"error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(255), 7)
check('boundary 2', solve(20), 5)
check('boundary 3', solve(3), 0)
check('boundary 4', solve(0), 0)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | 28 | 7 | Failed |
| boundary 2 | 20 | 5 | Failed |
| boundary 3 | 0 | 0 | Passed |
| boundary 4 | 0 | 0 | Passed |
SHA-256 / 7b98d61649946e00eaf0c4b8f5d0318cdf165b38e21c2fd81828d35576955d2e
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap
N = 1
observations = []
def solve(x):
try:
return (x>>2)&7
except Exception as exc:
return {"error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve(255), 7)
check('boundary 2', solve(20), 5)
check('boundary 3', solve(3), 0)
check('boundary 4', solve(0), 0)
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | 7 | 7 | Passed |
| boundary 2 | 5 | 5 | Passed |
| boundary 3 | 0 | 0 | Passed |
| boundary 4 | 0 | 0 | Passed |
SHA-256 / b5a344d5959f0d7bf6c4cc724d29c4b4bb8d5ad5a75733c5881c62a835224dea
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:37:28.884455+00:00.
Case digest / 8363e66d5c1f932002a7a409d5e1e239b3a73375e231e12953c64ba5c786759b