FAILURE MAP
← Case archive

FA-11601 / Compression format semantics / Open access

Dictionary clear codes retain stale learned phrases · case 01

Dictionary clear codes retain stale learned phrases.

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

ROOT CAUSE

A clear marker is ignored, retaining phrases from the preceding dictionary epoch.

VERIFIED REPAIR

Replace learned dictionary state with a fresh literal dictionary on every clear marker.

Unsuccessful approach: Clearing every entry also loses the permanent literal alphabet.

Case contract

Toy dictionary starts with {0:a,1:b}. Tokens [put,k,text] add phrases; [clear] restores exactly the literals; [get,k] emits the mapped phrase or ?.

Why this case matters

A small offline codec model isolates a compression-specific failure without external files or libraries.

1 / The failure

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

N = 1
observations = []
def solve(tokens):
    d={0:'a',1:'b'}; out=[]
    for t in tokens:
        if t[0]=='put': d[t[1]]=t[2]
        elif t[0]=='get': out.append(d.get(t[1],'?'))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('epoch invalidates phrase',solve([['put',2,'a'*N],['clear'],['get',2]]),['?'])
check('literal survives',solve([['clear'],['get',0]]),['a'])
check('phrase before clear',solve([['put',2,'ab'],['get',2]]),['ab'])
check('reassignment after clear',solve([['put',2,'ab'],['clear'],['put',2,'ba'],['get',2]]),['ba'])
check('repeated clears',solve([['clear'],['clear'],['get',1]]),['b'])
check('empty',solve([]),[])
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
epoch invalidates phrase['a']['?']Failed
literal survives['a']['a']Passed
phrase before clear['ab']['ab']Passed
reassignment after clear['ba']['ba']Passed
repeated clears['b']['b']Passed
empty[][]Passed

SHA-256 / ae7fb88ba2a1946e05c0e42b75d4661307e6209ad6fd61033d795e34e364c75c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(tokens):
    d={0:'a',1:'b'}; out=[]
    for t in tokens:
        if t[0]=='put': d[t[1]]=t[2]
        elif t[0]=='clear': d={}
        else: out.append(d.get(t[1],'?'))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('epoch invalidates phrase',solve([['put',2,'a'*N],['clear'],['get',2]]),['?'])
check('literal survives',solve([['clear'],['get',0]]),['a'])
check('phrase before clear',solve([['put',2,'ab'],['get',2]]),['ab'])
check('reassignment after clear',solve([['put',2,'ab'],['clear'],['put',2,'ba'],['get',2]]),['ba'])
check('repeated clears',solve([['clear'],['clear'],['get',1]]),['b'])
check('empty',solve([]),[])
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
epoch invalidates phrase['?']['?']Passed
literal survives['?']['a']Failed
phrase before clear['ab']['ab']Passed
reassignment after clear['ba']['ba']Passed
repeated clears['?']['b']Failed
empty[][]Passed

SHA-256 / a96f22495752f611db6b9dc5da50a09876929ce477721646b79bebb2df4c887e

3 / The verified repair

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

N = 1
observations = []
def solve(tokens):
    d={0:'a',1:'b'}; out=[]
    for t in tokens:
        if t[0]=='put': d[t[1]]=t[2]
        elif t[0]=='clear': d={0:'a',1:'b'}
        else: out.append(d.get(t[1],'?'))
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('epoch invalidates phrase',solve([['put',2,'a'*N],['clear'],['get',2]]),['?'])
check('literal survives',solve([['clear'],['get',0]]),['a'])
check('phrase before clear',solve([['put',2,'ab'],['get',2]]),['ab'])
check('reassignment after clear',solve([['put',2,'ab'],['clear'],['put',2,'ba'],['get',2]]),['ba'])
check('repeated clears',solve([['clear'],['clear'],['get',1]]),['b'])
check('empty',solve([]),[])
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
epoch invalidates phrase['?']['?']Passed
literal survives['a']['a']Passed
phrase before clear['ab']['ab']Passed
reassignment after clear['ba']['ba']Passed
repeated clears['b']['b']Passed
empty[][]Passed

SHA-256 / 3e25c661f2dfbaae0e9d940aaa84ac9fb6af356b783e866861a381dea0160897

Verification & scope

Controlled educational model, not a complete implementation of a production compression format. 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:49.299700+00:00.

Case digest / 241a6cc0657a331dc7e960efb7c5ce812a4020bb0151bee74e24686b0c0d296e