FA-9201 / Build systems / Open access
Prerequisite manifest merge: New dependencies prepend in reverse order · case 01
New dependencies prepend in reverse order.
ROOT CAUSE
The implementation substitutes result[target].insert(0, dep) for result[target].append(dep), so new dependencies prepend in reverse order.
VERIFIED REPAIR
Append each first-seen dependency in declaration order.
Unsuccessful approach: The attempted repair substitutes result[target] = sorted(result[target] + [dep]). Fixture 6 still yields {'old': ['x'], 'new': ['a', 'z']} instead of {'old': ['x'], 'new': ['z', 'a']}.
Case contract
Merge prerequisite lists by target, preserving first occurrence order, retaining previous prerequisites, ignoring self references, and retaining empty targets.
Why this case matters
An offline model of prerequisite manifest merge, 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(previous, updates):
result = {name: list(deps) for name, deps in previous.items()}
for target, deps in updates:
result.setdefault(target, [])
for dep in deps:
if dep != target and dep not in result[target]:
result[target].insert(0, dep)
return result
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': ['b']}, [('a', ['c'])]), {'a': ['b', 'c']})
check('fixture 3', solve({}, [('a', ['a', 'b', 'b', 'c', 'b'])]), {'a': ['b', 'c']})
check('fixture 4', solve({}, [('z', [])]), {'z': []})
check('fixture 5', solve({'a': ['b']}, [('a', ['b', 'c']), ('a', ['d'])]), {'a': ['b', 'c', 'd']})
check('fixture 6', solve({'old': ['x']}, [('new', ['z', 'a'])]), {'old': ['x'], 'new': ['z', '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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {} | {} | Passed |
| fixture 2 | {'a': ['c', 'b']} | {'a': ['b', 'c']} | Failed |
| fixture 3 | {'a': ['c', 'b']} | {'a': ['b', 'c']} | Failed |
| fixture 4 | {'z': []} | {'z': []} | Passed |
| fixture 5 | {'a': ['d', 'c', 'b']} | {'a': ['b', 'c', 'd']} | Failed |
| fixture 6 | {'new': ['a', 'z'], 'old': ['x']} | {'new': ['z', 'a'], 'old': ['x']} | Failed |
SHA-256 / 35d6ab45b32558fc7476d20433e1a7be2ba887c91d7514dc3ed6c2ff5e66b350
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(previous, updates):
result = {name: list(deps) for name, deps in previous.items()}
for target, deps in updates:
result.setdefault(target, [])
for dep in deps:
if dep != target and dep not in result[target]:
result[target] = sorted(result[target] + [dep])
return result
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': ['b']}, [('a', ['c'])]), {'a': ['b', 'c']})
check('fixture 3', solve({}, [('a', ['a', 'b', 'b', 'c', 'b'])]), {'a': ['b', 'c']})
check('fixture 4', solve({}, [('z', [])]), {'z': []})
check('fixture 5', solve({'a': ['b']}, [('a', ['b', 'c']), ('a', ['d'])]), {'a': ['b', 'c', 'd']})
check('fixture 6', solve({'old': ['x']}, [('new', ['z', 'a'])]), {'old': ['x'], 'new': ['z', '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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {} | {} | Passed |
| fixture 2 | {'a': ['b', 'c']} | {'a': ['b', 'c']} | Passed |
| fixture 3 | {'a': ['b', 'c']} | {'a': ['b', 'c']} | Passed |
| fixture 4 | {'z': []} | {'z': []} | Passed |
| fixture 5 | {'a': ['b', 'c', 'd']} | {'a': ['b', 'c', 'd']} | Passed |
| fixture 6 | {'new': ['a', 'z'], 'old': ['x']} | {'new': ['z', 'a'], 'old': ['x']} | Failed |
SHA-256 / 3041c09f102692b2c0fda896aa284dbb04145e7909112c1b5742013885c3e190
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(previous, updates):
result = {name: list(deps) for name, deps in previous.items()}
for target, deps in updates:
result.setdefault(target, [])
for dep in deps:
if dep != target and dep not in result[target]:
result[target].append(dep)
return result
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': ['b']}, [('a', ['c'])]), {'a': ['b', 'c']})
check('fixture 3', solve({}, [('a', ['a', 'b', 'b', 'c', 'b'])]), {'a': ['b', 'c']})
check('fixture 4', solve({}, [('z', [])]), {'z': []})
check('fixture 5', solve({'a': ['b']}, [('a', ['b', 'c']), ('a', ['d'])]), {'a': ['b', 'c', 'd']})
check('fixture 6', solve({'old': ['x']}, [('new', ['z', 'a'])]), {'old': ['x'], 'new': ['z', '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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {} | {} | Passed |
| fixture 2 | {'a': ['b', 'c']} | {'a': ['b', 'c']} | Passed |
| fixture 3 | {'a': ['b', 'c']} | {'a': ['b', 'c']} | Passed |
| fixture 4 | {'z': []} | {'z': []} | Passed |
| fixture 5 | {'a': ['b', 'c', 'd']} | {'a': ['b', 'c', 'd']} | Passed |
| fixture 6 | {'new': ['z', 'a'], 'old': ['x']} | {'new': ['z', 'a'], 'old': ['x']} | Passed |
SHA-256 / a6328c86dae56e4f1ea99d519b6c0a1368c33f3c341f63c7d2c733635c8b744d
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.967687+00:00.
Case digest / 690b56ac44ad172662cb24ed1652d15938fc077846f3134200d375f4d0a0df14