FAILURE MAP
← Case archive

FA-9641 / Configuration / Open access

Environment variable projection: Explicit empty defaults are ignored · case 01

Explicit empty defaults are ignored.

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

ROOT CAUSE

The implementation substitutes elif default: for elif default is not None:, so explicit empty defaults are ignored.

VERIFIED REPAIR

Treat every non-None default as present.

Unsuccessful approach: The attempted repair substitutes elif default not in (None, ''):. Fixture 4 still yields {'PORT': 'missing'} instead of {'PORT': ''}.

Case contract

For declared variable names return exact present environment value, otherwise explicit default including empty values. Required missing values report missing; optional missing values are omitted. Prefix is prepended before lookup.

Why this case matters

An offline model of environment variable projection, suitable for testing build and release tooling without external services.

1 / The failure

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

N = 1
observations = []
def solve(declarations, environment, prefix):
    result = {}
    for name, default, required in declarations:
        key = prefix + name
        if key in environment: result[name] = environment[key]
        elif default: result[name] = default
        elif required: result[name] = 'missing'
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([], {}, 'APP_'), {})
check('fixture 2', solve([('PORT', None, True)], {'APP_PORT': '0'}, 'APP_'), {'PORT': '0'})
check('fixture 3', solve([('PORT', '80', True)], {'APP_PORT': ''}, 'APP_'), {'PORT': ''})
check('fixture 4', solve([('PORT', '', True)], {}, 'APP_'), {'PORT': ''})
check('fixture 5', solve([('PORT', None, True)], {}, 'APP_'), {'PORT': 'missing'})
check('fixture 6', solve([('PORT', None, False)], {}, 'APP_'), {})
check('fixture 7', solve([('PORT', '80', False)], {}, 'APP_'), {'PORT': '80'})
check('fixture 8', solve([('PORT', '80', True)], {'PORT': '90'}, 'APP_'), {'PORT': '80'})
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
fixture 1{}{}Passed
fixture 2{'PORT': '0'}{'PORT': '0'}Passed
fixture 3{'PORT': ''}{'PORT': ''}Passed
fixture 4{'PORT': 'missing'}{'PORT': ''}Failed
fixture 5{'PORT': 'missing'}{'PORT': 'missing'}Passed
fixture 6{}{}Passed
fixture 7{'PORT': '80'}{'PORT': '80'}Passed
fixture 8{'PORT': '80'}{'PORT': '80'}Passed

SHA-256 / 46d1364707a9f7ec41f1d58b61c82cf8bd54bbe99249e5d994935b097649858e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(declarations, environment, prefix):
    result = {}
    for name, default, required in declarations:
        key = prefix + name
        if key in environment: result[name] = environment[key]
        elif default not in (None, ''): result[name] = default
        elif required: result[name] = 'missing'
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([], {}, 'APP_'), {})
check('fixture 2', solve([('PORT', None, True)], {'APP_PORT': '0'}, 'APP_'), {'PORT': '0'})
check('fixture 3', solve([('PORT', '80', True)], {'APP_PORT': ''}, 'APP_'), {'PORT': ''})
check('fixture 4', solve([('PORT', '', True)], {}, 'APP_'), {'PORT': ''})
check('fixture 5', solve([('PORT', None, True)], {}, 'APP_'), {'PORT': 'missing'})
check('fixture 6', solve([('PORT', None, False)], {}, 'APP_'), {})
check('fixture 7', solve([('PORT', '80', False)], {}, 'APP_'), {'PORT': '80'})
check('fixture 8', solve([('PORT', '80', True)], {'PORT': '90'}, 'APP_'), {'PORT': '80'})
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
fixture 1{}{}Passed
fixture 2{'PORT': '0'}{'PORT': '0'}Passed
fixture 3{'PORT': ''}{'PORT': ''}Passed
fixture 4{'PORT': 'missing'}{'PORT': ''}Failed
fixture 5{'PORT': 'missing'}{'PORT': 'missing'}Passed
fixture 6{}{}Passed
fixture 7{'PORT': '80'}{'PORT': '80'}Passed
fixture 8{'PORT': '80'}{'PORT': '80'}Passed

SHA-256 / f2f8be44577f9a12c08bcac8b37481aa99cc29583d627b1a7fd7becd5f7b33b9

3 / The verified repair

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

N = 1
observations = []
def solve(declarations, environment, prefix):
    result = {}
    for name, default, required in declarations:
        key = prefix + name
        if key in environment: result[name] = environment[key]
        elif default is not None: result[name] = default
        elif required: result[name] = 'missing'
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([], {}, 'APP_'), {})
check('fixture 2', solve([('PORT', None, True)], {'APP_PORT': '0'}, 'APP_'), {'PORT': '0'})
check('fixture 3', solve([('PORT', '80', True)], {'APP_PORT': ''}, 'APP_'), {'PORT': ''})
check('fixture 4', solve([('PORT', '', True)], {}, 'APP_'), {'PORT': ''})
check('fixture 5', solve([('PORT', None, True)], {}, 'APP_'), {'PORT': 'missing'})
check('fixture 6', solve([('PORT', None, False)], {}, 'APP_'), {})
check('fixture 7', solve([('PORT', '80', False)], {}, 'APP_'), {'PORT': '80'})
check('fixture 8', solve([('PORT', '80', True)], {'PORT': '90'}, 'APP_'), {'PORT': '80'})
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
fixture 1{}{}Passed
fixture 2{'PORT': '0'}{'PORT': '0'}Passed
fixture 3{'PORT': ''}{'PORT': ''}Passed
fixture 4{'PORT': ''}{'PORT': ''}Passed
fixture 5{'PORT': 'missing'}{'PORT': 'missing'}Passed
fixture 6{}{}Passed
fixture 7{'PORT': '80'}{'PORT': '80'}Passed
fixture 8{'PORT': '80'}{'PORT': '80'}Passed

SHA-256 / 49862693840bf82a6bde42dcd4a36b72a4730be0c206287b424f5c752a899d5e

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

Case digest / 5f52e894745f04834c1a6565b073fc9bed95044d041d6120fce148e3ca03b76a