broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),None) or defaults.get('q')
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return dict(pairs).get('q',defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

prompt:
Empty query value.

This route-state adapter models already-decoded query pairs. Repeated pairs and insertion order remain significant, first occurrence is used by single-value readers, explicit empty values override defaults, and fragment absence differs from empty. Operation empty-query-value has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return dict(pairs)
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**dict(pairs),**defaults}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

prompt:
Query default merge.

This route-state adapter models already-decoded query pairs. Repeated pairs and insertion order remain significant, first occurrence is used by single-value readers, explicit empty values override defaults, and fragment absence differs from empty. Operation query-default-merge has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment or 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment or ''
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

prompt:
Fragment null preservation.

This route-state adapter models already-decoded query pairs. Repeated pairs and insertion order remain significant, first occurrence is used by single-value readers, explicit empty values override defaults, and fragment absence differs from empty. Operation fragment-null-preservation has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return route
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(sorted(pairs)))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k!='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

prompt:
State cache key.

This route-state adapter models already-decoded query pairs. Repeated pairs and insertion order remain significant, first occurrence is used by single-value readers, explicit empty values override defaults, and fragment absence differs from empty. Operation state-cache-key has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return []
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    pairs, defaults, route, fragment = s
    if operation == 'repeated-values-retention':
        return [v for k,v in pairs if k=='tag']
    if operation == 'empty-query-value':
        return next((v for k,v in pairs if k=='q'),defaults.get('q'))
    if operation == 'query-default-merge':
        return {**defaults,**dict(pairs)}
    if operation == 'fragment-null-preservation':
        return fragment if fragment is not None else 'absent'
    if operation == 'state-cache-key':
        return (route,tuple(pairs))
    if operation == 'remove-one-query-name':
        return [(k,v) for k,v in pairs if k=='q']
    if operation == 'first-value-precedence':
        return next((v for k,v in pairs if k=='q'),None)
    if operation == 'debug-exclusion':
        return [(k,v) for k,v in pairs if k!='debug']
    if operation == 'explicit-query-key-set':
        return sorted({k for k,v in pairs})
    if operation == 'navigation-fragment-key':
        return (route,fragment)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated-values-retention scenario 1', solve('repeated-values-retention', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['x','y'])
