FA-9571 / Dependency resolution / Open access
Installed package reconciliation: Pinned older versions are silently retained · case 01
Pinned older versions are silently retained.
ROOT CAUSE
The implementation substitutes pass for actions.append((name, 'downgrade')), so pinned older versions are silently retained.
VERIFIED REPAIR
Downgrade when the desired version is lower.
Unsuccessful approach: The attempted repair substitutes actions.append((name, 'upgrade')). Fixture 5 still yields [('a', 'upgrade')] instead of [('a', 'downgrade')].
Case contract
For each desired package, emit install if missing, upgrade or downgrade for version movement, reinstall for digest drift, and remove installed packages absent from desired. Output actions sorted by package name.
Why this case matters
An offline model of installed package reconciliation, 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(desired, installed):
actions = []
for name in sorted(set(desired) | set(installed)):
if name not in desired: actions.append((name, 'remove'))
elif name not in installed: actions.append((name, 'install'))
elif desired[name][0] > installed[name][0]: actions.append((name, 'upgrade'))
elif desired[name][0] < installed[name][0]: pass
elif desired[name][1] != installed[name][1]: actions.append((name, 'reinstall'))
return actions
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': (1, 'x')}, {}), [('a', 'install')])
check('fixture 3', solve({}, {'a': (1, 'x')}), [('a', 'remove')])
check('fixture 4', solve({'a': (2, 'x')}, {'a': (1, 'x')}), [('a', 'upgrade')])
check('fixture 5', solve({'a': (1, 'x')}, {'a': (2, 'x')}), [('a', 'downgrade')])
check('fixture 6', solve({'a': (1, 'x')}, {'a': (1, 'y')}), [('a', 'reinstall')])
check('fixture 7', solve({'a': (1, 'x')}, {'a': (1, 'x')}), [])
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', 'install']] | [['a', 'install']] | Passed |
| fixture 3 | [['a', 'remove']] | [['a', 'remove']] | Passed |
| fixture 4 | [['a', 'upgrade']] | [['a', 'upgrade']] | Passed |
| fixture 5 | [] | [['a', 'downgrade']] | Failed |
| fixture 6 | [['a', 'reinstall']] | [['a', 'reinstall']] | Passed |
| fixture 7 | [] | [] | Passed |
SHA-256 / b0af4e49a958d10c0bebb2a4975bb01cc7a60d5e773d226ca378a19cb0730b06
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(desired, installed):
actions = []
for name in sorted(set(desired) | set(installed)):
if name not in desired: actions.append((name, 'remove'))
elif name not in installed: actions.append((name, 'install'))
elif desired[name][0] > installed[name][0]: actions.append((name, 'upgrade'))
elif desired[name][0] < installed[name][0]: actions.append((name, 'upgrade'))
elif desired[name][1] != installed[name][1]: actions.append((name, 'reinstall'))
return actions
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': (1, 'x')}, {}), [('a', 'install')])
check('fixture 3', solve({}, {'a': (1, 'x')}), [('a', 'remove')])
check('fixture 4', solve({'a': (2, 'x')}, {'a': (1, 'x')}), [('a', 'upgrade')])
check('fixture 5', solve({'a': (1, 'x')}, {'a': (2, 'x')}), [('a', 'downgrade')])
check('fixture 6', solve({'a': (1, 'x')}, {'a': (1, 'y')}), [('a', 'reinstall')])
check('fixture 7', solve({'a': (1, 'x')}, {'a': (1, 'x')}), [])
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', 'install']] | [['a', 'install']] | Passed |
| fixture 3 | [['a', 'remove']] | [['a', 'remove']] | Passed |
| fixture 4 | [['a', 'upgrade']] | [['a', 'upgrade']] | Passed |
| fixture 5 | [['a', 'upgrade']] | [['a', 'downgrade']] | Failed |
| fixture 6 | [['a', 'reinstall']] | [['a', 'reinstall']] | Passed |
| fixture 7 | [] | [] | Passed |
SHA-256 / 91b1938665cc5c61cc9a1c8485202f39e70e7b73f0ad3b331116e1797f6d9a8b
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(desired, installed):
actions = []
for name in sorted(set(desired) | set(installed)):
if name not in desired: actions.append((name, 'remove'))
elif name not in installed: actions.append((name, 'install'))
elif desired[name][0] > installed[name][0]: actions.append((name, 'upgrade'))
elif desired[name][0] < installed[name][0]: actions.append((name, 'downgrade'))
elif desired[name][1] != installed[name][1]: actions.append((name, 'reinstall'))
return actions
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': (1, 'x')}, {}), [('a', 'install')])
check('fixture 3', solve({}, {'a': (1, 'x')}), [('a', 'remove')])
check('fixture 4', solve({'a': (2, 'x')}, {'a': (1, 'x')}), [('a', 'upgrade')])
check('fixture 5', solve({'a': (1, 'x')}, {'a': (2, 'x')}), [('a', 'downgrade')])
check('fixture 6', solve({'a': (1, 'x')}, {'a': (1, 'y')}), [('a', 'reinstall')])
check('fixture 7', solve({'a': (1, 'x')}, {'a': (1, 'x')}), [])
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', 'install']] | [['a', 'install']] | Passed |
| fixture 3 | [['a', 'remove']] | [['a', 'remove']] | Passed |
| fixture 4 | [['a', 'upgrade']] | [['a', 'upgrade']] | Passed |
| fixture 5 | [['a', 'downgrade']] | [['a', 'downgrade']] | Passed |
| fixture 6 | [['a', 'reinstall']] | [['a', 'reinstall']] | Passed |
| fixture 7 | [] | [] | Passed |
SHA-256 / 2e56a3a777c168b4268bd463a24b625da992cd0fcf930e016882646dc5893ceb
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.047784+00:00.
Case digest / 94eb4a89755a8a9d99f1cb037ab68272d7c823809349a3cf1fcebb871fd69c6d