FAILURE MAP
← Case archive

FA-45371 / Data systems / Open access

Different stable functions share one cached result · case 01

Different stable functions share one cached result.

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

ROOT CAUSE

volatile-projection-scope: Different stable functions share one cached result.

VERIFIED REPAIR

Preserve the stated physical representation and operation order: Evaluate projection expressions over row IDs. Expressions are [kind,key] with stable, volatile, or row. A deterministic counter starts at seed and increments on each stable first call or volatile call; stable calls cache by key for the whole query. Row expressions return the current row ID. Preserve expression and row order.

Unsuccessful approach: A constant first result also aliases independently keyed calls.

Case contract

Evaluate projection expressions over row IDs. Expressions are [kind,key] with stable, volatile, or row. A deterministic counter starts at seed and increments on each stable first call or volatile call; stable calls cache by key for the whole query. Row expressions return the current row ID. Preserve expression and row order.

Why this case matters

A bounded deterministic data engine model makes representation and changelog faults reproducible.

1 / The failure

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

N = 1
observations = []
def solve(d):
    try:
        rows,expressions,seed=d
        counter=seed; cache={}; result=[]
        for row in rows:
            projected=[]
            for kind,key in expressions:
                if kind=='row': value=row
                elif kind=='stable':
                    if key not in cache: counter+=1; cache[key]=next(iter(cache.values()),counter)
                    value=cache[key]
                else:
                    counter+=1; value=counter
                projected.append(value)
            result.append(projected)
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 1]), [[2, 3]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 1]), [[2], [2]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 1]), [[2, 3]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 1]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 1]), [[2, 9, 3]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 1]), [[9, 2, 3]])
    check('empty projection', solve([[9, 2], [], 1]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 1]), [])
elif N == 2:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 2]), [[3, 4]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 2]), [[3], [3]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 2]), [[3, 4]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 2]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 2]), [[3, 9, 4]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 2]), [[9, 3, 4]])
    check('empty projection', solve([[9, 2], [], 2]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 2]), [])
elif N == 3:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 3]), [[4, 5]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 3]), [[4], [4]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 3]), [[4, 5]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 3]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 3]), [[4, 9, 5]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 3]), [[9, 4, 5]])
    check('empty projection', solve([[9, 2], [], 3]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 3]), [])
elif N == 4:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 4]), [[5, 6]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 4]), [[5], [5]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 4]), [[5, 6]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 4]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 4]), [[5, 9, 6]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 4]), [[9, 5, 6]])
    check('empty projection', solve([[9, 2], [], 4]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 4]), [])
elif N == 5:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 5]), [[6, 7]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 5]), [[6], [6]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 5]), [[6, 7]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 5]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 5]), [[6, 9, 7]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 5]), [[9, 6, 7]])
    check('empty projection', solve([[9, 2], [], 5]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 5]), [])
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
separate volatile calls[[2, 3]][[2, 3]]Passed
stable across rows[[2], [2]][[2], [2]]Passed
distinct stable keys[[2, 2]][[2, 3]]Failed
row-dependent[[9], [2]][[9], [2]]Passed
mixed expression order[[2, 9, 3]][[2, 9, 3]]Passed
row first expression[[9, 2, 3]][[9, 2, 3]]Passed
empty projection[[], []][[], []]Passed
no input[][]Passed

SHA-256 / 3d08c3ce1dfd68a10c002386e15ed5d813a8c13956cfc024e3d2c7035d3900e7

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    try:
        rows,expressions,seed=d
        counter=seed; cache={}; result=[]
        for row in rows:
            projected=[]
            for kind,key in expressions:
                if kind=='row': value=row
                elif kind=='stable':
                    if key not in cache: cache[key]=seed+1
                    value=cache[key]
                else:
                    counter+=1; value=counter
                projected.append(value)
            result.append(projected)
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 1]), [[2, 3]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 1]), [[2], [2]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 1]), [[2, 3]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 1]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 1]), [[2, 9, 3]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 1]), [[9, 2, 3]])
    check('empty projection', solve([[9, 2], [], 1]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 1]), [])
elif N == 2:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 2]), [[3, 4]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 2]), [[3], [3]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 2]), [[3, 4]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 2]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 2]), [[3, 9, 4]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 2]), [[9, 3, 4]])
    check('empty projection', solve([[9, 2], [], 2]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 2]), [])
elif N == 3:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 3]), [[4, 5]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 3]), [[4], [4]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 3]), [[4, 5]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 3]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 3]), [[4, 9, 5]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 3]), [[9, 4, 5]])
    check('empty projection', solve([[9, 2], [], 3]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 3]), [])