check('repeated-values-retention scenario 2', solve('repeated-values-retention', ([('q','')],{'q':'default'},'/a','')), [])
check('repeated-values-retention scenario 3', solve('repeated-values-retention', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('repeated-values-retention scenario 4', solve('repeated-values-retention', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [])
check('repeated-values-retention scenario 5', solve('repeated-values-retention', ([('page','0'),('tag','x')],{},'/a',None)), ['x'])
check('repeated-values-retention scenario 6', solve('repeated-values-retention', ([('q','a'),('q','b')],{},'/b','end')), [])
check('empty-query-value scenario 1', solve('empty-query-value', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('empty-query-value scenario 2', solve('empty-query-value', ([('q','')],{'q':'default'},'/a','')), '')
check('empty-query-value scenario 3', solve('empty-query-value', ([] ,{'q':'default','page':'1'},'/a',None)), 'default')
check('empty-query-value scenario 4', solve('empty-query-value', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('empty-query-value scenario 5', solve('empty-query-value', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('empty-query-value scenario 6', solve('empty-query-value', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('query-default-merge scenario 1', solve('query-default-merge', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), {'q':'a','tag':'y'})
check('query-default-merge scenario 2', solve('query-default-merge', ([('q','')],{'q':'default'},'/a','')), {'q':''})
check('query-default-merge scenario 3', solve('query-default-merge', ([] ,{'q':'default','page':'1'},'/a',None)), {'q':'default','page':'1'})
check('query-default-merge scenario 4', solve('query-default-merge', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), {'q':'0','page':'2','debug':'1'})
check('query-default-merge scenario 5', solve('query-default-merge', ([('page','0'),('tag','x')],{},'/a',None)), {'page':'0','tag':'x'})
check('query-default-merge scenario 6', solve('query-default-merge', ([('q','a'),('q','b')],{},'/b','end')), {'q':'b'})
check('fragment-null-preservation scenario 1', solve('fragment-null-preservation', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'part')
check('fragment-null-preservation scenario 2', solve('fragment-null-preservation', ([('q','')],{'q':'default'},'/a','')), '')
check('fragment-null-preservation scenario 3', solve('fragment-null-preservation', ([] ,{'q':'default','page':'1'},'/a',None)), 'absent')
check('fragment-null-preservation scenario 4', solve('fragment-null-preservation', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), 'x')
check('fragment-null-preservation scenario 5', solve('fragment-null-preservation', ([('page','0'),('tag','x')],{},'/a',None)), 'absent')
check('fragment-null-preservation scenario 6', solve('fragment-null-preservation', ([('q','a'),('q','b')],{},'/b','end')), 'end')
check('state-cache-key scenario 1', solve('state-cache-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),(('q','a'),('tag','x'),('tag','y'))))
check('state-cache-key scenario 2', solve('state-cache-key', ([('q','')],{'q':'default'},'/a','')), ('/a',(('q',''),)))
check('state-cache-key scenario 3', solve('state-cache-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',()))
check('state-cache-key scenario 4', solve('state-cache-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b',(('q','0'),('page','2'),('debug','1'))))
check('state-cache-key scenario 5', solve('state-cache-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',(('page','0'),('tag','x'))))
check('state-cache-key scenario 6', solve('state-cache-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b',(('q','a'),('q','b'))))
check('remove-one-query-name scenario 1', solve('remove-one-query-name', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('tag','x'),('tag','y')])
check('remove-one-query-name scenario 2', solve('remove-one-query-name', ([('q','')],{'q':'default'},'/a','')), [])
check('remove-one-query-name scenario 3', solve('remove-one-query-name', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('remove-one-query-name scenario 4', solve('remove-one-query-name', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('page','2'),('debug','1')])
check('remove-one-query-name scenario 5', solve('remove-one-query-name', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('remove-one-query-name scenario 6', solve('remove-one-query-name', ([('q','a'),('q','b')],{},'/b','end')), [])
check('first-value-precedence scenario 1', solve('first-value-precedence', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), 'a')
check('first-value-precedence scenario 2', solve('first-value-precedence', ([('q','')],{'q':'default'},'/a','')), '')
check('first-value-precedence scenario 3', solve('first-value-precedence', ([] ,{'q':'default','page':'1'},'/a',None)), None)
check('first-value-precedence scenario 4', solve('first-value-precedence', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), '0')
check('first-value-precedence scenario 5', solve('first-value-precedence', ([('page','0'),('tag','x')],{},'/a',None)), None)
check('first-value-precedence scenario 6', solve('first-value-precedence', ([('q','a'),('q','b')],{},'/b','end')), 'a')
check('debug-exclusion scenario 1', solve('debug-exclusion', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), [('q','a'),('tag','x'),('tag','y')])
check('debug-exclusion scenario 2', solve('debug-exclusion', ([('q','')],{'q':'default'},'/a','')), [('q','')])
check('debug-exclusion scenario 3', solve('debug-exclusion', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('debug-exclusion scenario 4', solve('debug-exclusion', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), [('q','0'),('page','2')])
check('debug-exclusion scenario 5', solve('debug-exclusion', ([('page','0'),('tag','x')],{},'/a',None)), [('page','0'),('tag','x')])
check('debug-exclusion scenario 6', solve('debug-exclusion', ([('q','a'),('q','b')],{},'/b','end')), [('q','a'),('q','b')])
check('explicit-query-key-set scenario 1', solve('explicit-query-key-set', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ['q','tag'])
check('explicit-query-key-set scenario 2', solve('explicit-query-key-set', ([('q','')],{'q':'default'},'/a','')), ['q'])
check('explicit-query-key-set scenario 3', solve('explicit-query-key-set', ([] ,{'q':'default','page':'1'},'/a',None)), [])
check('explicit-query-key-set scenario 4', solve('explicit-query-key-set', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ['debug','page','q'])
check('explicit-query-key-set scenario 5', solve('explicit-query-key-set', ([('page','0'),('tag','x')],{},'/a',None)), ['page','tag'])
check('explicit-query-key-set scenario 6', solve('explicit-query-key-set', ([('q','a'),('q','b')],{},'/b','end')), ['q'])
check('navigation-fragment-key scenario 1', solve('navigation-fragment-key', ([('q','a'),('tag','x'),('tag','y')],{'q':'default'},'/a/'+str(N),'part')), ('/a/'+str(N),'part'))
check('navigation-fragment-key scenario 2', solve('navigation-fragment-key', ([('q','')],{'q':'default'},'/a','')), ('/a',''))
check('navigation-fragment-key scenario 3', solve('navigation-fragment-key', ([] ,{'q':'default','page':'1'},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 4', solve('navigation-fragment-key', ([('q','0'),('page','2'),('debug','1')],{'q':'default'},'/b','x')), ('/b','x'))
check('navigation-fragment-key scenario 5', solve('navigation-fragment-key', ([('page','0'),('tag','x')],{},'/a',None)), ('/a',None))
check('navigation-fragment-key scenario 6', solve('navigation-fragment-key', ([('q','a'),('q','b')],{},'/b','end')), ('/b','end'))
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)

prompt:
Remove one query name.

This route-state adapter models already-decoded query pairs. Repeated pairs and insertion order remain significant, first occurrence is used by single-value readers, explicit empty values override defaults, and fragment absence differs from empty. Operation remove-one-query-name has the six explicit input/output oracles below.

split: open-access