FAILURE MAP
← Case archive

FA-10461 / Caching / Open access

Replacing entry tags leaves obsolete reverse-index membership · case 01

Replacing entry tags leaves obsolete reverse-index membership.

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

ROOT CAUSE

Tag updates add new associations without removing previous associations for the key.

VERIFIED REPAIR

Preserve the cache-state invariant: Return tag-to-sorted-unique-keys index after replacing one key tags; drop empty buckets and preserve associations belonging to other keys.

Unsuccessful approach: Rebuilding only from the changed key discards unrelated reverse-index memberships.

Case contract

Return tag-to-sorted-unique-keys index after replacing one key tags; drop empty buckets and preserve associations belonging to other keys.

Why this case matters

A deterministic cache state transformation. Inputs are copied or treated as immutable; no remote storage, real clock, or concurrent interleaving is simulated.

1 / The failure

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

N = 1
observations = []
def solve(index, key, new_tags):
    out={tag:list(keys) for tag,keys in index.items()}
    for tag in new_tags: out.setdefault(tag,[]).append(key)
    return {tag:sorted(set(keys)) for tag,keys in out.items() if keys}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'old': ['a'], 'shared': ['a', 'b']}, 'a', ['new'])), {'shared': ['b'], 'new': ['a']})
check('fixture 2', solve(*({'x': ['a', 'b']}, 'a', ['x'])), {'x': ['a', 'b']})
check('fixture 3', solve(*({}, 'a', [])), {})
check('fixture 4', solve(*({'x': ['a'], 'y': ['b']}, 'a', [])), {'y': ['b']})
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{'new': ['a'], 'old': ['a'], 'shared': ['a', 'b']}{'new': ['a'], 'shared': ['b']}Failed
fixture 2{'x': ['a', 'b']}{'x': ['a', 'b']}Passed
fixture 3{}{}Passed
fixture 4{'x': ['a'], 'y': ['b']}{'y': ['b']}Failed

SHA-256 / e8d9fdf8e305bbfc3f06c7078a5ee1a96ebb5eca195ff9fa271d114ded7b218e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(index, key, new_tags):
    return {tag:[key] for tag in sorted(set(new_tags))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'old': ['a'], 'shared': ['a', 'b']}, 'a', ['new'])), {'shared': ['b'], 'new': ['a']})
check('fixture 2', solve(*({'x': ['a', 'b']}, 'a', ['x'])), {'x': ['a', 'b']})
check('fixture 3', solve(*({}, 'a', [])), {})
check('fixture 4', solve(*({'x': ['a'], 'y': ['b']}, 'a', [])), {'y': ['b']})
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{'new': ['a']}{'new': ['a'], 'shared': ['b']}Failed
fixture 2{'x': ['a']}{'x': ['a', 'b']}Failed
fixture 3{}{}Passed
fixture 4{}{'y': ['b']}Failed

SHA-256 / f39c6bc3a84b56cb94bedbc2b896f9dbedd34acd7f71420c65931074ddaec379

3 / The verified repair

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

N = 1
observations = []
def solve(index, key, new_tags):
    out={tag:set(keys)-{key} for tag,keys in index.items()}
    for tag in new_tags: out.setdefault(tag,set()).add(key)
    return {tag:sorted(keys) for tag,keys in out.items() if keys}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve(*({'old': ['a'], 'shared': ['a', 'b']}, 'a', ['new'])), {'shared': ['b'], 'new': ['a']})
check('fixture 2', solve(*({'x': ['a', 'b']}, 'a', ['x'])), {'x': ['a', 'b']})
check('fixture 3', solve(*({}, 'a', [])), {})
check('fixture 4', solve(*({'x': ['a'], 'y': ['b']}, 'a', [])), {'y': ['b']})
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{'new': ['a'], 'shared': ['b']}{'new': ['a'], 'shared': ['b']}Passed
fixture 2{'x': ['a', 'b']}{'x': ['a', 'b']}Passed
fixture 3{}{}Passed
fixture 4{'y': ['b']}{'y': ['b']}Passed

SHA-256 / 5df1df6a3c1479c081d9ebb059ea9b342b4be6a5370eae514f0a88646452fbb9

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

Case digest / e0f09743fbd7983e30985df9c9ea30521535f62f5799f1dc325ad048416e4d54