FAILURE MAP
← Case archive

FA-4441 / Runtime and resources / Open access

Weak upgrade requires retained object · case 01

The operation returns a result or retained state that violates this contract: A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Weak upgrade succeeds only while an owner retains the object and the destination is fresh.

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

ROOT CAUSE

Weak upgrade succeeds only while an owner retains the object and the destination is fresh. The broken transition violates that invariant.

THE FAILURE

Weak upgrade succeeds only while an owner retains the object and the destination is fresh. The broken transition violates that invariant.

Unsuccessful approach: The attempted transition changes the behavior but still violates the same invariant in at least one independent regression fixture.

Case contract

A local shared-ownership model executes [operation,handle,argument] commands. Only owners retain the resource. Output is one result per command; weak and borrowed handles do not retain it. Weak upgrade succeeds only while an owner retains the object and the destination is fresh. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

Why this case matters

A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.

1 / The failure

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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and arg not in h
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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
borrow cannot clone or outlive resource[True, False, True, False, True, False, True, False, True, [1, True, ['b', 'c', 'w']]][True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]]Failed
clones prevent premature destruction[True, True, True, [1, False, ['c']], True, [0, True, []]][True, True, True, [1, False, ['c']], True, [0, True, []]]Passed
destination collisions preserve all handles[True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]][True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]]Passed
move and borrower release preserve ownership[True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]][True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]]Passed
weak collision cannot discard owner[False, [1, False, ['root']]][False, [1, False, ['root']]]Passed

SHA-256 / cc725c098eba8095f2f56d2e4511229e1395fd0824347b77dbf4fe71e5370411

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x, y=None):
    h={'root':'owner'}; destroyed=False; out=[]
    for op,k,arg in x:
        owners=lambda: sum(v=='owner' for v in h.values())
        if op=='clone':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='owner'
            out.append(ok)
        elif op=='borrow':
            ok=h.get(arg)=='owner' and k not in h and not destroyed
            if ok: h[k]='borrow'
            out.append(ok)
        elif op=='weak':
            ok=k not in h
            if ok: h[k]='weak'
            out.append(ok)
        elif op=='upgrade':
            ok=h.get(k)=='weak' and owners()>0 and not destroyed
            if ok: h[arg]='owner'
            out.append(ok)
        elif op=='drop':
            existed=k in h
            kind=h.pop(k,None)
            if kind=='owner' and owners()==0: destroyed=True
            out.append(existed)
        elif op=='move':
            ok=k in h and arg not in h
            if ok:
                h[arg]=h[k]
                del h[k]
            out.append(ok)
        elif op=='use':
            out.append(h.get(k) in ('owner','borrow') and owners()>0 and not destroyed)
        elif op=='unique':
            out.append(h.get(k)=='owner' and owners()==1 and not destroyed)
        elif op=='inspect':
            out.append([owners(),destroyed,sorted(h)])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('borrow cannot clone or outlive resource', solve([['borrow', 'b', 'root'], ['clone', 'c', 'b'], ['weak', 'w', None], ['use', 'w', None], ['unique', 'root', None], ['unique', 'b', None], ['drop', 'root', None], ['use', 'b', None], ['upgrade', 'w', 'c'], ['inspect', None, None]]), [True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]])
check('clones prevent premature destruction', solve([['clone', 'c', 'root'], ['drop', 'root', None], ['use', 'c', None], ['inspect', None, None], ['drop', 'c', None], ['inspect', None, None]]), [True, True, True, [1, False, ['c']], True, [0, True, []]])
check('destination collisions preserve all handles', solve([['clone', 'c', 'root'], ['borrow', 'b', 'root'], ['clone', 'b', 'root'], ['borrow', 'c', 'root'], ['weak', 'w', None], ['upgrade', 'w', 'b'], ['move', 'root', 'c'], ['move', 'root', 'root'], ['inspect', None, None]]), [True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]])
check('move and borrower release preserve ownership', solve([['borrow', 'b', 'root'], ['drop', 'b', None], ['move', 'root', 'new'], ['use', 'root', None], ['borrow', 'b', 'new'], ['weak', 'w', None], ['upgrade', 'w', 'c'], ['borrow', 'z', 'b'], ['inspect', None, None]]), [True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]])
check('weak collision cannot discard owner', solve([['weak','root',None],['inspect',None,None]]), [False,[1,False,['root']]])
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
borrow cannot clone or outlive resource[True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]][True, False, True, False, True, False, True, False, False, [0, True, ['b', 'w']]]Passed
clones prevent premature destruction[True, True, True, [1, False, ['c']], True, [0, True, []]][True, True, True, [1, False, ['c']], True, [0, True, []]]Passed
destination collisions preserve all handles[True, True, False, False, True, True, False, False, [3, False, ['b', 'c', 'root', 'w']]][True, True, False, False, True, False, False, False, [2, False, ['b', 'c', 'root', 'w']]]Failed
move and borrower release preserve ownership[True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]][True, True, True, False, True, True, True, False, [2, False, ['b', 'c', 'new', 'w']]]Passed
weak collision cannot discard owner[False, [1, False, ['root']]][False, [1, False, ['root']]]Passed

SHA-256 / 449546de71dcf8466dca06a270e62a5933955bb335c43d37eff18af4c6535573

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 5 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:37:39.327224+00:00.

Case digest / 47b8ffd6791b756e6b2d6612bbc6ee0f8c35fc1e6b5a7b5fb94e1470bfbc9abe