FAILURE MAP
← Case archive

FA-3636 / Binary formats / Open access

Testing a flag requires every bit to equal the mask · case 01

Testing a flag requires every bit to equal the mask.

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

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Return whether bit three is set, regardless of other bits.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Return whether bit three is set, regardless of other bits.

Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.

Case contract

Return whether bit three is set, regardless of other bits.

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==8
    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(9), True)
check('boundary 2', solve(16), False)
check('boundary 3', solve(8), True)
check('boundary 4', solve(0), 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
boundary 1FalseTrueFailed
boundary 2FalseFalsePassed
boundary 3TrueTruePassed
boundary 4FalseFalsePassed

SHA-256 / f3d3711257f87330e95db11b9837d51ae3ecb85efabb01403a99ce25a6e37375

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>=8
    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(9), True)
check('boundary 2', solve(16), False)
check('boundary 3', solve(8), True)
check('boundary 4', solve(0), 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
boundary 1TrueTruePassed
boundary 2TrueFalseFailed
boundary 3TrueTruePassed
boundary 4FalseFalsePassed

SHA-256 / ca1a3b70fcb5cefff90ac39b3b2b7697afd06c54dd9298fe8c9613b9b3679686

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 bool(x&8)
    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(9), True)
check('boundary 2', solve(16), False)
check('boundary 3', solve(8), True)
check('boundary 4', solve(0), 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
boundary 1TrueTruePassed
boundary 2FalseFalsePassed
boundary 3TrueTruePassed
boundary 4FalseFalsePassed

SHA-256 / 1e1a9c40d8198e8e190ae7ba518ffd8be05cea957f6c533bdf29d8f8102562b2

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

Case digest / 428f4d5213db79a6b4de1ee4d5e7a5a3a16de4195323e440155181ade88b7e9d