FAILURE MAP
← Case archive

FA-9566 / Dependency resolution / Open access

Installed package reconciliation: Newer requested versions are ignored · case 01

Newer requested versions are ignored.

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

ROOT CAUSE

The implementation substitutes pass for actions.append((name, 'upgrade')), so newer requested versions are ignored.

VERIFIED REPAIR

Upgrade when desired version exceeds installed version.

Unsuccessful approach: The attempted repair substitutes actions.append((name, 'downgrade')). Fixture 4 still yields [('a', 'downgrade')] instead of [('a', 'upgrade')].

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]: pass
        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 fixtureActualExpectedOutcome
fixture 1[][]Passed
fixture 2[['a', 'install']][['a', 'install']]Passed
fixture 3[['a', 'remove']][['a', 'remove']]Passed
fixture 4[][['a', 'upgrade']]Failed
fixture 5[['a', 'downgrade']][['a', 'downgrade']]Passed
fixture 6[['a', 'reinstall']][['a', 'reinstall']]Passed
fixture 7[][]Passed

SHA-256 / 5d5e1d214a3aee94c3428ef533fe5f107d9625c32d0358a7ed50246e2f08105c

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, 'downgrade'))
        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 fixtureActualExpectedOutcome
fixture 1[][]Passed
fixture 2[['a', 'install']][['a', 'install']]Passed
fixture 3[['a', 'remove']][['a', 'remove']]Passed
fixture 4[['a', 'downgrade']][['a', 'upgrade']]Failed
fixture 5[['a', 'downgrade']][['a', 'downgrade']]Passed
fixture 6[['a', 'reinstall']][['a', 'reinstall']]Passed
fixture 7[][]Passed

SHA-256 / d4a46b6d809c2370dc26344626f759cf4ce2f38dc6bcd5c35d8b09c878898fda

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

Case digest / b530fc8d2f6882feaec5f9af2c9f4e69f73ef77c3464cb06feb688f43695dfcf