FAILURE MAP
← Case archive

FA-45366 / Data systems / Open access

Stable query results are discarded at each new input row · case 01

Stable query results are discarded at each new input row.

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

ROOT CAUSE

volatile-projection-scope: Stable query results are discarded at each new input row.

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: An empty reconstructed cache still turns query-stable calls into per-row 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=[]; cache={} 
            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], [3]][[2], [2]]Failed
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 / e709d340ae140329e8afebb628b8bca0062320a104b5c097a92f5935cd07acc3

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=[]; cache={k:v for k,v in cache.items() if False}
            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], [3]][[2], [2]]Failed
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 / 97a5da584d78fce9e20955eaf07111502e9a81463b8c803d9bd0846ea02ad893

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

Case digest / a8ac14dfba6615a5b4113b12351a1e22a164c2a158cdc4b43f10e53816bbf925