"""Authored bounded pairing, deliberately no downstream side effect."""
import json,platform
def checked(left,right):
 if len(left)>8 or len(right)>8:raise ValueError('bounded fixture')
 for rows in [left,right]:
  if any(type(x) is not dict or set(x)!={'id'} or type(x['id']) is not str for x in rows):raise ValueError('id schema')
  if len({x['id'] for x in rows})!=len(rows):raise ValueError('duplicate id')
 staged=list(zip(left,right,strict=True))
 if any(a['id']!=b['id'] for a,b in staged):raise ValueError('identity mismatch')
 return staged
def demo():
 left=[{'id':x} for x in ['A','B','C']];short=[{'id':x} for x in ['A','B']]
 normal=list(zip(left,short));earlier=[];error=None
 try:
  for pair in zip(left,short,strict=True):earlier.append(pair)
 except ValueError:error='ValueError'
 assert len(normal)==len(earlier)==2 and error=='ValueError'
 committed=[];rejected=[]
 for label,r in [('short',short),('same_length_wrong_identity',[{'id':x} for x in ['B','A','C']]),('duplicate_id',[{'id':x} for x in ['A','A','C']]),('missing_id',[{'id':'A'},{},{'id':'C'}])]:
  try:staged=checked(left,r)
  except ValueError:rejected.append(label)
  else:committed.extend(staged)
 assert committed==[] and len(rejected)==4
 good=checked(left,[{'id':x} for x in ['A','B','C']]);assert [a['id'] for a,b in good]==['A','B','C']
 assert checked([],[])==[]
 return {'runtime':platform.python_version(),'default_pairs':normal,'strict_pairs_before_error':earlier,'strict_error':error,'staged_rejections':rejected,'committed_after_rejections':committed,'valid_pairs':good,'empty_pairing':[],'scope':'strict catches length only and may already yield; local staging plus explicit ID check, no transactional/external effect guarantee.'}
if __name__=='__main__':print(json.dumps(demo(),ensure_ascii=True,indent=2))
