FAILURE MAP
← Case archive

FA-9561 / Dependency resolution / Open access

Installed package reconciliation: Missing packages are classified as upgrades · case 01

Missing packages are classified as upgrades.

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

ROOT CAUSE

The implementation substitutes actions.append((name, 'upgrade')) for actions.append((name, 'install')), so missing packages are classified as upgrades.

THE FAILURE

The implementation substitutes actions.append((name, 'upgrade')) for actions.append((name, 'install')), so missing packages are classified as upgrades.

Unsuccessful approach: The attempted repair substitutes pass. Fixture 2 still yields [] instead of [('a', 'install')].

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, 'upgrade'))
        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', 'upgrade']][['a', 'install']]Failed
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 / 2f29d215f362efaf03818188a2ca0770f2f6926fe180c3c10d5a1dc5ee6b5d21

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: pass
        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']]Failed
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 / 217790199760396bd2a68ae1d334614921131482ecb69bea2ebb737741304438

HELD IN THE MEMBER ARCHIVE

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

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

Case digest / f408220f1da2823557525859d22cc5b9470bedb7b733a6aca1688753e6d12736