FAILURE MAP
← Case archive

FA-9136 / Build systems / Open access

Build prerequisite closure: Requested root targets disappear from results · case 01

Requested root targets disappear from results.

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

ROOT CAUSE

The implementation substitutes return sorted(seen - set(roots)) for return sorted(seen), so requested root targets disappear from results.

VERIFIED REPAIR

Include roots and their transitive prerequisites.

Unsuccessful approach: The attempted repair substitutes return sorted(set(roots)). Fixture 3 still yields ['a'] instead of ['a', 'b'].

Case contract

Return sorted unique reachable target names including roots. Traverse normal prerequisites, exclude order-only prerequisites, retain unknown leaves, and stop cycles.

Why this case matters

An offline model of build prerequisite closure, 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(roots, edges):
    seen = set()
    stack = list(roots)
    while stack:
        node = stack.pop()
        if node in seen:
            continue
        seen.add(node)
        stack.extend(dep for dep, kind in edges.get(node, []) if kind == 'normal')
    return sorted(seen - set(roots))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([], {}), [])
check('fixture 2', solve(['a'], {}), ['a'])
check('fixture 3', solve(['a'], {'a': [('b', 'normal'), ('c', 'order')]}), ['a', 'b'])
check('fixture 4', solve(['a'], {'a': [('b', 'normal')], 'b': [('c', 'normal')]}), ['a', 'b', 'c'])
check('fixture 5', solve(['z', 'a'], {}), ['a', 'z'])
check('fixture 6', solve(['a', 'a'], {'a': [('b', 'normal')]}), ['a', 'b'])
check('fixture 7', solve(['a'], {'a': [('b', 'normal')], 'b': [('a', 'normal')]}), ['a', 'b'])
check('fixture 8', solve(['a'], {'a': [('b', 'order')]}), ['a'])
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[]['a']Failed
fixture 3['b']['a', 'b']Failed
fixture 4['b', 'c']['a', 'b', 'c']Failed
fixture 5[]['a', 'z']Failed
fixture 6['b']['a', 'b']Failed
fixture 7['b']['a', 'b']Failed
fixture 8[]['a']Failed

SHA-256 / 4d5db50277097d488e6362f0667d3898573cbc2f7147b3f71aa8154f4bcb8475

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(roots, edges):
    seen = set()
    stack = list(roots)
    while stack:
        node = stack.pop()
        if node in seen:
            continue
        seen.add(node)
        stack.extend(dep for dep, kind in edges.get(node, []) if kind == 'normal')
    return sorted(set(roots))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([], {}), [])
check('fixture 2', solve(['a'], {}), ['a'])
check('fixture 3', solve(['a'], {'a': [('b', 'normal'), ('c', 'order')]}), ['a', 'b'])
check('fixture 4', solve(['a'], {'a': [('b', 'normal')], 'b': [('c', 'normal')]}), ['a', 'b', 'c'])
check('fixture 5', solve(['z', 'a'], {}), ['a', 'z'])
check('fixture 6', solve(['a', 'a'], {'a': [('b', 'normal')]}), ['a', 'b'])
check('fixture 7', solve(['a'], {'a': [('b', 'normal')], 'b': [('a', 'normal')]}), ['a', 'b'])
check('fixture 8', solve(['a'], {'a': [('b', 'order')]}), ['a'])
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['a']['a']Passed
fixture 3['a']['a', 'b']Failed
fixture 4['a']['a', 'b', 'c']Failed
fixture 5['a', 'z']['a', 'z']Passed
fixture 6['a']['a', 'b']Failed
fixture 7['a']['a', 'b']Failed
fixture 8['a']['a']Passed

SHA-256 / b29ab6fd35b172a313ca60fb4d23a89e77fe73023bca4634d6a13d912b95e2d9

3 / The verified repair

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

N = 1
observations = []
def solve(roots, edges):
    seen = set()
    stack = list(roots)
    while stack:
        node = stack.pop()
        if node in seen:
            continue
        seen.add(node)
        stack.extend(dep for dep, kind in edges.get(node, []) if kind == 'normal')
    return sorted(seen)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve([], {}), [])
check('fixture 2', solve(['a'], {}), ['a'])
check('fixture 3', solve(['a'], {'a': [('b', 'normal'), ('c', 'order')]}), ['a', 'b'])
check('fixture 4', solve(['a'], {'a': [('b', 'normal')], 'b': [('c', 'normal')]}), ['a', 'b', 'c'])
check('fixture 5', solve(['z', 'a'], {}), ['a', 'z'])
check('fixture 6', solve(['a', 'a'], {'a': [('b', 'normal')]}), ['a', 'b'])
check('fixture 7', solve(['a'], {'a': [('b', 'normal')], 'b': [('a', 'normal')]}), ['a', 'b'])
check('fixture 8', solve(['a'], {'a': [('b', 'order')]}), ['a'])
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['a']['a']Passed
fixture 3['a', 'b']['a', 'b']Passed
fixture 4['a', 'b', 'c']['a', 'b', 'c']Passed
fixture 5['a', 'z']['a', 'z']Passed
fixture 6['a', 'b']['a', 'b']Passed
fixture 7['a', 'b']['a', 'b']Passed
fixture 8['a']['a']Passed

SHA-256 / fb736e0b08304b845b394f4b47290c65c7e176c81d696953ae08cfde7c6b4012

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

Case digest / 4cbf8947e29fefe6c28789dcb4afc3eb71095a59cd3845088054d02873cf0e31