FAILURE MAP
← Case archive

FA-8566 / Form validation / Open access

Constraint validation priority: Optional blank fields are subjected to a pattern failure · case 01

Optional blank fields are subjected to a pattern failure.

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

ROOT CAUSE

The optional empty operation uses `if value == '': return 'pattern'` where the contract requires `if value == '': return None`.

THE FAILURE

The optional empty operation uses `if value == '': return 'pattern'` where the contract requires `if value == '': return None`.

Unsuccessful approach: Blank optional values do not violate numeric minima either.

Case contract

Required checks distinguish blank from zero; malformed input precedes numeric checks; optional blank is valid; min/max are inclusive; pattern applies last.

Why this case matters

A deterministic model of constraint validation priority; this isolates one interface invariant without requiring a browser.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(required, value, bad_input, minimum, maximum, pattern_ok):
    if required and value == '': return 'required'
    if bad_input: return 'bad-input'
    if value == '': return 'pattern'
    if minimum is not None and value < minimum: return 'underflow'
    if maximum is not None and value > maximum: return 'overflow'
    if not pattern_ok: return 'pattern'
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(True, 0, False, 0, 5, True), None)
check('optional blank', solve(False, '', False, 1, 5, False), None)
check('required blank', solve(True, '', False, None, None, True), 'required')
check('bad', solve(False, 'oops', True, None, None, True), 'bad-input')
check('at min', solve(False, 2, False, 2, 5, True), None)
check('below min', solve(False, 1, False, 2, 5, True), 'underflow')
check('at max', solve(False, 5, False, 2, 5, True), None)
check('above max', solve(False, 6, False, 2, 5, True), 'overflow')
check('parameterized minimum', solve(False,N,False,N,N+10,True), None)
for repetition in range(N):
    check('repeat above max', solve(False, 6, False, 2, 5, True), 'overflow')
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
zeroNoneNonePassed
optional blankpatternNoneFailed
required blankrequiredrequiredPassed
badbad-inputbad-inputPassed
at minNoneNonePassed
below minunderflowunderflowPassed
at maxNoneNonePassed
above maxoverflowoverflowPassed
parameterized minimumNoneNonePassed
repeat above maxoverflowoverflowPassed

SHA-256 / 25bc023cd6fcd91fff5e352d0b8d2986bacf4c089f03269fdcce1c0c21d055d6

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(required, value, bad_input, minimum, maximum, pattern_ok):
    if required and value == '': return 'required'
    if bad_input: return 'bad-input'
    if value == '': return 'underflow'
    if minimum is not None and value < minimum: return 'underflow'
    if maximum is not None and value > maximum: return 'overflow'
    if not pattern_ok: return 'pattern'
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(True, 0, False, 0, 5, True), None)
check('optional blank', solve(False, '', False, 1, 5, False), None)
check('required blank', solve(True, '', False, None, None, True), 'required')
check('bad', solve(False, 'oops', True, None, None, True), 'bad-input')
check('at min', solve(False, 2, False, 2, 5, True), None)
check('below min', solve(False, 1, False, 2, 5, True), 'underflow')
check('at max', solve(False, 5, False, 2, 5, True), None)
check('above max', solve(False, 6, False, 2, 5, True), 'overflow')
check('parameterized minimum', solve(False,N,False,N,N+10,True), None)
for repetition in range(N):
    check('repeat above max', solve(False, 6, False, 2, 5, True), 'overflow')
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
zeroNoneNonePassed
optional blankunderflowNoneFailed
required blankrequiredrequiredPassed
badbad-inputbad-inputPassed
at minNoneNonePassed
below minunderflowunderflowPassed
at maxNoneNonePassed
above maxoverflowoverflowPassed
parameterized minimumNoneNonePassed
repeat above maxoverflowoverflowPassed

SHA-256 / 5d557ca0e7e0db4acde182616b3765252ccdebe736e8387b2b2c513468218a61

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 10 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 19fe5159fced9304968e6fe64e9df6606b6b76cc3f3d4cca2ea29b83564d82ff