FA-9646 / Configuration / Open access
Environment variable projection: Required absent variables are silently omitted · case 01
Required absent variables are silently omitted.
ROOT CAUSE
The implementation substitutes elif required: pass for elif required: result[name] = 'missing', so required absent variables are silently omitted.
VERIFIED REPAIR
Report required variables with neither environment nor default.
Unsuccessful approach: The attempted repair substitutes elif required: result[name] = None. Fixture 5 still yields {'PORT': None} 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 required: pass
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 | {} | {} | Passed |
| fixture 7 | {'PORT': '80'} | {'PORT': '80'} | Passed |
| fixture 8 | {'PORT': '80'} | {'PORT': '80'} | Passed |
SHA-256 / fb794a7702bf0f38652c11996ea54153d0df9bc8e16968c9a145fdf613c3bdf3
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 required: result[name] = None
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': None} | {'PORT': 'missing'} | Failed |
| fixture 6 | {} | {} | Passed |
| fixture 7 | {'PORT': '80'} | {'PORT': '80'} | Passed |
| fixture 8 | {'PORT': '80'} | {'PORT': '80'} | Passed |
SHA-256 / b6d5968801be435c99e08c3d18f809483f30a6291af65bc18816e51be76c53de
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.734852+00:00.
Case digest / 9240bb7ac31f4d755ffd2eda0a3dc9542ffe0128a26d2a1a1902990b72ea1ba5