FA-9651 / Configuration / Open access
Environment variable projection: Optional absent variables become missing errors · case 01
Optional absent variables become missing errors.
ROOT CAUSE
The implementation substitutes elif True: for elif required:, so optional absent variables become missing errors.
VERIFIED REPAIR
Omit optional undeclared values.
Unsuccessful approach: The attempted repair substitutes elif not required:. Fixture 5 still yields {} instead of {'PORT': 'missing'}.
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 is not None: result[name] = default
elif True: 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 | {'PORT': 'missing'} | {} | Failed |
| fixture 7 | {'PORT': '80'} | {'PORT': '80'} | Passed |
| fixture 8 | {'PORT': '80'} | {'PORT': '80'} | Passed |
SHA-256 / 0883686c72745e7a38cf2d32271d438f987ea2930845e4b95d616b60cafc02c9
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 is not None: result[name] = default
elif not 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {} | {} | Passed |
| fixture 2 | {'PORT': '0'} | {'PORT': '0'} | Passed |
| fixture 3 | {'PORT': ''} | {'PORT': ''} | Passed |
| fixture 4 | {'PORT': ''} | {'PORT': ''} | Passed |
| fixture 5 | {} | {'PORT': 'missing'} | Failed |
| fixture 6 | {'PORT': 'missing'} | {} | Failed |
| fixture 7 | {'PORT': '80'} | {'PORT': '80'} | Passed |
| fixture 8 | {'PORT': '80'} | {'PORT': '80'} | Passed |
SHA-256 / 2532c03a994ec8ee69df5df5570ff2a7fc10258009669d30046fa7ad28bc5c32
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.771218+00:00.
Case digest / 56d94a237083ee024b7dbdb76e01d1536119b59ecb65219119b270498f5fc733