FAILURE MAP
← Case archive

FA-9631 / Configuration / Open access

Environment variable projection: Environment lookup ignores the namespace prefix · case 01

Environment lookup ignores the namespace prefix.

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

ROOT CAUSE

The implementation substitutes key = name for key = prefix + name, so environment lookup ignores the namespace prefix.

THE FAILURE

The implementation substitutes key = name for key = prefix + name, so environment lookup ignores the namespace prefix.

Unsuccessful approach: The attempted repair substitutes key = name + prefix. Fixture 2 still yields {'PORT': 'missing'} instead of {'PORT': '0'}.

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 = 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': 'missing'}{'PORT': '0'}Failed
fixture 3{'PORT': '80'}{'PORT': ''}Failed
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': '90'}{'PORT': '80'}Failed

SHA-256 / b64f0aa43e5589f17a41ea5d2ca91bac55f291ca2f96a91e5625f54949ed29af

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 = name + prefix
        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': 'missing'}{'PORT': '0'}Failed
fixture 3{'PORT': '80'}{'PORT': ''}Failed
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 / 4ec2dc92f31df51952fac2e790173aad2de638e2b3a54e5c0f10d423973a8cae

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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:31.771218+00:00.

Case digest / 557f8ea38977a75b61e88d844193d2f0748043e8015e380323636d4b928be7c2