FAILURE MAP
← Case archive

FA-26176 / Filter interfaces / Open access

Set-operand quota counts distinct selected identities · case 01

Set-operand quota counts distinct selected identities is violated by the widget projection.

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

ROOT CAUSE

The set-cost decision uses `len(d['values'])` instead of the stipulated criterion-quota projection.

VERIFIED REPAIR

Implement the declared set-cost projection: `len(set(d['values']))`.

Unsuccessful approach: The attempted correction `int(bool(d['values']))` still violates the explicit contract fixtures.

Case contract

Filter-builder quotas separately bound user rows, nested groups and set operands; disabled user rows still consume edit capacity but enforced rows are exempt. This example checks: Set-operand quota counts distinct selected identities.

Why this case matters

Filter-widget state and serialization must preserve user constraints while the view changes.

1 / The failure

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

N = 1
observations = []
def solve(d):
    return {'operand-cost':(sum(len(x['operands']) for x in d['rows'] if not x['system'])), 'row-add-gate':(sum(not x['system'] for x in d['rows'])<d['row_limit']), 'group-cost':(sum(x['kind']=='group' for x in d['nodes'])), 'set-cost':(len(d['values'])), 'replace-capacity':(len(set(d['replacement']))<=d['value_limit']), 'remaining-rows':(max(0,d['row_limit']-sum(not x['system'] for x in d['rows'])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0})], 2: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 3: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1})], 4: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 5: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
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
contract fixture 0{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 1{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 2{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 3{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 4{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 5{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 6{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 3}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 7{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 8{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 9{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed

SHA-256 / 4918e09576b1097700a1f3a24364229f1e0cacedc08314a41b170cd2eaf8a144

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    return {'operand-cost':(sum(len(x['operands']) for x in d['rows'] if not x['system'])), 'row-add-gate':(sum(not x['system'] for x in d['rows'])<d['row_limit']), 'group-cost':(sum(x['kind']=='group' for x in d['nodes'])), 'set-cost':(int(bool(d['values']))), 'replace-capacity':(len(set(d['replacement']))<=d['value_limit']), 'remaining-rows':(max(0,d['row_limit']-sum(not x['system'] for x in d['rows'])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0})], 2: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 3: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1})], 4: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 5: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
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
contract fixture 0{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 1{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 2{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 3{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 4{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 5{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 6{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 1}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Failed
contract fixture 7{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 8{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 9{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed

SHA-256 / 9b1302c03339cf076635d687da540d2646549d44b85846e4f3e0998c7524f835

3 / The verified repair

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

N = 1
observations = []
def solve(d):
    return {'operand-cost':(sum(len(x['operands']) for x in d['rows'] if not x['system'])), 'row-add-gate':(sum(not x['system'] for x in d['rows'])<d['row_limit']), 'group-cost':(sum(x['kind']=='group' for x in d['nodes'])), 'set-cost':(len(set(d['values']))), 'replace-capacity':(len(set(d['replacement']))<=d['value_limit']), 'remaining-rows':(max(0,d['row_limit']-sum(not x['system'] for x in d['rows'])))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0})], 2: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 3: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 1})], 4: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 0})], 5: [({'rows': [], 'row_limit': 1, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': False, 'remaining-rows': 1}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 2, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 2}), ({'rows': [], 'row_limit': 3, 'nodes': [], 'values': [], 'replacement': [], 'value_limit': 1}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [], 'row_limit': 3, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': [], 'value_limit': 2}, {'operand-cost': 0, 'row-add-gate': True, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 3}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 1, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['c', 'c'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 0, 'set-cost': 0, 'replace-capacity': False, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 2, 'nodes': [{'kind': 'group'}, {'kind': 'leaf'}, {'kind': 'leaf'}], 'values': [], 'replacement': ['a', 'b'], 'value_limit': 2}, {'operand-cost': 3, 'row-add-gate': False, 'group-cost': 1, 'set-cost': 0, 'replace-capacity': True, 'remaining-rows': 0}), ({'rows': [{'system': True, 'enabled': True, 'operands': ['s']}, {'system': False, 'enabled': False, 'operands': ['a', 'b']}, {'system': False, 'enabled': True, 'operands': ['c']}], 'row_limit': 3, 'nodes': [], 'values': ['a', 'a', 'b'], 'replacement': [], 'value_limit': 1}, {'operand-cost': 3, 'row-add-gate': True, 'group-cost': 0, 'set-cost': 2, 'replace-capacity': True, 'remaining-rows': 1})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
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
contract fixture 0{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 1{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 2{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 3{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 1, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 4{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 5{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 1, 'operand-cost': 0, 'remaining-rows': 2, 'replace-capacity': False, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 6{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}{'group-cost': 0, 'operand-cost': 0, 'remaining-rows': 3, 'replace-capacity': True, 'row-add-gate': True, 'set-cost': 2}Passed
contract fixture 7{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 8{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 1, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed
contract fixture 9{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}{'group-cost': 0, 'operand-cost': 3, 'remaining-rows': 0, 'replace-capacity': True, 'row-add-gate': False, 'set-cost': 0}Passed

SHA-256 / efef70134a678bbea647c519d7942e28012c796bef085f2fd90a426344232a23

Verification & scope

Deterministic bounded UI-state model only; no browser, query engine, network, or production-standard conformance is claimed. 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:41:13.564293+00:00.

Case digest / 1e314107c4c3e3527aae3c009b0bc0800d4faec5c1b7380fc818bb889c86d7ed