elif N == 4:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 4]), [[5, 6]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 4]), [[5], [5]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 4]), [[5, 6]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 4]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 4]), [[5, 9, 6]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 4]), [[9, 5, 6]])
    check('empty projection', solve([[9, 2], [], 4]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 4]), [])
elif N == 5:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 5]), [[6, 7]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 5]), [[6], [6]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 5]), [[6, 7]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 5]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 5]), [[6, 9, 7]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 5]), [[9, 6, 7]])
    check('empty projection', solve([[9, 2], [], 5]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 5]), [])
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
separate volatile calls[[2, 3]][[2, 3]]Passed
stable across rows[[2], [2]][[2], [2]]Passed
distinct stable keys[[2, 2]][[2, 3]]Failed
row-dependent[[9], [2]][[9], [2]]Passed
mixed expression order[[2, 9, 2]][[2, 9, 3]]Failed
row first expression[[9, 2, 2]][[9, 2, 3]]Failed
empty projection[[], []][[], []]Passed
no input[][]Passed

SHA-256 / 7c93505d033f74d3284fb0fd352ba18eadbf466ed17911b97186eee6f05fdb78

3 / The verified repair

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

N = 1
observations = []
def solve(d):
    try:
        rows,expressions,seed=d
        counter=seed; cache={}; result=[]
        for row in rows:
            projected=[]
            for kind,key in expressions:
                if kind=='row': value=row
                elif kind=='stable':
                    if key not in cache: counter+=1; cache[key]=counter
                    value=cache[key]
                else:
                    counter+=1; value=counter
                projected.append(value)
            result.append(projected)
        return result
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 1]), [[2, 3]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 1]), [[2], [2]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 1]), [[2, 3]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 1]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 1]), [[2, 9, 3]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 1]), [[9, 2, 3]])
    check('empty projection', solve([[9, 2], [], 1]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 1]), [])
elif N == 2:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 2]), [[3, 4]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 2]), [[3], [3]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 2]), [[3, 4]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 2]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 2]), [[3, 9, 4]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 2]), [[9, 3, 4]])
    check('empty projection', solve([[9, 2], [], 2]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 2]), [])
elif N == 3:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 3]), [[4, 5]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 3]), [[4], [4]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 3]), [[4, 5]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 3]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 3]), [[4, 9, 5]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 3]), [[9, 4, 5]])
    check('empty projection', solve([[9, 2], [], 3]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 3]), [])
elif N == 4:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 4]), [[5, 6]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 4]), [[5], [5]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 4]), [[5, 6]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 4]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 4]), [[5, 9, 6]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 4]), [[9, 5, 6]])
    check('empty projection', solve([[9, 2], [], 4]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 4]), [])
elif N == 5:
    check('separate volatile calls', solve([[9], [['volatile', 'v'], ['volatile', 'v']], 5]), [[6, 7]])
    check('stable across rows', solve([[9, 2], [['stable', 's']], 5]), [[6], [6]])
    check('distinct stable keys', solve([[9], [['stable', 'a'], ['stable', 'b']], 5]), [[6, 7]])
    check('row-dependent', solve([[9, 2], [['row', 'r']], 5]), [[9], [2]])
    check('mixed expression order', solve([[9], [['volatile', 'z'], ['row', 'r'], ['stable', 'a']], 5]), [[6, 9, 7]])
    check('row first expression', solve([[9], [['row', 'r'], ['stable', 's'], ['volatile', 'v']], 5]), [[9, 6, 7]])
    check('empty projection', solve([[9, 2], [], 5]), [[], []])
    check('no input', solve([[], [['volatile', 'v']], 5]), [])
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
separate volatile calls[[2, 3]][[2, 3]]Passed
stable across rows[[2], [2]][[2], [2]]Passed
distinct stable keys[[2, 3]][[2, 3]]Passed
row-dependent[[9], [2]][[9], [2]]Passed
mixed expression order[[2, 9, 3]][[2, 9, 3]]Passed
row first expression[[9, 2, 3]][[9, 2, 3]]Passed
empty projection[[], []][[], []]Passed
no input[][]Passed

SHA-256 / 031c2f9c4b0e9cf9a2ae56e8095eddbfc27b19c798e98466179c7179c98a7d0a

Verification & scope

Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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:44:21.544257+00:00.

Case digest / 5ca6f0f3673cde24713bde760a7a3f355c988c5e9e88c4e89494d5f4d4fe9438