File size: 163,254 Bytes
e4b8ca9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
id,repo,base_commit,language,conflict_type,composition_expected,difficulty,source,status,task_a,task_b,task_a_summary,task_b_summary,patch_a,patch_b,combined_patch,oracle_patch_a_path,oracle_patch_b_path,oracle_composition_path,oracle_patch_a,oracle_patch_b,oracle_composition,validation_a,validation_b,validation_composed,merge_result,failure_summary,notes,github_instance_path
click__001,https://github.com/pallets/click,2c8cd3ac958a7eb316d67f2d316c27086c4c0369,Python,configuration,fail,easy,researcher_constructed,reproduced,"# Task A: Dashed default-map option aliases

## Problem

Click stores option parameter names internally with underscores, but users often
write configuration files with CLI-style dashed keys such as `api-key`.

## Desired behavior

Allow `Context.default_map` to resolve dashed option names as aliases for their
underscored parameter names.

## Constraints

Existing underscored keys must continue to work. The change should only affect
default-map lookup and should not alter command-line parsing or environment
variable naming.

## Success criteria

A command option declared as `--api-key` can receive its default from either
`{""api_key"": ""...""}` or `{""api-key"": ""...""}` in `default_map`.
","# Task B: Default-map precedence over auto envvars

## Problem

When both automatic environment variables and `default_map` are available,
applications may need explicit configuration-map values to override ambient
environment settings.

## Desired behavior

Update option resolution so a value from `Context.default_map` takes precedence
over an automatically derived environment variable value.

## Constraints

Explicit command-line arguments must still have the highest precedence. The
change should apply to automatically derived envvars, not necessarily every
custom envvar path.

## Success criteria

If `APP_API_KEY` is set and `default_map` also provides `api_key`, the command
uses the `default_map` value when no CLI argument is supplied.
","Allow Context.default_map to use dashed option names, such as api-key, as aliases for Click's internal underscored parameter names, such as api_key.",Allow Context.default_map values to override automatically derived environment variable values during option resolution.,"diff --git a/src/click/core.py b/src/click/core.py
index de129ec..2df26c7 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -765,6 +765,13 @@ class Context:
         ``name`` is ``None``, or the stored value is the internal
         :data:`UNSET` sentinel.
         """"""
+        if (
+            name is not None
+            and self.default_map is not None
+            and name not in self.default_map
+        ):
+            name = name.replace(""_"", ""-"")
+
         return (
             name is not None
             and self.default_map is not None
@@ -797,6 +804,9 @@ class Context:
 
         # Assert to make the type checker happy.
         assert self.default_map is not None
+        if name not in self.default_map:
+            name = name.replace(""_"", ""-"")
+
         value = self.default_map[name]
 
         if call and callable(value):
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..d6d4a16 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -2501,12 +2501,6 @@ class Parameter(ABC):
             else ParameterSource.DEFAULT
         )
 
-        if value is UNSET:
-            envvar_value = self.value_from_envvar(ctx)
-            if envvar_value is not None:
-                value = envvar_value
-                source = ParameterSource.ENVIRONMENT
-
         if value is UNSET:
             default_map_value = ctx.lookup_default(self.name)
             if default_map_value is not None or ctx._default_map_has(self.name):
@@ -2518,6 +2512,12 @@ class Parameter(ABC):
                 if isinstance(value, str) and self.nargs != 1:
                     value = self.type.split_envvar_value(value)
 
+        if value is UNSET:
+            envvar_value = self.value_from_envvar(ctx)
+            if envvar_value is not None:
+                value = envvar_value
+                source = ParameterSource.ENVIRONMENT
+
         if value is UNSET:
             default_value = self.get_default(ctx)
             if default_value is not UNSET:
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..049be89 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -765,6 +765,13 @@ class Context:
         ``name`` is ``None``, or the stored value is the internal
         :data:`UNSET` sentinel.
         """"""
+        if (
+            name is not None
+            and self.default_map is not None
+            and name not in self.default_map
+        ):
+            name = name.replace(""_"", ""-"")
+
         return (
             name is not None
             and self.default_map is not None
@@ -797,6 +804,9 @@ class Context:
 
         # Assert to make the type checker happy.
         assert self.default_map is not None
+        if name not in self.default_map:
+            name = name.replace(""_"", ""-"")
+
         value = self.default_map[name]
 
         if call and callable(value):
@@ -2501,12 +2511,6 @@ class Parameter(ABC):
             else ParameterSource.DEFAULT
         )
 
-        if value is UNSET:
-            envvar_value = self.value_from_envvar(ctx)
-            if envvar_value is not None:
-                value = envvar_value
-                source = ParameterSource.ENVIRONMENT
-
         if value is UNSET:
             default_map_value = ctx.lookup_default(self.name)
             if default_map_value is not None or ctx._default_map_has(self.name):
@@ -2518,6 +2522,12 @@ class Parameter(ABC):
                 if isinstance(value, str) and self.nargs != 1:
                     value = self.type.split_envvar_value(value)
 
+        if value is UNSET:
+            envvar_value = self.value_from_envvar(ctx)
+            if envvar_value is not None:
+                value = envvar_value
+                source = ParameterSource.ENVIRONMENT
+
         if value is UNSET:
             default_value = self.get_default(ctx)
             if default_value is not UNSET:
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import click
from click.testing import CliRunner


def test_default_map_accepts_dashed_option_name():
    @click.command()
    @click.option(""--api-key"")
    def cli(api_key):
        click.echo(api_key)

    result = CliRunner().invoke(cli, [], default_map={""api-key"": ""from-map""})

    assert result.output == ""from-map\n""
","import click
from click.testing import CliRunner


def test_default_map_overrides_auto_envvar():
    @click.command()
    @click.option(""--api-key"")
    def cli(api_key):
        click.echo(api_key)

    result = CliRunner().invoke(
        cli,
        [],
        auto_envvar_prefix=""APP"",
        default_map={""api_key"": ""from-map""},
        env={""APP_API_KEY"": ""from-env""},
    )

    assert result.output == ""from-map\n""
","import click
from click.testing import CliRunner


def test_dashed_default_map_alias_does_not_override_auto_envvar():
    @click.command()
    @click.option(""--api-key"")
    def cli(api_key):
        click.echo(api_key)

    result = CliRunner().invoke(
        cli,
        [],
        auto_envvar_prefix=""APP"",
        default_map={""api-key"": ""from-map""},
        env={""APP_API_KEY"": ""from-env""},
    )

    assert result.output == ""from-env\n""
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A broadens default_map lookup to treat dashed keys as aliases. Patch B gives default_map higher precedence than auto envvars. Together, a dashed default_map alias unexpectedly overrides APP_API_KEY, changing the composed command output from from-env to from-map.",Seed instance used to validate the AgentConflictBench packaging and oracle format. This is a controlled configuration-precedence conflict in Click option resolution.,instances/click__001
click__002,https://github.com/pallets/click,2c8cd3ac958a7eb316d67f2d316c27086c4c0369,Python,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Underscore aliases for dashed command names

## Problem

Click commands are commonly registered with dashed names, but users sometimes
type underscores when invoking command names from scripts or generated tools.

## Desired behavior

Allow command lookup to treat underscores in an invoked command name as aliases
for dashes in registered command names.

## Constraints

Exact command-name matches should keep their current behavior. The alias should
only be used as a fallback when the invoked name is not found directly.

## Success criteria

A group containing `foo-bar` can resolve an invocation of `foo_bar` to the same
command.
","# Task B: Lowercase fallback for command lookup

## Problem

Users may invoke commands with accidental uppercase or mixed-case spelling even
when the registered command name is lowercase.

## Desired behavior

Allow command lookup to fall back to a lowercase command name when the original
invocation is not found exactly.

## Constraints

Exact case-sensitive matches must continue to win. The fallback should not
change command registration or display names.

## Success criteria

A group containing `status` can resolve an invocation of `STATUS` to the
registered command.
",Allow command lookup to treat underscores in an invoked command name as aliases for dashes in registered command names.,Allow command lookup to fall back to lowercase command names when a mixed-case or uppercase command invocation is not found exactly.,"diff --git a/src/click/core.py b/src/click/core.py
index de129ec..5e040ce 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1938,7 +1938,12 @@ class Group(Command):
         """"""Given a context and a command name, this returns a :class:`Command`
         object if it exists or returns ``None``.
         """"""
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is None:
+            cmd = self.commands.get(cmd_name.replace(""_"", ""-""))
+
+        return cmd
 
     def list_commands(self, ctx: Context) -> list[str]:
         """"""Returns a list of subcommand names in the order they should appear.""""""
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..cb1467c 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -2077,6 +2077,13 @@ class Group(Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         # If we don't find the command we want to show an error message
         # to the user that it was not provided.  However, there is
         # something else we should do: if the first argument looks like
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..b49d8b3 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1938,7 +1938,12 @@ class Group(Command):
         """"""Given a context and a command name, this returns a :class:`Command`
         object if it exists or returns ``None``.
         """"""
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is None:
+            cmd = self.commands.get(cmd_name.replace(""_"", ""-""))
+
+        return cmd
 
     def list_commands(self, ctx: Context) -> list[str]:
         """"""Returns a list of subcommand names in the order they should appear.""""""
@@ -2077,6 +2082,13 @@ class Group(Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         # If we don't find the command we want to show an error message
         # to the user that it was not provided.  However, there is
         # something else we should do: if the first argument looks like
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import click
from click.testing import CliRunner


def test_underscore_invocation_resolves_dashed_command():
    @click.group()
    def cli():
        pass

    @cli.command(""foo-bar"")
    def foo_bar():
        click.echo(""dash"")

    result = CliRunner().invoke(cli, [""foo_bar""])

    assert result.output == ""dash\n""
","import click
from click.testing import CliRunner


def test_uppercase_invocation_resolves_lowercase_command():
    @click.group()
    def cli():
        pass

    @cli.command(""status"")
    def status():
        click.echo(""ok"")

    result = CliRunner().invoke(cli, [""STATUS""])

    assert result.output == ""ok\n""
","import click
from click.testing import CliRunner


def test_uppercase_underscore_does_not_transitively_resolve_dashed_command():
    @click.group()
    def cli():
        pass

    @cli.command(""foo-bar"")
    def foo_bar():
        click.echo(""dash"")

    result = CliRunner().invoke(cli, [""FOO_BAR""])

    assert result.exit_code != 0
    assert ""No such command 'foo_bar'"" in result.output
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A introduces underscore-to-dash command aliasing. Patch B introduces case-insensitive fallback lookup. Together, they create an unintended transitive lookup where FOO_BAR resolves to foo-bar, even though neither patch independently admits that invocation form.",Second seed instance. This demonstrates a behavioral command-resolution conflict rather than a configuration-precedence conflict.,instances/click__002
click__003,https://github.com/pallets/click,2c8cd3ac958a7eb316d67f2d316c27086c4c0369,Python,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Reflect explicit registration aliases on command objects

## Problem

When a command is registered under an explicit name, the group exposes that
alias but the command object may still report its original public name.

## Desired behavior

Update a command object's public name to match the explicit API name used during
registration.

## Constraints

Only explicit registration aliases should trigger the rename. Commands added
without an alias should preserve their existing names.

## Success criteria

After registering a command with an explicit alias, inspecting the command's
public name returns the alias.
","# Task B: Reject duplicate public command names

## Problem

A group can become ambiguous if two distinct command objects expose the same
public command name.

## Desired behavior

Reject registration of a distinct command object when its public command name is
already registered on the same group.

## Constraints

Re-registering the same command object should not be treated as a distinct-name
collision unless existing Click behavior already rejects it.

## Success criteria

Attempting to add two different command objects with the same public name raises
a registration error.
","When a command is registered under an explicit name, update the command object's public name to match the registered API name.",Reject registering a distinct command object when its public command name is already registered on the same group.,"diff --git a/src/click/core.py b/src/click/core.py
index de129ec..e2a68f7 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1785,6 +1785,9 @@ class Group(Command):
         name = name or cmd.name
         if name is None:
             raise TypeError(""Command has no name."")
+        if cmd.name != name:
+            cmd.name = name
+
         _check_nested_chain(self, name, cmd, register=True)
         self.commands[name] = cmd
 
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..11cec1e 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1789,2 +1789,8 @@ class Group(Command):
         self.commands[name] = cmd
+        if (
+            cmd.name is not None
+            and cmd.name in self.commands
+            and self.commands[cmd.name] is not cmd
+        ):
+            raise TypeError(f""Command name {cmd.name!r} is already registered."")
 
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..8f929cc 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1785,8 +1785,17 @@ class Group(Command):
         name = name or cmd.name
         if name is None:
             raise TypeError(""Command has no name."")
+        if cmd.name != name:
+            cmd.name = name
+
         _check_nested_chain(self, name, cmd, register=True)
         self.commands[name] = cmd
+        if (
+            cmd.name is not None
+            and cmd.name in self.commands
+            and self.commands[cmd.name] is not cmd
+        ):
+            raise TypeError(f""Command name {cmd.name!r} is already registered."")
 
     @t.overload
     def command(self, __func: t.Callable[..., t.Any]) -> Command: ...
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import click


def test_explicit_registration_name_updates_command_name():
    cli = click.Group(""cli"")
    cmd = click.Command(""internal"")

    cli.add_command(cmd, ""public"")

    assert cmd.name == ""public""
    assert cli.commands[""public""] is cmd
","import pytest
import click


def test_distinct_command_with_duplicate_public_name_is_rejected():
    cli = click.Group(""cli"")
    cli.add_command(click.Command(""sync""))

    with pytest.raises(TypeError, match=""already registered""):
        cli.add_command(click.Command(""sync""), ""sync-alias"")
","import pytest
import click


def test_alias_name_sync_does_not_bypass_duplicate_command_name_check():
    cli = click.Group(""cli"")
    cli.add_command(click.Command(""sync""))

    with pytest.raises(TypeError, match=""already registered""):
        cli.add_command(click.Command(""sync""), ""sync-alias"")
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A mutates a command object's public name to the explicit registration alias. Patch B rejects duplicate public command names after registration. Together, Patch A changes the name before Patch B checks for duplicates, allowing a duplicate original command name to bypass the new API-contract check.",Third seed instance. This demonstrates an API-contract conflict in Click command registration rather than option precedence or command lookup behavior.,instances/click__003
click__004,https://github.com/pallets/click,2c8cd3ac958a7eb316d67f2d316c27086c4c0369,Python,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Unique command-prefix lookup

## Problem

Long command names are inconvenient to type, and some CLIs allow users to invoke
a command by an unambiguous prefix.

## Desired behavior

Allow command lookup to resolve a command-name prefix when it uniquely matches a
registered command.

## Constraints

Ambiguous prefixes must not resolve silently. Exact command names should keep
their current behavior.

## Success criteria

If only `status` matches the prefix `sta`, invoking `sta` runs `status`; if more
than one command matches, lookup remains unresolved or reports ambiguity.
","# Task B: Lowercase fallback for Click command lookup

## Problem

Command invocations with accidental uppercase spelling fail even when the
registered command has a clear lowercase equivalent.

## Desired behavior

When exact lookup fails, retry lookup using the lowercase form of the invoked
command name.

## Constraints

Exact matches must still take priority. The fallback should not make command
registration case-insensitive globally.

## Success criteria

A group containing `status` can resolve `STATUS` to `status` when no exact
`STATUS` command exists.
",Allow a command invocation to resolve a uniquely matching command-name prefix.,Allow command lookup to fall back to lowercase command names when an uppercase or mixed-case command invocation is not found exactly.,"diff --git a/src/click/core.py b/src/click/core.py
index de129ec..52d1cd2 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1938,7 +1938,21 @@ class Group(Command):
         """"""Given a context and a command name, this returns a :class:`Command`
         object if it exists or returns ``None``.
         """"""
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is not None:
+            return cmd
+
+        matches = [
+            command
+            for name, command in self.commands.items()
+            if name.startswith(cmd_name)
+        ]
+
+        if len(matches) == 1:
+            return matches[0]
+
+        return None
 
     def list_commands(self, ctx: Context) -> list[str]:
         """"""Returns a list of subcommand names in the order they should appear.""""""
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..cb1467c 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -2077,6 +2077,13 @@ class Group(Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         # If we don't find the command we want to show an error message
         # to the user that it was not provided.  However, there is
         # something else we should do: if the first argument looks like
","diff --git a/src/click/core.py b/src/click/core.py
index de129ec..6d9c664 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -1938,7 +1938,21 @@ class Group(Command):
         """"""Given a context and a command name, this returns a :class:`Command`
         object if it exists or returns ``None``.
         """"""
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is not None:
+            return cmd
+
+        matches = [
+            command
+            for name, command in self.commands.items()
+            if name.startswith(cmd_name)
+        ]
+
+        if len(matches) == 1:
+            return matches[0]
+
+        return None
 
     def list_commands(self, ctx: Context) -> list[str]:
         """"""Returns a list of subcommand names in the order they should appear.""""""
@@ -2077,6 +2091,13 @@ class Group(Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         # If we don't find the command we want to show an error message
         # to the user that it was not provided.  However, there is
         # something else we should do: if the first argument looks like
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import click
from click.testing import CliRunner


def test_unique_prefix_invocation_resolves_command():
    @click.group()
    def cli():
        pass

    @cli.command(""status"")
    def status():
        click.echo(""ok"")

    @cli.command(""stop"")
    def stop():
        click.echo(""stop"")

    result = CliRunner().invoke(cli, [""sta""])

    assert result.output == ""ok\n""
","import click
from click.testing import CliRunner


def test_uppercase_invocation_resolves_lowercase_command():
    @click.group()
    def cli():
        pass

    @cli.command(""status"")
    def status():
        click.echo(""ok"")

    result = CliRunner().invoke(cli, [""STATUS""])

    assert result.output == ""ok\n""
","import click
from click.testing import CliRunner


def test_uppercase_prefix_does_not_transitively_resolve_command():
    @click.group()
    def cli():
        pass

    @cli.command(""status"")
    def status():
        click.echo(""ok"")

    result = CliRunner().invoke(cli, [""STA""])

    assert result.exit_code != 0
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A introduces unique-prefix command lookup. Patch B introduces lowercase fallback lookup. Together, an uppercase prefix such as STA is lowercased to sta and then resolved as a unique prefix for status, even though neither patch independently intended uppercase abbreviations.",Expansion seed instance. This is a controlled command-resolution conflict distinct from the underscore/dash aliasing interaction in click__002.,instances/click__004
typer__001,https://github.com/fastapi/typer,9a7b2e83f6b62c750d6026b0de9ebf2026a8b8fa,Python,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Underscore aliases for dashed Typer commands

## Problem

Typer command names often use dashes, while programmatic callers and scripts may
produce underscores.

## Desired behavior

Allow `TyperGroup` command lookup to treat underscores in the invoked command
name as aliases for dashes in registered command names.

## Constraints

Exact command lookup must remain unchanged. The alias should be a fallback and
should not alter help output or registered command names.

## Success criteria

A Typer command registered as `foo-bar` can be invoked as `foo_bar` when no
exact `foo_bar` command exists.
","# Task B: Lowercase fallback for Typer command lookup

## Problem

Users sometimes invoke Typer commands with uppercase or mixed-case spelling even
when the intended command is registered in lowercase.

## Desired behavior

Allow `TyperGroup` lookup to fall back to lowercase command names after exact
lookup fails.

## Constraints

Exact matches should still win. The fallback should not change registration
names or help text.

## Success criteria

A Typer app containing `status` can resolve an invocation of `STATUS` to the
registered `status` command.
",Allow TyperGroup command lookup to treat underscores in an invoked command name as aliases for dashes in registered command names.,Allow TyperGroup command lookup to fall back to lowercase command names when a mixed-case or uppercase command invocation is not found exactly.,"diff --git a/typer/core.py b/typer/core.py
index 1bfc399..1ef0610 100644
--- a/typer/core.py
+++ b/typer/core.py
@@ -1048,7 +1048,12 @@ class TyperGroup(_click.Command):
         self.commands[name] = cmd
 
     def get_command(self, ctx: _click.Context, cmd_name: str) -> _click.Command | None:
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is None:
+            cmd = self.commands.get(cmd_name.replace(""_"", ""-""))
+
+        return cmd
 
     def collect_usage_pieces(self, ctx: _click.Context) -> list[str]:
         rv = super().collect_usage_pieces(ctx)
","diff --git a/typer/core.py b/typer/core.py
index 1bfc399..554d213 100644
--- a/typer/core.py
+++ b/typer/core.py
@@ -1168,6 +1168,13 @@ class TyperGroup(_click.Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         if cmd is None and not ctx.resilient_parsing:
             if _split_opt(cmd_name)[0]:
                 self.parse_args(ctx, args)
","diff --git a/typer/core.py b/typer/core.py
index 1bfc399..777e0ab 100644
--- a/typer/core.py
+++ b/typer/core.py
@@ -1048,7 +1048,12 @@ class TyperGroup(_click.Command):
         self.commands[name] = cmd
 
     def get_command(self, ctx: _click.Context, cmd_name: str) -> _click.Command | None:
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is None:
+            cmd = self.commands.get(cmd_name.replace(""_"", ""-""))
+
+        return cmd
 
     def collect_usage_pieces(self, ctx: _click.Context) -> list[str]:
         rv = super().collect_usage_pieces(ctx)
@@ -1168,6 +1173,13 @@ class TyperGroup(_click.Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         if cmd is None and not ctx.resilient_parsing:
             if _split_opt(cmd_name)[0]:
                 self.parse_args(ctx, args)
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import typer
from typer.testing import CliRunner


def test_underscore_invocation_resolves_dashed_command():
    app = typer.Typer()

    @app.command(""foo-bar"")
    def foo_bar():
        typer.echo(""dash"")

    @app.command(""other"")
    def other():
        typer.echo(""other"")

    result = CliRunner().invoke(app, [""foo_bar""])

    assert result.output == ""dash\n""
","import typer
from typer.testing import CliRunner


def test_uppercase_invocation_resolves_lowercase_command():
    app = typer.Typer()

    @app.command(""status"")
    def status():
        typer.echo(""ok"")

    @app.command(""other"")
    def other():
        typer.echo(""other"")

    result = CliRunner().invoke(app, [""STATUS""])

    assert result.output == ""ok\n""
","import typer
from typer.testing import CliRunner


def test_uppercase_underscore_does_not_transitively_resolve_dashed_command():
    app = typer.Typer()

    @app.command(""foo-bar"")
    def foo_bar():
        typer.echo(""dash"")

    @app.command(""other"")
    def other():
        typer.echo(""other"")

    result = CliRunner().invoke(app, [""FOO_BAR""])

    assert result.exit_code != 0
    assert ""No such command"" in result.output
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A introduces underscore-to-dash command aliasing in TyperGroup. Patch B introduces case-insensitive fallback lookup. Together, they create an unintended transitive lookup where FOO_BAR resolves to foo-bar, even though neither patch independently admits that invocation form.",First non-Click seed instance. This demonstrates that the command-resolution interference pattern can appear in Typer's framework layer as well.,instances/typer__001
typer__002,https://github.com/fastapi/typer,9a7b2e83f6b62c750d6026b0de9ebf2026a8b8fa,Python,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Unique-prefix Typer command lookup

## Problem

Typer command names may be long, and users sometimes expect unambiguous
abbreviations to work.

## Desired behavior

Allow a Typer command invocation to resolve a uniquely matching command-name
prefix.

## Constraints

Ambiguous prefixes must not execute a command silently. Exact command names
should preserve their current behavior.

## Success criteria

If `status` is the only registered command beginning with `sta`, invoking `sta`
resolves to `status`.
","# Task B: Lowercase fallback for Typer invocations

## Problem

Case mistakes in command invocations are common, especially in scripts and
documentation examples.

## Desired behavior

When exact Typer command lookup fails, retry lookup using the lowercase invoked
name.

## Constraints

The fallback should not rewrite registered command names or affect exact
case-sensitive matches.

## Success criteria

A command registered as `status` can be invoked as `STATUS` when no exact
uppercase command exists.
",Allow a Typer command invocation to resolve a uniquely matching command-name prefix.,Allow Typer command lookup to fall back to lowercase command names when an uppercase or mixed-case command invocation is not found exactly.,"diff --git a/typer/core.py b/typer/core.py
index 51cd733..e8d09d3 100644
--- a/typer/core.py
+++ b/typer/core.py
@@ -1048,7 +1048,21 @@ class TyperGroup(_click.Command):
         self.commands[name] = cmd
 
     def get_command(self, ctx: _click.Context, cmd_name: str) -> _click.Command | None:
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is not None:
+            return cmd
+
+        matches = [
+            command
+            for name, command in self.commands.items()
+            if name.startswith(cmd_name)
+        ]
+
+        if len(matches) == 1:
+            return matches[0]
+
+        return None
 
     def collect_usage_pieces(self, ctx: _click.Context) -> list[str]:
         rv = super().collect_usage_pieces(ctx)
","diff --git a/typer/core.py b/typer/core.py
index 51cd733..a23b195 100644
--- a/typer/core.py
+++ b/typer/core.py
@@ -1168,6 +1168,13 @@ class TyperGroup(_click.Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         if cmd is None and not ctx.resilient_parsing:
             if _split_opt(cmd_name)[0]:
                 self.parse_args(ctx, args)
","diff --git a/typer/core.py b/typer/core.py
index 1bfc399..30d71a0 100644
--- a/typer/core.py
+++ b/typer/core.py
@@ -1048,7 +1048,21 @@ class TyperGroup(_click.Command):
         self.commands[name] = cmd
 
     def get_command(self, ctx: _click.Context, cmd_name: str) -> _click.Command | None:
-        return self.commands.get(cmd_name)
+        cmd = self.commands.get(cmd_name)
+
+        if cmd is not None:
+            return cmd
+
+        matches = [
+            command
+            for name, command in self.commands.items()
+            if name.startswith(cmd_name)
+        ]
+
+        if len(matches) == 1:
+            return matches[0]
+
+        return None
 
     def collect_usage_pieces(self, ctx: _click.Context) -> list[str]:
         rv = super().collect_usage_pieces(ctx)
@@ -1168,6 +1182,13 @@ class TyperGroup(_click.Command):
             cmd_name = ctx.token_normalize_func(cmd_name)
             cmd = self.get_command(ctx, cmd_name)
 
+        if cmd is None:
+            lower_cmd_name = cmd_name.lower()
+
+            if lower_cmd_name != cmd_name:
+                cmd_name = lower_cmd_name
+                cmd = self.get_command(ctx, cmd_name)
+
         if cmd is None and not ctx.resilient_parsing:
             if _split_opt(cmd_name)[0]:
                 self.parse_args(ctx, args)
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import typer
from typer.testing import CliRunner


def test_unique_prefix_invocation_resolves_command():
    app = typer.Typer()

    @app.command(""status"")
    def status():
        typer.echo(""ok"")

    @app.command(""stop"")
    def stop():
        typer.echo(""stop"")

    result = CliRunner().invoke(app, [""sta""])

    assert result.output == ""ok\n""
","import typer
from typer.testing import CliRunner


def test_uppercase_invocation_resolves_lowercase_command():
    app = typer.Typer()

    @app.command(""status"")
    def status():
        typer.echo(""ok"")

    @app.command(""other"")
    def other():
        typer.echo(""other"")

    result = CliRunner().invoke(app, [""STATUS""])

    assert result.output == ""ok\n""
","import typer
from typer.testing import CliRunner


def test_uppercase_prefix_does_not_transitively_resolve_command():
    app = typer.Typer()

    @app.command(""status"")
    def status():
        typer.echo(""ok"")

    @app.command(""other"")
    def other():
        typer.echo(""other"")

    result = CliRunner().invoke(app, [""STA""])

    assert result.exit_code != 0
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A introduces unique-prefix command lookup in TyperGroup. Patch B introduces lowercase fallback lookup. Together, an uppercase prefix such as STA is lowercased and then resolved as a unique prefix for status, creating an unintended command invocation path.",Expansion seed instance. This mirrors the command-resolution interaction in Typer's custom Click-compatible group implementation.,instances/typer__002
commander__001,https://github.com/tj/commander.js,ba6d13ddb4243e5913367734f8c159089ffe7834,JavaScript,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Unique-prefix Commander subcommands

## Problem

Commander subcommands can have long names, and users may expect an
unambiguous abbreviation to resolve to the intended command.

## Desired behavior

Allow subcommand lookup to resolve a command-name prefix when exactly one
registered subcommand matches that prefix.

## Constraints

Ambiguous prefixes must not execute a command silently. Exact subcommand names
should keep their current behavior.

## Success criteria

If `status` is the only subcommand beginning with `sta`, invoking `sta` runs the
`status` subcommand.
","# Task B: Lowercase fallback for Commander subcommands

## Problem

Users may type Commander subcommands with uppercase or mixed-case spelling even
when the registered subcommand is lowercase.

## Desired behavior

When exact subcommand dispatch fails, retry lookup with the lowercase invoked
subcommand name.

## Constraints

Exact matches should still take priority. The fallback should not change
registered command names or help output.

## Success criteria

A program containing a `status` subcommand can dispatch an invocation of
`STATUS` to `status`.
",Allow a Commander subcommand invocation to resolve a uniquely matching command-name prefix.,Allow Commander subcommand dispatch to fall back to lowercase command names when an uppercase or mixed-case invocation is not found exactly.,"diff --git a/lib/command.js b/lib/command.js
index e79a5ad..885f7d3 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -1660,10 +1660,20 @@ export class Command extends EventEmitter {
    * @return {Command | undefined}
    */
   _findCommand(name) {
     if (!name) return undefined;
-    return this.commands.find(
+    const exact = this.commands.find(
       (cmd) => cmd._name === name || cmd._aliases.includes(name),
     );
+    if (exact) return exact;
+
+    const matches = this.commands.filter(
+      (cmd) =>
+        cmd._name.startsWith(name) ||
+        cmd._aliases.some((alias) => alias.startsWith(name)),
+    );
+    if (matches.length === 1) return matches[0];
+
+    return undefined;
   }
 
   /**
    * Return an option matching `arg` if any.
","diff --git a/lib/command.js b/lib/command.js
index e79a5ad..3f3cc61 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -1567,6 +1567,14 @@ export class Command extends EventEmitter {
     unknown = parsed.unknown;
     this.args = operands.concat(unknown);
 
+    if (operands.length && !this._findCommand(operands[0])) {
+      const lowerCommandName = operands[0].toLowerCase();
+
+      if (lowerCommandName !== operands[0] && this._findCommand(lowerCommandName)) {
+        operands[0] = lowerCommandName;
+      }
+    }
+
     if (operands && this._findCommand(operands[0])) {
       return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);
     }
","diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..1bb74e3 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -1567,6 +1567,14 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
     unknown = parsed.unknown;
     this.args = operands.concat(unknown);
 
+    if (operands.length && !this._findCommand(operands[0])) {
+      const lowerCommandName = operands[0].toLowerCase();
+
+      if (lowerCommandName !== operands[0] && this._findCommand(lowerCommandName)) {
+        operands[0] = lowerCommandName;
+      }
+    }
+
     if (operands && this._findCommand(operands[0])) {
       return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);
     }
@@ -1660,9 +1668,19 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
    */
   _findCommand(name) {
     if (!name) return undefined;
-    return this.commands.find(
+    const exact = this.commands.find(
       (cmd) => cmd._name === name || cmd._aliases.includes(name),
     );
+    if (exact) return exact;
+
+    const matches = this.commands.filter(
+      (cmd) =>
+        cmd._name.startsWith(name) ||
+        cmd._aliases.some((alias) => alias.startsWith(name)),
+    );
+    if (matches.length === 1) return matches[0];
+
+    return undefined;
   }
 
   /**
",oracle/test_patch_a.mjs,oracle/test_patch_b.mjs,oracle/test_composition.mjs,"import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('unique prefix invocation resolves subcommand', () => {
  const program = new Command();
  let called = '';

  program.exitOverride();
  program.configureOutput({ writeOut: () => {}, writeErr: () => {} });
  program.command('status').action(() => {
    called = 'status';
  });
  program.command('stop').action(() => {
    called = 'stop';
  });

  program.parse(['node', 'test', 'sta']);

  assert.equal(called, 'status');
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('uppercase invocation resolves lowercase subcommand', () => {
  const program = new Command();
  let called = '';

  program.exitOverride();
  program.configureOutput({ writeOut: () => {}, writeErr: () => {} });
  program.command('status').action(() => {
    called = 'status';
  });
  program.command('other').action(() => {
    called = 'other';
  });

  program.parse(['node', 'test', 'STATUS']);

  assert.equal(called, 'status');
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('uppercase prefix does not transitively resolve subcommand', () => {
  const program = new Command();
  let called = '';

  program.exitOverride();
  program.configureOutput({ writeOut: () => {}, writeErr: () => {} });
  program.command('status').action(() => {
    called = 'status';
  });
  program.command('other').action(() => {
    called = 'other';
  });

  assert.throws(() => {
    program.parse(['node', 'test', 'STA']);
  });
  assert.equal(called, '');
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A introduces unique-prefix subcommand lookup. Patch B introduces lowercase fallback before dispatch. Together, an uppercase prefix such as STA is lowercased to sta and then resolved as a unique prefix for status, admitting a command spelling neither patch independently intended.",First JavaScript seed instance. The oracle uses Node's built-in node:test runner and imports Commander from the local repository checkout.,instances/commander__001
commander__002,https://github.com/tj/commander.js,ba6d13ddb4243e5913367734f8c159089ffe7834,JavaScript,configuration,fail,easy,researcher_constructed,reproduced,"# Task A: False-like environment values for booleans

## Problem

Boolean options sourced from environment variables often receive string values
such as `false`, `0`, or `no`, which should be interpreted as false rather than
truthy strings.

## Desired behavior

Treat common false-like environment values for boolean options as boolean
`false`.

## Constraints

The change should apply to boolean options loaded from environment values and
should not alter parsing of non-boolean option values.

## Success criteria

An environment variable such as `DEBUG=false` produces `debug: false` for a
boolean option.
","# Task B: Implied option values override configuration sources

## Problem

An option may imply another option value, and users expect that implication to
take effect even when the implied option has a value from environment or config.

## Desired behavior

Allow implied option values to override values derived from environment or
configuration sources.

## Constraints

Explicit user-supplied CLI values should still have the highest precedence. The
change should only affect implied values competing with lower-priority sources.

## Success criteria

When `--trace` implies `debug: true`, invoking `--trace` sets `debug` to true
even if `debug` already has an environment-derived value.
",Treat common false-like environment values for boolean options as false.,Allow implied option values to override environment/config-derived values.,"diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..14f364a 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -1992,8 +1992,9 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
             this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);
           } else {
             // boolean
-            // keep very simple, only care that envVar defined and not the value
-            this.emit(`optionEnv:${option.name()}`);
+            const envValue = process.env[option.envVar];
+            const booleanValue = !/^(0|false|no)$/i.test(envValue);
+            this.setOptionValueWithSource(optionKey, booleanValue, 'env');
           }
         }
       }
","diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..e8794d7 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -2010,7 +2010,9 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
     const hasCustomOptionValue = (optionKey) => {
       return (
         this.getOptionValue(optionKey) !== undefined &&
-        !['default', 'implied'].includes(this.getOptionValueSource(optionKey))
+        !['default', 'env', 'config', 'implied'].includes(
+          this.getOptionValueSource(optionKey),
+        )
       );
     };
     this.options
","diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..e0cbae3 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -1992,8 +1992,9 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
             this.emit(`optionEnv:${option.name()}`, process.env[option.envVar]);
           } else {
             // boolean
-            // keep very simple, only care that envVar defined and not the value
-            this.emit(`optionEnv:${option.name()}`);
+            const envValue = process.env[option.envVar];
+            const booleanValue = !/^(0|false|no)$/i.test(envValue);
+            this.setOptionValueWithSource(optionKey, booleanValue, 'env');
           }
         }
       }
@@ -2010,7 +2011,9 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
     const hasCustomOptionValue = (optionKey) => {
       return (
         this.getOptionValue(optionKey) !== undefined &&
-        !['default', 'implied'].includes(this.getOptionValueSource(optionKey))
+        !['default', 'env', 'config', 'implied'].includes(
+          this.getOptionValueSource(optionKey),
+        )
       );
     };
     this.options
",oracle/test_patch_a.mjs,oracle/test_patch_b.mjs,oracle/test_composition.mjs,"import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

function withEnv(name, value, fn) {
  const previous = process.env[name];
  process.env[name] = value;
  try {
    fn();
  } finally {
    if (previous === undefined) {
      delete process.env[name];
    } else {
      process.env[name] = previous;
    }
  }
}

test('boolean env false is parsed as false', () => {
  withEnv('COMMANDER_DEBUG', 'false', () => {
    const program = new Command();
    program.exitOverride();
    program.addOption(new Option('--debug').env('COMMANDER_DEBUG'));

    program.parse(['node', 'test']);

    assert.equal(program.opts().debug, false);
    assert.equal(program.getOptionValueSource('debug'), 'env');
  });
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

function withEnv(name, value, fn) {
  const previous = process.env[name];
  process.env[name] = value;
  try {
    fn();
  } finally {
    if (previous === undefined) {
      delete process.env[name];
    } else {
      process.env[name] = previous;
    }
  }
}

test('implied value can override env-derived configuration', () => {
  withEnv('COMMANDER_LOG', 'env.log', () => {
    const program = new Command();
    program.exitOverride();
    program
      .addOption(new Option('--log <file>').env('COMMANDER_LOG'))
      .addOption(new Option('--trace').implies({ log: 'trace.log' }));

    program.parse(['node', 'test', '--trace']);

    assert.equal(program.opts().log, 'trace.log');
    assert.equal(program.getOptionValueSource('log'), 'implied');
  });
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

function withEnv(name, value, fn) {
  const previous = process.env[name];
  process.env[name] = value;
  try {
    fn();
  } finally {
    if (previous === undefined) {
      delete process.env[name];
    } else {
      process.env[name] = previous;
    }
  }
}

test('explicit false boolean env value is not overwritten by implication', () => {
  withEnv('COMMANDER_DEBUG', 'false', () => {
    const program = new Command();
    program.exitOverride();
    program
      .addOption(new Option('--debug').env('COMMANDER_DEBUG'))
      .addOption(new Option('--trace').implies({ debug: true }));

    program.parse(['node', 'test', '--trace']);

    assert.equal(program.opts().debug, false);
    assert.equal(program.getOptionValueSource('debug'), 'env');
  });
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A turns DEBUG=false into an explicit env-derived false value. Patch B lets implied option values override env/config-derived values. Together, --trace can override DEBUG=false via an implied debug=true value, violating the intended configuration precedence contract.",Second Commander.js seed instance. This expands configuration-precedence coverage with a JavaScript-only example.,instances/commander__002
commander__003,https://github.com/tj/commander.js,ba6d13ddb4243e5913367734f8c159089ffe7834,JavaScript,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Flag spelling aliases for option conflicts

## Problem

Commander option conflict declarations are easier to write with CLI flag
spellings such as `--cache-dir`, but internally options are tracked by
attribute names such as `cacheDir`.

## Desired behavior

Allow `Option.conflicts()` to accept long flag spellings and normalize them to
Commander option attribute names.

## Constraints

Existing attribute-name inputs must continue to work. The change should only
affect conflict declaration normalization.

## Success criteria

Declaring a conflict with `--cache-dir` behaves the same as declaring it with
`cacheDir`.
","# Task B: Flag spelling aliases for implied option values

## Problem

Commander implication declarations are easier to read when they use CLI flag
spellings, but implied values are applied using internal option attribute names.

## Desired behavior

Allow `Option.implies()` to accept long flag spellings and normalize them when
setting implied option values.

## Constraints

Existing attribute-name inputs must continue to work. The change should not
alter how users provide options on the command line.

## Success criteria

An implication declared for `--cache-dir` sets the same option value as an
implication declared for `cacheDir`.
","Allow Option.conflicts() to accept long option flag spellings, such as --cache-dir, as aliases for Commander option attribute names, such as cacheDir.","Allow Option.implies() to accept long option flag spellings, such as --cache-dir, and normalize them to Commander option attribute names when setting implied option values.","diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..caa8325 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -80,7 +80,16 @@ export class Option {
    */
 
   conflicts(names) {
-    this.conflictsWith = this.conflictsWith.concat(names);
+    const normaliseName = (name) => {
+      if (name.startsWith('--no-')) {
+        return camelcase(name.slice(5));
+      }
+      if (name.startsWith('--')) {
+        return camelcase(name.slice(2));
+      }
+      return name;
+    };
+    this.conflictsWith = this.conflictsWith.concat(names).map(normaliseName);
     return this;
   }
 
","diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..6d7754d 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -103,6 +103,12 @@ export class Option {
       // string is not documented, but easy mistake and we can do what user probably intended.
       newImplied = { [impliedOptionValues]: true };
     }
+    newImplied = Object.fromEntries(
+      Object.entries(newImplied).map(([key, value]) => [
+        key.startsWith('--') ? camelcase(key.replace(/^--(?:no-)?/, '')) : key,
+        value,
+      ]),
+    );
     this.implied = Object.assign(this.implied || {}, newImplied);
     return this;
   }
","diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..9fbe5f2 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -80,7 +80,16 @@ export class Option {
    */
 
   conflicts(names) {
-    this.conflictsWith = this.conflictsWith.concat(names);
+    const normaliseName = (name) => {
+      if (name.startsWith('--no-')) {
+        return camelcase(name.slice(5));
+      }
+      if (name.startsWith('--')) {
+        return camelcase(name.slice(2));
+      }
+      return name;
+    };
+    this.conflictsWith = this.conflictsWith.concat(names).map(normaliseName);
     return this;
   }
 
@@ -103,6 +112,12 @@ export class Option {
       // string is not documented, but easy mistake and we can do what user probably intended.
       newImplied = { [impliedOptionValues]: true };
     }
+    newImplied = Object.fromEntries(
+      Object.entries(newImplied).map(([key, value]) => [
+        key.startsWith('--') ? camelcase(key.replace(/^--(?:no-)?/, '')) : key,
+        value,
+      ]),
+    );
     this.implied = Object.assign(this.implied || {}, newImplied);
     return this;
   }
",oracle/test_patch_a.mjs,oracle/test_patch_b.mjs,oracle/test_composition.mjs,"import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('conflicts accepts long option flag spelling', () => {
  const program = new Command();
  program.exitOverride();
  program
    .addOption(new Option('--cache-dir <path>'))
    .addOption(new Option('--offline').conflicts('--cache-dir'));

  assert.throws(
    () => program.parse(['node', 'test', '--offline', '--cache-dir', './cache']),
    { code: 'commander.conflictingOption' },
  );
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('implies accepts long option flag spelling', () => {
  const program = new Command();
  program.exitOverride();
  program
    .addOption(new Option('--cache-dir <path>'))
    .addOption(new Option('--offline').implies({ '--cache-dir': './cache' }));

  program.parse(['node', 'test', '--offline']);

  assert.equal(program.opts().cacheDir, './cache');
  assert.equal(program.getOptionValueSource('cacheDir'), 'implied');
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('self-implied option value does not trigger a user-facing conflict', () => {
  const program = new Command();
  program.exitOverride();
  program
    .addOption(new Option('--cache-dir <path>'))
    .addOption(
      new Option('--offline')
        .conflicts('--cache-dir')
        .implies({ '--cache-dir': './cache' }),
    );

  program.parse(['node', 'test', '--offline']);

  assert.equal(program.opts().cacheDir, './cache');
  assert.equal(program.getOptionValueSource('cacheDir'), 'implied');
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A normalizes flag spellings in conflicts(). Patch B normalizes flag spellings in implies(). Together, an option that both conflicts with and implies the same flag spelling converts the implied value into the canonical option key, so Commander reports a user-facing conflict even though the user only supplied the implying option.",Third JavaScript seed instance. It captures an API-contract interaction between two helper APIs that each accept user-facing long flag spellings.,instances/commander__003
commander__004,https://github.com/tj/commander.js,ba6d13ddb4243e5913367734f8c159089ffe7834,JavaScript,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Clear defaults when making prepared arguments optional

## Problem

A prepared `Argument` can be converted from required to optional after it has
already been given a default value, leaving stale fallback state attached to the
argument.

## Desired behavior

Update `Argument.argOptional()` so converting an argument to optional clears any
existing default value.

## Constraints

The method should still mark the argument optional and return the argument for
chaining. Other argument metadata should remain unchanged.

## Success criteria

Calling `new Argument(""<file>"").default(""fallback"").argOptional()` produces an
optional argument whose default value is unset.
","# Task B: Accept prepared required arguments with defaults

## Problem

`Command.addArgument()` rejects a prepared required `Argument` that has a
default value, even though applications may want to interpret that default as a
fallback for omitted input.

## Desired behavior

Allow `Command.addArgument()` to treat such prepared arguments as optional
fallback arguments instead of throwing during registration.

## Constraints

The configured default should still be used when the argument is omitted.
Argument registration should continue to reject unrelated invalid argument
shapes.

## Success criteria

Adding `new Argument(""<file>"").default(""fallback"")` succeeds, and parsing with
no positional value passes `""fallback""` to the action.
",Allow Argument.argOptional() to clear stale default values when converting required arguments into optional arguments.,Allow Command.addArgument() to treat prepared required arguments with defaults as optional fallback arguments.,"diff --git a/lib/argument.js b/lib/argument.js
index 6da521d..a168149 100644
--- a/lib/argument.js
+++ b/lib/argument.js
@@ -126,10 +126,11 @@ export class Argument {
    *
    * @returns {Argument}
    */
   argOptional() {
     this.required = false;
+    this.defaultValue = undefined;
     return this;
   }
 }
 
 /**
","diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..36d458e 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -383,13 +383,11 @@ export class Command extends EventEmitter {
     if (
       argument.required &&
       argument.defaultValue !== undefined &&
       argument.parseArg === undefined
     ) {
-      throw new Error(
-        `a default value for a required argument is never used: '${argument.name()}'`,
-      );
+      argument.argOptional();
     }
     this.registeredArguments.push(argument);
     return this;
   }
 
","diff --git a/lib/argument.js b/lib/argument.js
index 6da521d..a168149 100644
--- a/lib/argument.js
+++ b/lib/argument.js
@@ -126,10 +126,11 @@ export class Argument {
    *
    * @returns {Argument}
    */
   argOptional() {
     this.required = false;
+    this.defaultValue = undefined;
     return this;
   }
 }
 
 /**
diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..36d458e 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -383,13 +383,11 @@ export class Command extends EventEmitter {
     if (
       argument.required &&
       argument.defaultValue !== undefined &&
       argument.parseArg === undefined
     ) {
-      throw new Error(
-        `a default value for a required argument is never used: '${argument.name()}'`,
-      );
+      argument.argOptional();
     }
     this.registeredArguments.push(argument);
     return this;
   }
 
",oracle/test_patch_a.mjs,oracle/test_patch_b.mjs,oracle/test_composition.mjs,"import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Argument } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('argOptional clears default values when changing required arguments', () => {
  const arg = new Argument('<file>').default('fallback').argOptional();

  assert.equal(arg.required, false);
  assert.equal(arg.defaultValue, undefined);
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Argument, Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('required argument default is treated as optional fallback', () => {
  const program = new Command();
  let seen;

  program.addArgument(new Argument('<file>').default('fallback')).action((file) => {
    seen = file;
  });
  program.parse(['node', 'test']);

  assert.equal(seen, 'fallback');
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Argument, Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('required argument defaults survive the optionalization path', () => {
  const program = new Command();
  let seen;

  program.addArgument(new Argument('<file>').default('fallback')).action((file) => {
    seen = file;
  });
  program.parse(['node', 'test']);

  assert.equal(seen, 'fallback');
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes argOptional() so it clears default values. Patch B starts using argOptional() to reinterpret required arguments with defaults as optional fallback arguments. Together, the fallback value is silently discarded, so a missing argument resolves to undefined instead of the configured default.",Commander.js API-contract interaction around default-bearing positional arguments and helper reuse.,instances/commander__004
commander__005,https://github.com/tj/commander.js,ba6d13ddb4243e5913367734f8c159089ffe7834,JavaScript,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Classify negated options as boolean options

## Problem

Negated options such as `--no-cache` behave like boolean flags but may not be
reported as boolean options by generic option-inspection code.

## Desired behavior

Update boolean option classification so negated options are treated as boolean
options.

## Constraints

Required and optional value-taking options should not be classified as plain
boolean options. Runtime behavior of `--no-*` flags should remain unchanged.

## Success criteria

`new Option(""--no-cache"").isBoolean()` returns true, and parsing `--no-cache`
still sets `cache` to false.
","# Task B: Simplify missing option value resolution

## Problem

Commander has multiple branches for filling in missing option values, including
boolean, optional, and negated options.

## Desired behavior

Resolve boolean and optional options before falling through to the dedicated
negated-option value branch.

## Constraints

The public behavior of negated options must remain unchanged. Passing `--no-*`
without an explicit value should still produce false.

## Success criteria

A program with `--no-cache` still reports `cache: false` after parsing
`--no-cache`.
",Classify negated options as boolean options so generic option-inspection code treats boolean flags uniformly.,Resolve boolean and optional option values before falling through to the dedicated negated-option value branch.,"diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..d80d923 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -252,11 +252,11 @@ export class Option {
    * @return {boolean}
    * @package
    */
 
   isBoolean() {
-    return !this.required && !this.optional && !this.negate;
+    return !this.required && !this.optional;
   }
 }
 
 /**
  * This class is to make it easier to work with dual options, without changing the existing
","diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..6d5ff84 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -695,14 +695,14 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
         val = option._collectValue(val, oldValue);
       }
 
       // Fill-in appropriate missing values. Long winded but easy to follow.
       if (val == null) {
-        if (option.negate) {
-          val = false;
-        } else if (option.isBoolean() || option.optional) {
+        if (option.isBoolean() || option.optional) {
           val = true;
+        } else if (option.negate) {
+          val = false;
         } else {
           val = ''; // not normal, parseArg might have failed or be a mock function for testing
         }
       }
       this.setOptionValueWithSource(name, val, valueSource);
","diff --git a/lib/command.js b/lib/command.js
index 9a3d03e..6d5ff84 100644
--- a/lib/command.js
+++ b/lib/command.js
@@ -695,14 +695,14 @@ Expecting one of '${allowedValues.join(""', '"")}'`);
         val = option._collectValue(val, oldValue);
       }
 
       // Fill-in appropriate missing values. Long winded but easy to follow.
       if (val == null) {
-        if (option.negate) {
-          val = false;
-        } else if (option.isBoolean() || option.optional) {
+        if (option.isBoolean() || option.optional) {
           val = true;
+        } else if (option.negate) {
+          val = false;
         } else {
           val = ''; // not normal, parseArg might have failed or be a mock function for testing
         }
       }
       this.setOptionValueWithSource(name, val, valueSource);
     };
diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..d80d923 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -252,11 +252,11 @@ export class Option {
    * @return {boolean}
    * @package
    */
 
   isBoolean() {
-    return !this.required && !this.optional && !this.negate;
+    return !this.required && !this.optional;
   }
 }
 
 /**
  * This class is to make it easier to work with dual options, without changing the existing
",oracle/test_patch_a.mjs,oracle/test_patch_b.mjs,oracle/test_composition.mjs,"import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('negated options are classified as boolean options', () => {
  assert.equal(new Option('--no-cache').isBoolean(), true);

  const program = new Command();
  program.option('--no-cache');
  program.parse(['node', 'test', '--no-cache']);

  assert.equal(program.opts().cache, false);
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('negated options still resolve to false without an explicit value', () => {
  const program = new Command();
  program.option('--no-cache');
  program.parse(['node', 'test', '--no-cache']);

  assert.equal(program.opts().cache, false);
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Command } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('negated options still resolve to false after boolean classification changes', () => {
  const program = new Command();
  program.option('--no-cache');
  program.parse(['node', 'test', '--no-cache']);

  assert.equal(program.opts().cache, false);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A broadens Option.isBoolean() to include negated options. Patch B checks isBoolean() before the negate-specific branch. Together, --no-cache is interpreted as a regular boolean flag and becomes true instead of false.",Commander.js behavioral interaction between option classification and value-resolution branch ordering.,instances/commander__005
commander_control__001,https://github.com/tj/commander.js,ba6d13ddb4243e5913367734f8c159089ffe7834,JavaScript,control,pass,easy,researcher_constructed,reproduced,"# Patch A task

Add an introspection helper for positional arguments.

Users who build higher-level tooling around Commander need to know whether an
`Argument` instance is required without parsing the decorated usage string. Add
an `isRequired()` method to `Argument` that returns the argument's existing
required/optional state.

Constraints:

- Do not change parsing behavior.
- Do not change argument construction or help output.
- Preserve the existing `argOptional()` behavior.
","# Patch B task

Add an introspection helper for negated options.

Users who inspect command schemas need to distinguish `--no-*` options from
ordinary boolean options without reaching into private fields. Add an
`isNegated()` method to `Option` that returns whether the option was declared as
a negated option.

Constraints:

- Do not change option parsing behavior.
- Do not change how boolean options are classified.
- Preserve existing negated option semantics.
",Add Argument.isRequired() so tooling can inspect whether a positional argument is required.,Add Option.isNegated() so tooling can inspect whether an option was declared as --no-*.,"diff --git a/lib/argument.js b/lib/argument.js
index 6da521d..ded0d68 100644
--- a/lib/argument.js
+++ b/lib/argument.js
@@ -128,10 +128,19 @@ export class Argument {
    */
   argOptional() {
     this.required = false;
     return this;
   }
+
+  /**
+   * Return whether argument is required.
+   *
+   * @returns {boolean}
+   */
+  isRequired() {
+    return this.required;
+  }
 }
 
 /**
  * Takes an argument and returns its human readable equivalent for help usage.
  *
","diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..d7ed57f 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -254,10 +254,21 @@ export class Option {
    */
 
   isBoolean() {
     return !this.required && !this.optional && !this.negate;
   }
+
+  /**
+   * Return whether option is a negated option.
+   *
+   * @returns {boolean}
+   * @package
+   */
+
+  isNegated() {
+    return this.negate;
+  }
 }
 
 /**
  * This class is to make it easier to work with dual options, without changing the existing
  * implementation. We support separate dual options for separate positive and negative options,
","diff --git a/lib/argument.js b/lib/argument.js
index 6da521d..ded0d68 100644
--- a/lib/argument.js
+++ b/lib/argument.js
@@ -128,10 +128,19 @@ export class Argument {
    */
   argOptional() {
     this.required = false;
     return this;
   }
+
+  /**
+   * Return whether argument is required.
+   *
+   * @returns {boolean}
+   */
+  isRequired() {
+    return this.required;
+  }
 }
 
 /**
  * Takes an argument and returns its human readable equivalent for help usage.
  *
diff --git a/lib/option.js b/lib/option.js
index 4b4daaf..d7ed57f 100644
--- a/lib/option.js
+++ b/lib/option.js
@@ -254,10 +254,21 @@ export class Option {
    */
 
   isBoolean() {
     return !this.required && !this.optional && !this.negate;
   }
+
+  /**
+   * Return whether option is a negated option.
+   *
+   * @returns {boolean}
+   * @package
+   */
+
+  isNegated() {
+    return this.negate;
+  }
 }
 
 /**
  * This class is to make it easier to work with dual options, without changing the existing
  * implementation. We support separate dual options for separate positive and negative options,
",oracle/test_patch_a.mjs,oracle/test_patch_b.mjs,oracle/test_composition.mjs,"import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Argument } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('Argument.isRequired exposes required argument state', () => {
  assert.equal(new Argument('<file>').isRequired(), true);
  assert.equal(new Argument('[file]').isRequired(), false);
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('Option.isNegated exposes negated option state', () => {
  assert.equal(new Option('--no-cache').isNegated(), true);
  assert.equal(new Option('--cache').isNegated(), false);
});
","import assert from 'node:assert/strict';
import { test } from 'node:test';
import { pathToFileURL } from 'node:url';

const { Argument, Option } = await import(pathToFileURL(`${process.cwd()}/index.js`));

test('argument and option introspection helpers compose cleanly', () => {
  assert.equal(new Argument('<file>').isRequired(), true);
  assert.equal(new Argument('[file]').isRequired(), false);
  assert.equal(new Option('--no-cache').isNegated(), true);
  assert.equal(new Option('--cache').isNegated(), false);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A and Patch B add independent introspection helpers on separate Commander classes, and the composition oracle confirms both APIs work together.",Initial matched control instance for clean composition in Commander.js.,instances/commander_control__001
httpx__001,https://github.com/encode/httpx,b5addb64f0161ff6bfe94c124ef76f6a1fba5254,Python,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Case-insensitive QueryParams membership

## Problem

Some query parameter checks use membership tests, and callers may expect
parameter names to match regardless of casing.

## Desired behavior

Allow `QueryParams.__contains__` membership checks to treat parameter names
case-insensitively.

## Constraints

The change should only affect membership checks. Existing item access and
serialization behavior should remain unchanged unless explicitly updated.

## Success criteria

For query params containing `token=abc`, the expression `""TOKEN"" in params`
returns true.
","# Task B: Delegate QueryParams.get through mapping access

## Problem

`QueryParams.get`, membership checks, and item access can drift if each path
implements lookup logic separately.

## Desired behavior

Refactor `QueryParams.get` to delegate through the mapping protocol so `get`,
`in`, and item access share behavior.

## Constraints

`get` should still return the provided default when the key is absent. Existing
exact-key lookups should remain compatible.

## Success criteria

`params.get(""name"", default)` returns the same value as item access for present
keys and returns `default` for missing keys.
",Allow QueryParams membership checks to treat query parameter names case-insensitively.,"Refactor QueryParams.get to delegate through the mapping protocol so get, contains, and item access share behavior.","diff --git a/httpx/_urls.py b/httpx/_urls.py
index 8f261c7..7c91581 100644
--- a/httpx/_urls.py
+++ b/httpx/_urls.py
@@ -601,7 +601,13 @@ class QueryParams(typing.Mapping[str, str]):
         return self._dict[key][0]
 
     def __contains__(self, key: typing.Any) -> bool:
-        return key in self._dict
+        if key in self._dict:
+            return True
+
+        if isinstance(key, str):
+            return any(existing.lower() == key.lower() for existing in self._dict)
+
+        return False
 
     def __iter__(self) -> typing.Iterator[typing.Any]:
         return iter(self.keys())
","diff --git a/httpx/_urls.py b/httpx/_urls.py
index 8f261c7..81411cc 100644
--- a/httpx/_urls.py
+++ b/httpx/_urls.py
@@ -521,8 +521,8 @@ class QueryParams(typing.Mapping[str, str]):
         q = httpx.QueryParams(""a=123&a=456&b=789"")
         assert q.get(""a"") == ""123""
         """"""
-        if key in self._dict:
-            return self._dict[str(key)][0]
+        if key in self:
+            return self[key]
         return default
 
     def get_list(self, key: str) -> list[str]:
","diff --git a/httpx/_urls.py b/httpx/_urls.py
index 301d087..af9e6b0 100644
--- a/httpx/_urls.py
+++ b/httpx/_urls.py
@@ -519,8 +519,8 @@ class QueryParams(typing.Mapping[str, str]):
         q = httpx.QueryParams(""a=123&a=456&b=789"")
         assert q.get(""a"") == ""123""
         """"""
-        if key in self._dict:
-            return self._dict[str(key)][0]
+        if key in self:
+            return self[key]
         return default
 
     def get_list(self, key: str) -> list[str]:
@@ -601,7 +601,13 @@ class QueryParams(typing.Mapping[str, str]):
         return self._dict[key][0]
 
     def __contains__(self, key: typing.Any) -> bool:
-        return key in self._dict
+        if key in self._dict:
+            return True
+
+        if isinstance(key, str):
+            return any(existing.lower() == key.lower() for existing in self._dict)
+
+        return False
 
     def __iter__(self) -> typing.Iterator[typing.Any]:
         return iter(self.keys())
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import httpx


def test_queryparams_contains_is_case_insensitive():
    params = httpx.QueryParams({""Token"": ""abc""})

    assert ""token"" in params
    assert ""TOKEN"" in params
","import httpx


def test_queryparams_get_still_returns_exact_key_value():
    params = httpx.QueryParams({""token"": ""abc""})

    assert params.get(""token"") == ""abc""
    assert params.get(""missing"", ""fallback"") == ""fallback""
","import httpx


def test_case_insensitive_contains_does_not_break_get_default():
    params = httpx.QueryParams({""Token"": ""abc""})

    assert params.get(""token"", ""missing"") == ""missing""
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A makes QueryParams.__contains__ case-insensitive without changing __getitem__. Patch B changes QueryParams.get to depend on __contains__ and __getitem__ agreeing. Together, a case-insensitive membership hit can be followed by exact-key item access, raising KeyError instead of returning the provided default.",First HTTPX seed instance. This broadens the benchmark beyond CLI parsing into mapping/API-contract behavior.,instances/httpx__001
httpx__002,https://github.com/encode/httpx,b5addb64f0161ff6bfe94c124ef76f6a1fba5254,Python,security_policy,fail,medium,researcher_constructed,reproduced,"# Task A: Preserve credentials for loopback HTTP-to-HTTPS redirects

## Problem

Local development services often redirect from HTTP to HTTPS on loopback hosts,
and dropping credentials can break authenticated local workflows.

## Desired behavior

Preserve `Authorization` headers for redirects that stay on a loopback host
while upgrading from HTTP to HTTPS.

## Constraints

Credential preservation should remain conservative and should not forward
credentials to unrelated external hosts.

## Success criteria

A redirect from `http://localhost` to `https://localhost` preserves the
`Authorization` header.
","# Task B: Treat localhost aliases as same-origin

## Problem

Loopback services may use `localhost` and `127.0.0.1` interchangeably, but
origin checks can treat them as unrelated hosts.

## Desired behavior

Treat `localhost` and `127.0.0.1` as same-origin aliases when scheme and port
match.

## Constraints

The alias should only apply to loopback names and addresses. Scheme and port
must still be considered.

## Success criteria

`http://localhost:8000` and `http://127.0.0.1:8000` are considered same-origin,
while different schemes or ports are not.
",Preserve Authorization headers for loopback HTTP-to-HTTPS redirects.,Treat localhost and 127.0.0.1 as same-origin aliases when scheme and port match.,"diff --git a/httpx/_client.py b/httpx/_client.py
index 13cd933..f1e8d02 100644
--- a/httpx/_client.py
+++ b/httpx/_client.py
@@ -74,6 +74,21 @@ def _is_https_redirect(url: URL, location: URL) -> bool:
     )
 
 
+def _is_loopback_https_redirect(url: URL, location: URL) -> bool:
+    """"""
+    Return 'True' for HTTPS upgrades between loopback URLs.
+    """"""
+    loopback_hosts = {""localhost"", ""127.0.0.1""}
+    if url.host not in loopback_hosts or location.host not in loopback_hosts:
+        return False
+
+    return (
+        url.scheme == ""http""
+        and location.scheme == ""https""
+        and _same_origin(url.copy_with(scheme=""https""), location)
+    )
+
+
 def _port_or_default(url: URL) -> int | None:
     if url.port is not None:
         return url.port
@@ -550,7 +565,9 @@ class BaseClient:
         headers = Headers(request.headers)
 
         if not _same_origin(url, request.url):
-            if not _is_https_redirect(request.url, url):
+            if not _is_https_redirect(
+                request.url, url
+            ) and not _is_loopback_https_redirect(request.url, url):
                 # Strip Authorization headers when responses are redirected
                 # away from the origin. (Except for direct HTTP to HTTPS redirects.)
                 headers.pop(""Authorization"", None)
","diff --git a/httpx/_client.py b/httpx/_client.py
index 13cd933..8fb223c 100644
--- a/httpx/_client.py
+++ b/httpx/_client.py
@@ -86,11 +86,18 @@ def _same_origin(url: URL, other: URL) -> bool:
     """"""
     return (
         url.scheme == other.scheme
-        and url.host == other.host
+        and _same_host_or_loopback_alias(url, other)
         and _port_or_default(url) == _port_or_default(other)
     )
 
 
+def _same_host_or_loopback_alias(url: URL, other: URL) -> bool:
+    if url.host == other.host:
+        return True
+
+    return {url.host, other.host} == {""localhost"", ""127.0.0.1""}
+
+
 class UseClientDefault:
     """"""
     For some parameters such as `auth=...` and `timeout=...` we need to be able
","diff --git a/httpx/_client.py b/httpx/_client.py
index 13cd933..dc8cc58 100644
--- a/httpx/_client.py
+++ b/httpx/_client.py
@@ -74,6 +74,21 @@ def _is_https_redirect(url: URL, location: URL) -> bool:
     )
 
 
+def _is_loopback_https_redirect(url: URL, location: URL) -> bool:
+    """"""
+    Return 'True' for HTTPS upgrades between loopback URLs.
+    """"""
+    loopback_hosts = {""localhost"", ""127.0.0.1""}
+    if url.host not in loopback_hosts or location.host not in loopback_hosts:
+        return False
+
+    return (
+        url.scheme == ""http""
+        and location.scheme == ""https""
+        and _same_origin(url.copy_with(scheme=""https""), location)
+    )
+
+
 def _port_or_default(url: URL) -> int | None:
     if url.port is not None:
         return url.port
@@ -86,11 +101,18 @@ def _same_origin(url: URL, other: URL) -> bool:
     """"""
     return (
         url.scheme == other.scheme
-        and url.host == other.host
+        and _same_host_or_loopback_alias(url, other)
         and _port_or_default(url) == _port_or_default(other)
     )
 
 
+def _same_host_or_loopback_alias(url: URL, other: URL) -> bool:
+    if url.host == other.host:
+        return True
+
+    return {url.host, other.host} == {""localhost"", ""127.0.0.1""}
+
+
 class UseClientDefault:
     """"""
     For some parameters such as `auth=...` and `timeout=...` we need to be able
@@ -550,7 +572,9 @@ class BaseClient:
         headers = Headers(request.headers)
 
         if not _same_origin(url, request.url):
-            if not _is_https_redirect(request.url, url):
+            if not _is_https_redirect(
+                request.url, url
+            ) and not _is_loopback_https_redirect(request.url, url):
                 # Strip Authorization headers when responses are redirected
                 # away from the origin. (Except for direct HTTP to HTTPS redirects.)
                 headers.pop(""Authorization"", None)
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import httpx


def test_loopback_https_upgrade_preserves_authorization():
    client = httpx.Client()
    request = client.build_request(
        ""GET"",
        ""http://localhost:8000/start"",
        headers={""Authorization"": ""Bearer secret""},
    )

    headers = client._redirect_headers(
        request,
        httpx.URL(""https://localhost:8000/secure""),
        ""GET"",
    )

    assert headers[""Authorization""] == ""Bearer secret""
","import httpx


def test_loopback_alias_same_scheme_preserves_authorization():
    client = httpx.Client()
    request = client.build_request(
        ""GET"",
        ""http://localhost:8000/start"",
        headers={""Authorization"": ""Bearer secret""},
    )

    headers = client._redirect_headers(
        request,
        httpx.URL(""http://127.0.0.1:8000/next""),
        ""GET"",
    )

    assert headers[""Authorization""] == ""Bearer secret""
","import httpx


def test_loopback_alias_https_upgrade_strips_authorization():
    client = httpx.Client()
    request = client.build_request(
        ""GET"",
        ""http://localhost:8000/start"",
        headers={""Authorization"": ""Bearer secret""},
    )

    headers = client._redirect_headers(
        request,
        httpx.URL(""https://127.0.0.1:8000/secure""),
        ""GET"",
    )

    assert ""Authorization"" not in headers
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A preserves Authorization on loopback HTTP-to-HTTPS redirects. Patch B treats localhost and 127.0.0.1 as same-origin aliases for matching scheme and port. Together, the composed client preserves Authorization across both a scheme change and host-alias change, violating the redirect credential-forwarding policy encoded by the composition oracle.",First security-policy seed. It tests how two individually plausible redirect relaxations compose into an overly broad credential-forwarding rule.,instances/httpx__002
httpx__003,https://github.com/encode/httpx,b5addb64f0161ff6bfe94c124ef76f6a1fba5254,Python,state_invariant,fail,easy,researcher_constructed,reproduced,"# Task A: Preserve original header casing in keys

## Problem

HTTP header lookup is case-insensitive, but callers sometimes need to inspect
the original casing used when headers were provided.

## Desired behavior

Expose original header casing from `Headers.keys()`.

## Constraints

Case-insensitive lookup behavior should remain unchanged. The change should
affect the public key view, not header normalization for lookup.

## Success criteria

If headers are created with `X-Trace`, iterating `headers.keys()` includes
`X-Trace`.
","# Task B: Optimize Headers.update normalized-key removal

## Problem

Updating headers should remove any existing logical header before inserting the
new value, and this path can be optimized by comparing normalized keys directly.

## Desired behavior

Refactor `Headers.update` to remove existing entries through direct
normalized-key matching.

## Constraints

Updating with different casing should still replace the old logical header
rather than creating duplicates.

## Success criteria

Updating `{""X-Trace"": ""one""}` with `{""x-trace"": ""two""}` leaves one logical
header value, `two`.
",Preserve original header casing when exposing Headers.keys().,Optimize Headers.update by removing existing entries through direct normalized-key matching.,"diff --git a/httpx/_models.py b/httpx/_models.py
index 2cc8632..80bfb65 100644
--- a/httpx/_models.py
+++ b/httpx/_models.py
@@ -200,7 +200,7 @@ class Headers(typing.MutableMapping[str, str]):
         return [(raw_key, value) for raw_key, _, value in self._list]
 
     def keys(self) -> typing.KeysView[str]:
-        return {key.decode(self.encoding): None for _, key, value in self._list}.keys()
+        return {raw_key.decode(self.encoding): None for raw_key, _, value in self._list}.keys()
 
     def values(self) -> typing.ValuesView[str]:
         values_dict: dict[str, str] = {}
","diff --git a/httpx/_models.py b/httpx/_models.py
index 2cc8632..ec3837f 100644
--- a/httpx/_models.py
+++ b/httpx/_models.py
@@ -274,8 +274,10 @@ class Headers(typing.MutableMapping[str, str]):
     def update(self, headers: HeaderTypes | None = None) -> None:  # type: ignore
         headers = Headers(headers)
         for key in headers.keys():
-            if key in self:
-                self.pop(key)
+            lookup_key = key.encode(self.encoding)
+            self._list = [
+                item for item in self._list if item[1] != lookup_key
+            ]
         self._list.extend(headers._list)
 
     def copy(self) -> Headers:
","diff --git a/httpx/_models.py b/httpx/_models.py
index 2cc8632..efc615c 100644
--- a/httpx/_models.py
+++ b/httpx/_models.py
@@ -200,7 +200,7 @@ class Headers(typing.MutableMapping[str, str]):
         return [(raw_key, value) for raw_key, _, value in self._list]
 
     def keys(self) -> typing.KeysView[str]:
-        return {key.decode(self.encoding): None for _, key, value in self._list}.keys()
+        return {raw_key.decode(self.encoding): None for raw_key, _, value in self._list}.keys()
 
     def values(self) -> typing.ValuesView[str]:
         values_dict: dict[str, str] = {}
@@ -274,8 +274,10 @@ class Headers(typing.MutableMapping[str, str]):
     def update(self, headers: HeaderTypes | None = None) -> None:  # type: ignore
         headers = Headers(headers)
         for key in headers.keys():
-            if key in self:
-                self.pop(key)
+            lookup_key = key.encode(self.encoding)
+            self._list = [
+                item for item in self._list if item[1] != lookup_key
+            ]
         self._list.extend(headers._list)
 
     def copy(self) -> Headers:
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import httpx


def test_headers_keys_preserve_original_casing():
    headers = httpx.Headers([(""X-Token"", ""one"")])

    assert list(headers.keys()) == [""X-Token""]
","import httpx


def test_update_replaces_existing_logical_header():
    headers = httpx.Headers({""X-Token"": ""old""})

    headers.update({""x-token"": ""new""})

    assert headers.get_list(""x-token"") == [""new""]
","import httpx


def test_update_preserves_single_logical_header_after_case_change():
    headers = httpx.Headers({""x-token"": ""old""})

    headers.update({""X-Token"": ""new""})

    assert headers.get_list(""x-token"") == [""new""]
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A makes Headers.keys() expose original-case header names. Patch B optimizes Headers.update() by directly comparing incoming keys against normalized lookup keys. Together, an update with different casing fails to remove the old logical header and leaves duplicate values in the internal header list.",First state-invariant seed. It captures the invariant that Headers.update must leave one logical value per updated header regardless of presentation casing.,instances/httpx__003
httpx_control__001,https://github.com/encode/httpx,b5addb64f0161ff6bfe94c124ef76f6a1fba5254,Python,control,pass,easy,researcher_constructed,reproduced,"# Patch A task

Add a helper for detecting repeated header values.

Consumers that inspect HTTP response metadata sometimes need to know whether a
header was provided more than once without manually calling and counting
`get_list()`. Add `Headers.has_multiple(key)` that returns `True` when the
header has multiple stored values.

Constraints:

- Do not change header lookup or normalization behavior.
- Preserve existing `Headers.get()` and `Headers.get_list()` behavior.
- The helper should be case-insensitive like other header accessors.
","# Patch B task

Add a helper for query-parameter key presence.

Callers that inspect query strings need a direct way to ask whether a key is
present without retrieving a value. Add `QueryParams.has_key(key)` that returns
whether the normalized key exists in the query parameter mapping.

Constraints:

- Do not change query-parameter parsing.
- Do not change `QueryParams.get()` or `QueryParams.get_list()`.
- Preserve support for non-string keys by normalizing through `str(key)`.
",Add Headers.has_multiple() so callers can detect repeated header values without manually counting get_list().,Add QueryParams.has_key() so callers can directly test query-parameter key presence.,"diff --git a/httpx/_models.py b/httpx/_models.py
index 2cc8632..61f23a1 100644
--- a/httpx/_models.py
+++ b/httpx/_models.py
@@ -247,10 +247,16 @@ class Headers(typing.MutableMapping[str, str]):
         try:
             return self[key]
         except KeyError:
             return default
 
+    def has_multiple(self, key: str) -> bool:
+        """"""
+        Return `True` if a header has multiple stored values.
+        """"""
+        return len(self.get_list(key)) > 1
+
     def get_list(self, key: str, split_commas: bool = False) -> list[str]:
         """"""
         Return a list of all header values for a given key.
         If `split_commas=True` is passed, then any comma separated header
         values are split into multiple return strings.
","diff --git a/httpx/_urls.py b/httpx/_urls.py
index 301d087..c9be7a2 100644
--- a/httpx/_urls.py
+++ b/httpx/_urls.py
@@ -521,10 +521,16 @@ class QueryParams(typing.Mapping[str, str]):
         """"""
         if key in self._dict:
             return self._dict[str(key)][0]
         return default
 
+    def has_key(self, key: typing.Any) -> bool:
+        """"""
+        Return `True` if the query parameter key is present.
+        """"""
+        return str(key) in self._dict
+
     def get_list(self, key: str) -> list[str]:
         """"""
         Get all values from the query param for a given key.
 
         Usage:
","diff --git a/httpx/_models.py b/httpx/_models.py
index 2cc8632..61f23a1 100644
--- a/httpx/_models.py
+++ b/httpx/_models.py
@@ -247,10 +247,16 @@ class Headers(typing.MutableMapping[str, str]):
         try:
             return self[key]
         except KeyError:
             return default
 
+    def has_multiple(self, key: str) -> bool:
+        """"""
+        Return `True` if a header has multiple stored values.
+        """"""
+        return len(self.get_list(key)) > 1
+
     def get_list(self, key: str, split_commas: bool = False) -> list[str]:
         """"""
         Return a list of all header values for a given key.
         If `split_commas=True` is passed, then any comma separated header
         values are split into multiple return strings.
diff --git a/httpx/_urls.py b/httpx/_urls.py
index 301d087..c9be7a2 100644
--- a/httpx/_urls.py
+++ b/httpx/_urls.py
@@ -521,10 +521,16 @@ class QueryParams(typing.Mapping[str, str]):
         """"""
         if key in self._dict:
             return self._dict[str(key)][0]
         return default
 
+    def has_key(self, key: typing.Any) -> bool:
+        """"""
+        Return `True` if the query parameter key is present.
+        """"""
+        return str(key) in self._dict
+
     def get_list(self, key: str) -> list[str]:
         """"""
         Get all values from the query param for a given key.
 
         Usage:
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import httpx


def test_headers_has_multiple_detects_repeated_values():
    headers = httpx.Headers([(""X-Trace"", ""one""), (""x-trace"", ""two""), (""Other"", ""v"")])

    assert headers.has_multiple(""X-Trace"") is True
    assert headers.has_multiple(""x-trace"") is True
    assert headers.has_multiple(""Other"") is False
    assert headers.has_multiple(""Missing"") is False
","import httpx


def test_query_params_has_key_detects_presence():
    params = httpx.QueryParams(""a=1&a=2&empty="")

    assert params.has_key(""a"") is True
    assert params.has_key(""empty"") is True
    assert params.has_key(""missing"") is False
    assert params.has_key(123) is False
","import httpx


def test_header_and_query_helpers_compose_cleanly():
    headers = httpx.Headers([(""X-Trace"", ""one""), (""x-trace"", ""two""), (""Other"", ""v"")])
    params = httpx.QueryParams(""a=1&a=2&empty="")

    assert headers.has_multiple(""X-Trace"") is True
    assert headers.has_multiple(""Other"") is False
    assert params.has_key(""a"") is True
    assert params.has_key(""missing"") is False
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A and Patch B add independent helpers on Headers and QueryParams, and the composition oracle confirms both behaviors pass together.",Initial matched control instance for clean composition in HTTPX.,instances/httpx_control__001
markupsafe__001,https://github.com/pallets/markupsafe,b2e4d9c7687be25695fffbe93a37622302b24fb1,Python,test_assumption,fail,easy,researcher_constructed,reproduced,"# Task A: Treat None as empty in old-style Markup formatting

## Problem

Old-style Markup formatting may receive optional values that are represented as
`None`, and rendering the literal string `""None""` can be undesirable in HTML
templates.

## Desired behavior

Make old-style Markup formatting treat `None` as an empty optional value.

## Constraints

Other values should continue to be escaped normally. This change should be
limited to the old-style formatting helper path.

## Success criteria

Formatting a Markup template with `% None` produces an empty escaped value
rather than the text `None`.
","# Task B: Reuse old-style escaping for simple format fields

## Problem

Markup has multiple formatting paths, and simple new-style format fields should
reuse the same escaping behavior as the older helper where practical.

## Desired behavior

Refactor simple `Markup.format` field handling to use the old-style escape
helper.

## Constraints

The public behavior of simple format fields should remain compatible with
existing `Markup.format` expectations.

## Success criteria

Simple fields such as `Markup(""{}"").format(value)` still escape unsafe input
and preserve normal Python stringification behavior.
",Make old-style Markup formatting treat None as an empty optional value.,Reuse the old-style escape helper for simple Markup.format fields.,"diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..01cd222 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -367,7 +367,7 @@ class _MarkupEscapeHelper:
         return self.__class__(self.obj[key], self.escape)
 
     def __str__(self, /) -> str:
-        return str(self.escape(self.obj))
+        return str(escape_silent(self.obj))
 
     def __repr__(self, /) -> str:
         return str(self.escape(repr(self.obj)))
","diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..328c244 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -348,6 +348,9 @@ class EscapeFormatter(string.Formatter):
                 )
             rv = value.__html__()
         else:
+            if not format_spec:
+                return str(_MarkupEscapeHelper(value, self.escape))
+
             # We need to make sure the format spec is str here as
             # otherwise the wrong callback methods are invoked.
             rv = super().format_field(value, str(format_spec))
","diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..b79d5b3 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -348,6 +348,9 @@ class EscapeFormatter(string.Formatter):
                 )
             rv = value.__html__()
         else:
+            if not format_spec:
+                return str(_MarkupEscapeHelper(value, self.escape))
+
             # We need to make sure the format spec is str here as
             # otherwise the wrong callback methods are invoked.
             rv = super().format_field(value, str(format_spec))
@@ -367,7 +370,7 @@ class _MarkupEscapeHelper:
         return self.__class__(self.obj[key], self.escape)
 
     def __str__(self, /) -> str:
-        return str(self.escape(self.obj))
+        return str(escape_silent(self.obj))
 
     def __repr__(self, /) -> str:
         return str(self.escape(repr(self.obj)))
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup


def test_old_style_markup_formatting_treats_none_as_empty() -> None:
    assert Markup(""%s"") % None == Markup("""")
    assert Markup(""{}"").format(None) == Markup(""None"")
","import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup


def test_simple_format_fields_preserve_existing_escape_behavior() -> None:
    assert Markup(""<{}>"").format(""<x>"") == Markup(""<&lt;x&gt;>"")
    assert Markup(""{}"").format(None) == Markup(""None"")
    assert Markup(""{:.2f}"").format(1.234) == Markup(""1.23"")
","import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup


def test_new_style_formatting_does_not_silently_drop_none() -> None:
    assert Markup(""{}"").format(None) == Markup(""None"")
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes the old-style formatting helper so None is silently escaped as an empty string. Patch B routes simple new-style format fields through that helper. Together, Markup.format(None) stops rendering the literal text None, violating an existing formatting assumption that new-style formatting preserves Python's None stringification.",First MarkupSafe seed instance and first test_assumption category instance. The interaction is between formatting-helper reuse and an implicit test expectation around None stringification.,instances/markupsafe__001
markupsafe__002,https://github.com/pallets/markupsafe,b2e4d9c7687be25695fffbe93a37622302b24fb1,Python,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Decode bytes in soft_str

## Problem

`soft_str` is used as a gentle conversion helper, but byte strings are displayed
as Python bytes representations instead of decoded text.

## Desired behavior

Teach `soft_str` to decode byte strings as UTF-8 text.

## Constraints

Existing string and Markup inputs should continue to pass through as before.
The decoding behavior should be limited to byte-like inputs.

## Success criteria

Calling `soft_str(b""caf\\xc3\\xa9"")` returns `""café""`.
","# Task B: Use soft_str for escape fallback conversion

## Problem

`escape` and `soft_str` can diverge when converting non-string values before
HTML escaping.

## Desired behavior

Refactor `escape` so its non-string fallback conversion goes through
`soft_str`.

## Constraints

HTML-aware objects and existing Markup values should keep their specialized
handling. The refactor should preserve escaping of unsafe characters.

## Success criteria

Escaping an ordinary non-string value converts it through the shared soft string
path and still escapes HTML-sensitive characters.
",Teach soft_str to decode byte strings as UTF-8 text.,Refactor escape to use soft_str for non-string fallback conversion.,"diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..761b61a 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -75,6 +75,9 @@ def soft_str(s: t.Any, /) -> str:
     >>> escape(soft_str(value))
     Markup('&lt;User 1&gt;')
     """"""
+    if isinstance(s, bytes):
+        return s.decode()
+
     if not isinstance(s, str):
         return str(s)
 
","diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..03ac53a 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -42,7 +42,7 @@ def escape(s: t.Any, /) -> Markup:
     if hasattr(s, ""__html__""):
         return Markup(s.__html__())
 
-    return Markup(_escape_inner(str(s)))
+    return Markup(_escape_inner(soft_str(s)))
 
 
 def escape_silent(s: t.Any | None, /) -> Markup:
","diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..f67c9ef 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -42,7 +42,7 @@ def escape(s: t.Any, /) -> Markup:
     if hasattr(s, ""__html__""):
         return Markup(s.__html__())
 
-    return Markup(_escape_inner(str(s)))
+    return Markup(_escape_inner(soft_str(s)))
 
 
 def escape_silent(s: t.Any | None, /) -> Markup:
@@ -75,6 +75,9 @@ def soft_str(s: t.Any, /) -> str:
     >>> escape(soft_str(value))
     Markup('&lt;User 1&gt;')
     """"""
+    if isinstance(s, bytes):
+        return s.decode()
+
     if not isinstance(s, str):
         return str(s)
 
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import escape, soft_str


def test_soft_str_decodes_bytes_without_changing_escape_bytes_contract() -> None:
    assert soft_str(b""<x>"") == ""<x>""
    assert escape(b""<x>"") == ""b&#39;&lt;x&gt;&#39;""
","import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup, escape


def test_escape_soft_str_refactor_preserves_fallback_behavior() -> None:
    assert escape(Markup(""<safe>"")) == Markup(""<safe>"")
    assert escape(b""<x>"") == Markup(""b&#39;&lt;x&gt;&#39;"")
","import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup, escape


def test_escape_bytes_keeps_python_bytes_representation() -> None:
    assert escape(b""<x>"") == Markup(""b&#39;&lt;x&gt;&#39;"")
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A makes soft_str decode bytes to text. Patch B makes escape use soft_str for fallback conversion. Together, escape(bytes) stops escaping Python's bytes representation and instead escapes decoded byte content, changing a public conversion contract.","Second MarkupSafe seed instance. It targets conversion and escaping semantics, distinct from markupsafe__001 formatting-helper assumptions.",instances/markupsafe__002
markupsafe__003,https://github.com/pallets/markupsafe,b2e4d9c7687be25695fffbe93a37622302b24fb1,Python,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Prefer __html_format__ during escaping

## Problem

HTML-aware objects may define both `__html__` and `__html_format__`, and
format-aware escaping should prefer the richer formatting protocol when
available.

## Desired behavior

When escaping an HTML-aware object, prefer `__html_format__("""")` over
`__html__`.

## Constraints

Objects that only define `__html__` should continue to work. The format string
passed for the default escape path should be empty.

## Success criteria

For an object implementing both methods, `escape(obj)` uses the result of
`obj.__html_format__("""")`.
","# Task B: Delegate Markup construction through escape

## Problem

Constructing `Markup` from HTML-aware objects duplicates conversion behavior
that already exists in `escape`.

## Desired behavior

Delegate `Markup` construction for HTML-aware objects through `escape`.

## Constraints

The constructor should preserve the established `Markup(obj)` protocol for
HTML-aware objects and should not double-escape safe HTML.

## Success criteria

Constructing `Markup` from an object with `__html__` still produces the object's
safe HTML representation.
","Prefer __html_format__("""") when escaping HTML-aware objects.",Delegate Markup construction for HTML-aware objects through escape.,"diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..64a2348 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -38,6 +38,10 @@ def escape(s: t.Any, /) -> Markup:
     if type(s) is str:
         return Markup(_escape_inner(s))
 
+    html_format = getattr(s, ""__html_format__"", None)
+    if callable(html_format):
+        return Markup(html_format(""""))
+
     if hasattr(s, ""__html__""):
         return Markup(s.__html__())
 
","diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..4883345 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -122,7 +122,7 @@ class Markup(str):
         cls, object: t.Any = """", encoding: str | None = None, errors: str = ""strict""
     ) -> te.Self:
         if hasattr(object, ""__html__""):
-            object = object.__html__()
+            object = escape(object)
 
         if encoding is None:
             return super().__new__(cls, object)
","diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index f8a0d58..af787e1 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -38,6 +38,10 @@ def escape(s: t.Any, /) -> Markup:
     if type(s) is str:
         return Markup(_escape_inner(s))
 
+    html_format = getattr(s, ""__html_format__"", None)
+    if callable(html_format):
+        return Markup(html_format(""""))
+
     if hasattr(s, ""__html__""):
         return Markup(s.__html__())
 
@@ -122,7 +126,7 @@ class Markup(str):
         cls, object: t.Any = """", encoding: str | None = None, errors: str = ""strict""
     ) -> te.Self:
         if hasattr(object, ""__html__""):
-            object = object.__html__()
+            object = escape(object)
 
         if encoding is None:
             return super().__new__(cls, object)
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup, escape


class HTMLAndFormat:
    def __html__(self) -> str:
        return ""<html>""

    def __html_format__(self, format_spec: str) -> str:
        assert format_spec == """"
        return ""<format>""


def test_escape_prefers_empty_html_format_without_changing_markup_constructor() -> None:
    value = HTMLAndFormat()

    assert escape(value) == Markup(""<format>"")
    assert Markup(value) == Markup(""<html>"")
","import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup


class HTMLAndFormat:
    def __html__(self) -> str:
        return ""<html>""

    def __html_format__(self, format_spec: str) -> str:
        return ""<format>""


def test_markup_constructor_escape_delegation_preserves_html_method() -> None:
    assert Markup(HTMLAndFormat()) == Markup(""<html>"")
","import sys
from pathlib import Path

sys.path.insert(0, str(Path.cwd() / ""src""))

from markupsafe import Markup


class HTMLAndFormat:
    def __html__(self) -> str:
        return ""<html>""

    def __html_format__(self, format_spec: str) -> str:
        return ""<format>""


def test_markup_constructor_still_uses_html_method_for_html_aware_objects() -> None:
    assert Markup(HTMLAndFormat()) == Markup(""<html>"")
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A makes escape prefer __html_format__("""") over __html__ when both are present. Patch B makes Markup construction delegate HTML-aware objects through escape. Together, Markup(obj) changes from using obj.__html__() to using obj.__html_format__(""""), violating the constructor's established HTML protocol contract.","Third MarkupSafe seed instance. It targets protocol precedence between __html__, __html_format__, escape, and Markup construction.",instances/markupsafe__003
rich__001,https://github.com/Textualize/rich,9d8f9a372cc5916fd4781fec207ced7ddac2f08f,Python,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Extend trailing inline style spans during right padding

## Problem

When right-padding a Rich `Text` object, added spaces can appear unstyled even
when they conceptually extend styled inline content.

## Desired behavior

Extend trailing inline style spans when right-padding `Text`.

## Constraints

Only trailing inline spans should be extended over added padding. Existing text
content and non-trailing spans should remain unchanged.

## Success criteria

Right-padding styled text extends the final inline style over the inserted
spaces.
","# Task B: Reuse right-padding helper in truncate padding

## Problem

`Text.truncate(..., pad=True)` has padding logic that overlaps with the
existing right-padding helper.

## Desired behavior

Refactor truncate padding to delegate to the existing right-padding helper.

## Constraints

The visible output of truncation with padding should remain unchanged,
including the style behavior of padding spaces.

## Success criteria

Truncating text with `pad=True` returns the requested width and keeps padding
spaces unstyled unless existing truncate behavior says otherwise.
",Extend trailing inline style spans when right-padding Rich Text objects.,Delegate truncate padding to the existing right-padding helper.,"diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..163e52d0 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -939,7 +939,17 @@ class Text(JupyterMixin):
         """"""
         assert len(character) == 1, ""Character must be a string of length 1""
         if count:
+            original_length = len(self)
             self.plain = f""{self.plain}{character * count}""
+            _Span = Span
+            self._spans[:] = [
+                (
+                    _Span(start, end + count, style)
+                    if end == original_length
+                    else _Span(start, end, style)
+                )
+                for start, end, style in self._spans
+            ]
 
     def align(self, align: AlignMethod, width: int, character: str = "" "") -> None:
         """"""Align text to a given width.
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..36cdeca9 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -880,8 +880,7 @@ class Text(JupyterMixin):
                     self.plain = set_cell_size(self.plain, max_width)
             if pad and length < max_width:
                 spaces = max_width - length
-                self._text = [f""{self.plain}{' ' * spaces}""]
-                self._length = len(self.plain)
+                self.pad_right(spaces)
 
     def _trim_spans(self) -> None:
         """"""Remove or modify any spans that are over the end of the text.""""""
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..112258c6 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -880,8 +880,7 @@ class Text(JupyterMixin):
                     self.plain = set_cell_size(self.plain, max_width)
             if pad and length < max_width:
                 spaces = max_width - length
-                self._text = [f""{self.plain}{' ' * spaces}""]
-                self._length = len(self.plain)
+                self.pad_right(spaces)
 
     def _trim_spans(self) -> None:
         """"""Remove or modify any spans that are over the end of the text.""""""
@@ -939,7 +938,17 @@ class Text(JupyterMixin):
         """"""
         assert len(character) == 1, ""Character must be a string of length 1""
         if count:
+            original_length = len(self)
             self.plain = f""{self.plain}{character * count}""
+            _Span = Span
+            self._spans[:] = [
+                (
+                    _Span(start, end + count, style)
+                    if end == original_length
+                    else _Span(start, end, style)
+                )
+                for start, end, style in self._spans
+            ]
 
     def align(self, align: AlignMethod, width: int, character: str = "" "") -> None:
         """"""Align text to a given width.
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"from rich.text import Span, Text


def test_pad_right_extends_trailing_inline_style_over_padding() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    text.pad_right(2)

    assert text.plain == ""x  ""
    assert text.spans == [Span(0, 3, ""red"")]
","from rich.text import Span, Text


def test_truncate_pad_preserves_existing_padding_contract() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    text.truncate(3, pad=True)

    assert text.plain == ""x  ""
    assert len(text) == 3
    assert text.spans == [Span(0, 1, ""red"")]
","from rich.text import Span, Text


def test_truncate_padding_does_not_inherit_content_style() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    text.truncate(3, pad=True)

    assert text.plain == ""x  ""
    assert text.spans == [Span(0, 1, ""red"")]
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A makes pad_right extend a trailing inline style span over added padding. Patch B routes truncate(..., pad=True) through pad_right. Together, truncation padding inherits the content style, violating the existing truncation-padding contract that added padding remains unstyled.",First Rich seed instance and first text-rendering instance. It broadens the benchmark to terminal rendering behavior and captures a helper-delegation interaction.,instances/rich__001
rich__002,https://github.com/Textualize/rich,9d8f9a372cc5916fd4781fec207ced7ddac2f08f,Python,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Preserve appended Text end metadata in append_text

## Problem

Internal text appends may drop the appended `Text` object's end metadata, which
can matter for downstream rendering or line-ending behavior.

## Desired behavior

Make `append_text` preserve the appended `Text` object's end metadata.

## Constraints

The appended plain text and spans should continue to be copied as before.
Metadata preservation should be limited to the internal append helper.

## Success criteria

Appending a `Text` object through `append_text` carries over that object's end
metadata.
","# Task B: Delegate public Text.append(Text) to append_text

## Problem

Public `Text.append` and the internal `append_text` helper duplicate logic for
combining `Text` objects.

## Desired behavior

Refactor public `Text.append(Text)` to delegate to `append_text`.

## Constraints

The public `append` contract should remain unchanged, including preserving the
receiver's end metadata.

## Success criteria

Calling `text.append(other_text)` appends content and spans while keeping the
receiver's public metadata behavior stable.
",Make append_text preserve the appended Text object's end metadata.,Refactor public Text.append(Text) to delegate to append_text.,"diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..1d2ccbfd 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -1025,6 +1025,7 @@ class Text(JupyterMixin):
             for start, end, style in text._spans.copy()
         )
         self._length += len(text)
+        self.end = text.end
         return self
 
     def append_tokens(
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..eefa3fcf 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -987,22 +987,11 @@ class Text(JupyterMixin):
                     self._spans.append(Span(offset, offset + text_length, style))
                 self._length += text_length
             elif isinstance(text, Text):
-                _Span = Span
                 if style is not None:
                     raise ValueError(
                         ""style must not be set when appending Text instance""
                     )
-                text_length = self._length
-                if text.style:
-                    self._spans.append(
-                        _Span(text_length, text_length + len(text), text.style)
-                    )
-                self._text.append(text.plain)
-                self._spans.extend(
-                    _Span(start + text_length, end + text_length, style)
-                    for start, end, style in text._spans.copy()
-                )
-                self._length += len(text)
+                self.append_text(text)
         return self
 
     def append_text(self, text: ""Text"") -> ""Text"":
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..2f091241 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -987,22 +987,11 @@ class Text(JupyterMixin):
                     self._spans.append(Span(offset, offset + text_length, style))
                 self._length += text_length
             elif isinstance(text, Text):
-                _Span = Span
                 if style is not None:
                     raise ValueError(
                         ""style must not be set when appending Text instance""
                     )
-                text_length = self._length
-                if text.style:
-                    self._spans.append(
-                        _Span(text_length, text_length + len(text), text.style)
-                    )
-                self._text.append(text.plain)
-                self._spans.extend(
-                    _Span(start + text_length, end + text_length, style)
-                    for start, end, style in text._spans.copy()
-                )
-                self._length += len(text)
+                self.append_text(text)
         return self
 
     def append_text(self, text: ""Text"") -> ""Text"":
@@ -1025,6 +1014,7 @@ class Text(JupyterMixin):
             for start, end, style in text._spans.copy()
         )
         self._length += len(text)
+        self.end = text.end
         return self
 
     def append_tokens(
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"from rich.text import Text


def test_append_text_inherits_appended_end_metadata() -> None:
    left = Text(""left"", end=""\n"")
    right = Text(""right"", end="""")

    left.append_text(right)

    assert left.plain == ""leftright""
    assert left.end == """"
","from rich.text import Span, Text


def test_public_append_text_refactor_preserves_receiver_end() -> None:
    left = Text(""left"", end=""!"")
    right = Text(""right"", style=""bold"", end=""?"")

    left.append(right)

    assert left.plain == ""leftright""
    assert left.spans == [Span(4, 9, ""bold"")]
    assert left.end == ""!""
","from rich.text import Span, Text


def test_public_append_does_not_inherit_appended_end_metadata() -> None:
    left = Text(""left"", end=""!"")
    right = Text(""right"", style=""bold"", end=""?"")

    left.append(right)

    assert left.plain == ""leftright""
    assert left.spans == [Span(4, 9, ""bold"")]
    assert left.end == ""!""
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes append_text so it copies the appended Text object's end metadata. Patch B changes public append(Text) to delegate to append_text. Together, public append(Text) unexpectedly inherits the appended object's line-ending metadata, violating the public append contract that the receiver's end value is preserved.","Second Rich seed instance. It is intentionally distinct from rich__001: this instance targets public API metadata isolation during Text append, not padding style propagation.",instances/rich__002
rich__003,https://github.com/Textualize/rich,9d8f9a372cc5916fd4781fec207ced7ddac2f08f,Python,state_invariant,fail,easy,researcher_constructed,reproduced,"# Task A: Preserve spans in blank_copy with replacement text

## Problem

`blank_copy` can be useful for creating a new `Text` object with replacement
plain text, but dropping spans loses style structure callers may want to keep.

## Desired behavior

Allow `blank_copy` to preserve spans when replacement plain text is provided.

## Constraints

Span preservation should not duplicate spans. Existing blank-copy behavior
without replacement text should remain compatible.

## Success criteria

Calling `blank_copy` with replacement plain text can produce a copy that keeps
the original spans.
","# Task B: Refactor Text.copy through copy helpers

## Problem

`Text.copy` duplicates behavior that overlaps with `blank_copy` and style-copy
helpers.

## Desired behavior

Refactor `Text.copy` to use `blank_copy` and `copy_styles` helper paths.

## Constraints

The public copy result should remain semantically identical: same plain text,
same spans, and no duplicate style ranges.

## Success criteria

Copying a `Text` object produces exactly one copy of each original span.
",Allow blank_copy to preserve spans when replacement plain text is provided.,Refactor Text.copy through blank_copy and copy_styles helpers.,"diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..7958c425 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -438,6 +438,8 @@ class Text(JupyterMixin):
             end=self.end,
             tab_size=self.tab_size,
         )
+        if plain:
+            copy_self._spans[:] = self._spans
         return copy_self
 
     def copy(self) -> ""Text"":
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..18c5d4cf 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -442,16 +442,8 @@ class Text(JupyterMixin):
 
     def copy(self) -> ""Text"":
         """"""Return a copy of this instance.""""""
-        copy_self = Text(
-            self.plain,
-            style=self.style,
-            justify=self.justify,
-            overflow=self.overflow,
-            no_wrap=self.no_wrap,
-            end=self.end,
-            tab_size=self.tab_size,
-        )
-        copy_self._spans[:] = self._spans
+        copy_self = self.blank_copy(self.plain)
+        copy_self.copy_styles(self)
         return copy_self
 
     def stylize(
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..98e2a52f 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -438,20 +438,14 @@ class Text(JupyterMixin):
             end=self.end,
             tab_size=self.tab_size,
         )
+        if plain:
+            copy_self._spans[:] = self._spans
         return copy_self
 
     def copy(self) -> ""Text"":
         """"""Return a copy of this instance.""""""
-        copy_self = Text(
-            self.plain,
-            style=self.style,
-            justify=self.justify,
-            overflow=self.overflow,
-            no_wrap=self.no_wrap,
-            end=self.end,
-            tab_size=self.tab_size,
-        )
-        copy_self._spans[:] = self._spans
+        copy_self = self.blank_copy(self.plain)
+        copy_self.copy_styles(self)
         return copy_self
 
     def stylize(
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"from rich.text import Span, Text


def test_blank_copy_with_plain_preserves_spans() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    copy = text.blank_copy(text.plain)

    assert copy.plain == ""x""
    assert copy.spans == [Span(0, 1, ""red"")]
    assert text.copy().spans == [Span(0, 1, ""red"")]
","from rich.text import Span, Text


def test_copy_helper_refactor_preserves_spans_once() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    copy = text.copy()

    assert copy is not text
    assert copy.plain == ""x""
    assert copy.spans == [Span(0, 1, ""red"")]
","from rich.text import Span, Text


def test_copy_does_not_duplicate_spans() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    copy = text.copy()

    assert copy.spans == [Span(0, 1, ""red"")]
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A makes blank_copy preserve spans when plain text is supplied. Patch B refactors copy through blank_copy and then copy_styles. Together, copy duplicates every inline span, violating the invariant that copying preserves spans exactly once.","Third Rich seed instance. It targets object-copy invariants and helper reuse, distinct from padding style propagation and append metadata inheritance.",instances/rich__003
rich__004,https://github.com/Textualize/rich,9d8f9a372cc5916fd4781fec207ced7ddac2f08f,Python,behavioral,fail,easy,researcher_constructed,reproduced,"# Task A: Metadata-only divide result with no offsets

## Problem

Dividing text with no offsets can still require a segment that preserves text
metadata even when no inline span slicing is needed.

## Desired behavior

Make `divide([])` return a metadata-only segment when no offsets are provided.

## Constraints

The no-offset behavior should not introduce inline spans into the returned
segment. Existing divide behavior with offsets should remain unchanged.

## Success criteria

Calling `divide([])` returns a single segment that preserves relevant metadata
without inline spans.
","# Task B: Route split without separators through divide

## Problem

`Text.split` has a no-separator branch that overlaps with `divide` behavior for
producing text segments.

## Desired behavior

Refactor the no-separator branch of `split` to use `divide([])`.

## Constraints

Splitting on a separator that is not present should preserve the original text
and spans exactly as before.

## Success criteria

Splitting styled text on a missing separator returns one segment with the same
plain text and inline spans as the original.
",Make divide with no offsets return a metadata-only segment.,Refactor split's no-separator branch through divide([]).,"diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..0314f0e0 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -1120,7 +1120,7 @@ class Text(JupyterMixin):
         _offsets = list(offsets)
 
         if not _offsets:
-            return Lines([self.copy()])
+            return Lines([self.blank_copy(self.plain)])
 
         text = self.plain
         text_length = len(text)
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..810c7ed4 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -1073,7 +1073,7 @@ class Text(JupyterMixin):
         assert separator, ""separator must not be empty""
 
         text = self.plain
         if separator not in text:
-            return Lines([self.copy()])
+            return self.divide([])
 
         if include_separator:
             lines = self.divide(
","diff --git a/rich/text.py b/rich/text.py
index 7e087a4e..d37fbdd1 100644
--- a/rich/text.py
+++ b/rich/text.py
@@ -1073,7 +1073,7 @@ class Text(JupyterMixin):
         assert separator, ""separator must not be empty""
 
         text = self.plain
         if separator not in text:
-            return Lines([self.copy()])
+            return self.divide([])
 
         if include_separator:
             lines = self.divide(
@@ -1120,7 +1120,7 @@ class Text(JupyterMixin):
         _offsets = list(offsets)
 
         if not _offsets:
-            return Lines([self.copy()])
+            return Lines([self.blank_copy(self.plain)])
 
         text = self.plain
         text_length = len(text)
",oracle/test_patch_a.py,oracle/test_patch_b.py,oracle/test_composition.py,"from rich.text import Text


def test_divide_without_offsets_returns_metadata_only_segment() -> None:
    text = Text.from_markup(""[red]x[/red]"", justify=""center"")

    (segment,) = text.divide([])

    assert segment.plain == ""x""
    assert segment.justify == ""center""
    assert segment.spans == []
","from rich.text import Span, Text


def test_split_no_separator_refactor_preserves_copy_behavior() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    (segment,) = text.split("","")

    assert segment.plain == ""x""
    assert segment.spans == [Span(0, 1, ""red"")]
","from rich.text import Span, Text


def test_split_without_separator_preserves_spans() -> None:
    text = Text.from_markup(""[red]x[/red]"")

    (segment,) = text.split("","")

    assert segment.spans == [Span(0, 1, ""red"")]
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes divide([]) to return a metadata-only segment without inline spans. Patch B routes split's no-separator branch through divide([]). Together, split on a missing separator drops spans, violating the public split behavior expected for unsplit text.","Fourth Rich seed instance. It targets segmentation helper semantics and split behavior, distinct from previous Rich padding, append, and copy instances.",instances/rich__004
zod__001,https://github.com/colinhacks/zod,e516c3baf22615e20934116abebfed6c000222c2,TypeScript,api_contract,fail,easy,researcher_constructed,reproduced,"# Task A: Inherit metadata IDs across schema clones

## Problem

Zod schema variants produced through cloning can lose metadata IDs that callers
use to track schema identity.

## Desired behavior

Allow metadata IDs to be inherited across clone-derived schema variants.

## Constraints

Other metadata behavior should remain stable, and explicit metadata on the
derived schema should take precedence over inherited values.

## Success criteria

A schema with metadata `{ id: ""UserName"" }` retains that ID after creating a
clone-derived variant.
","# Task B: Optional wrappers inherit descriptive metadata

## Problem

Optional wrapper schemas can lose descriptive metadata from their inner schema,
making generated documentation less useful.

## Desired behavior

Make optional wrappers inherit descriptive metadata from the inner schema.

## Constraints

Registration IDs should not be inherited into wrapper schemas. The wrapper
should remain distinguishable from the inner schema for identity-sensitive
metadata.

## Success criteria

`z.string().describe(""Name"").optional()` exposes the description, while wrapper
metadata does not inherit the inner schema's registration ID.
",Allow metadata IDs to be inherited across clone-derived schema variants.,Make optional wrapper schemas inherit descriptive metadata from their inner schema without inheriting registration IDs.,"diff --git a/packages/zod/src/v4/core/registries.ts b/packages/zod/src/v4/core/registries.ts
index cdd19e79..6a456b8e 100644
--- a/packages/zod/src/v4/core/registries.ts
+++ b/packages/zod/src/v4/core/registries.ts
@@ -64,7 +64,6 @@ export class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema exten
     const p = schema._zod.parent as Schema;
     if (p) {
       const pm: any = { ...(this.get(p) ?? {}) };
-      delete pm.id; // do not inherit id
       const f = { ...pm, ...this._map.get(schema) } as any;
       return Object.keys(f).length ? f : undefined;
     }
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index e4ab7a7f..f46c3af5 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -2262,10 +2262,12 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
 );
 
 export function optional<T extends core.SomeType>(innerType: T): ZodOptional<T> {
-  return new ZodOptional({
+  const inst = new ZodOptional({
     type: ""optional"",
     innerType: innerType as any as core.$ZodType,
-  }) as any;
+  }) as any;
+  inst._zod.parent = innerType as any;
+  return inst;
 }
 
 // ZodExactOptional
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index e4ab7a7f..f46c3af5 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -2262,10 +2262,12 @@ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$c
 );
 
 export function optional<T extends core.SomeType>(innerType: T): ZodOptional<T> {
-  return new ZodOptional({
+  const inst = new ZodOptional({
     type: ""optional"",
     innerType: innerType as any as core.$ZodType,
   }) as any;
+  inst._zod.parent = innerType as any;
+  return inst;
 }
 
 // ZodExactOptional
diff --git a/packages/zod/src/v4/core/registries.ts b/packages/zod/src/v4/core/registries.ts
index cdd19e79..6a456b8e 100644
--- a/packages/zod/src/v4/core/registries.ts
+++ b/packages/zod/src/v4/core/registries.ts
@@ -64,7 +64,6 @@ export class $ZodRegistry<Meta extends MetadataType = MetadataType, Schema exten
     const p = schema._zod.parent as Schema;
     if (p) {
       const pm: any = { ...(this.get(p) ?? {}) };
-      delete pm.id; // do not inherit id
       const f = { ...pm, ...this._map.get(schema) } as any;
       return Object.keys(f).length ? f : undefined;
     }
",oracle/test_patch_a.ts,oracle/test_patch_b.ts,oracle/test_composition.ts,"import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const described = z.string().meta({ id: ""UserName"" }).describe(""User name"");

  assert.equal(described.meta()?.id, ""UserName"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.string().meta({ id: ""UserName"", description: ""User name"" }).optional();

  assert.equal(schema.meta()?.description, ""User name"");
  assert.equal(schema.meta()?.id, undefined);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.string().meta({ id: ""UserName"", description: ""User name"" }).optional();

  assert.equal(schema.meta()?.description, ""User name"");
  assert.equal(schema.meta()?.id, undefined);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes registry metadata inheritance so id fields are inherited. Patch B changes optional wrappers to inherit metadata from their inner schema. Together, optional wrappers inherit inner registration IDs, violating the metadata contract that IDs should not bubble into derived wrapper schemas.",First Zod seed instance and first TypeScript oracle. This broadens the benchmark into schema-library metadata behavior.,instances/zod__001
zod__002,https://github.com/colinhacks/zod,e516c3baf22615e20934116abebfed6c000222c2,TypeScript,state_invariant,fail,easy,researcher_constructed,reproduced,"# Task A: Clear object refinements on catchall variants

## Problem

Changing an object schema's catchall policy can produce a variant intended to
validate unknown keys independently from previous object-level refinements.

## Desired behavior

Clear object-level refinements when creating a catchall object-schema variant.

## Constraints

The new catchall schema should still validate known properties and unknown keys
according to the supplied catchall type.

## Success criteria

An object schema with a failing refinement can produce a `.catchall(z.unknown())`
variant that accepts an otherwise valid object with extra keys.
","# Task B: Delegate loose object mode through catchall

## Problem

Object `.loose()` duplicates cloning logic that is also represented by setting a
catchall schema of `z.unknown()`.

## Desired behavior

Refactor object `.loose()` to delegate to `.catchall(z.unknown())`.

## Constraints

The refactor should preserve existing object-level refinements and public loose
mode behavior.

## Success criteria

`z.object(...).refine(...).loose()` still runs the refinement while allowing
unknown keys.
",Clear object-level refinements when creating a catchall object-schema variant.,Refactor object .loose() to delegate to .catchall(z.unknown()) while preserving object refinements.,"diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..3075bf4e 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1650,7 +1650,7 @@ function _zodObjectMethods(): _LazyMethodsOf<ZodObject> {
       return _enum(Object.keys(this._zod.def.shape));
     },
     catchall(catchall) {
-      return this.clone({ ...this._zod.def, catchall: catchall as any });
+      return this.clone({ ...this._zod.def, checks: [], catchall: catchall as any });
     },
     passthrough() {
       return this.clone({ ...this._zod.def, catchall: unknown() });
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..a6db4a84 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1655,7 +1655,7 @@ function _zodObjectMethods(): _LazyMethodsOf<ZodObject> {
       return this.clone({ ...this._zod.def, catchall: unknown() });
     },
     loose() {
-      return this.clone({ ...this._zod.def, catchall: unknown() });
+      return this.catchall(unknown());
     },
     strict() {
       return this.clone({ ...this._zod.def, catchall: never() });
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..da4333b4 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1650,12 +1650,12 @@ function _zodObjectMethods(): _LazyMethodsOf<ZodObject> {
       return _enum(Object.keys(this._zod.def.shape));
     },
     catchall(catchall) {
-      return this.clone({ ...this._zod.def, catchall: catchall as any });
+      return this.clone({ ...this._zod.def, checks: [], catchall: catchall as any });
     },
     passthrough() {
       return this.clone({ ...this._zod.def, catchall: unknown() });
     },
     loose() {
-      return this.clone({ ...this._zod.def, catchall: unknown() });
+      return this.catchall(unknown());
     },
     strict() {
       return this.clone({ ...this._zod.def, catchall: never() });
",oracle/test_patch_a.ts,oracle/test_patch_b.ts,oracle/test_composition.ts,"import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.object({ name: z.string() }).refine(() => false).catchall(z.unknown());

  assert.equal(schema.safeParse({ name: ""Ada"", extra: true }).success, true);
  console.log(""zod__002 patch_a ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.object({ name: z.string() }).refine(() => false).loose();
  const result = schema.safeParse({ name: ""Ada"", extra: true });

  assert.equal(result.success, false);
  assert.deepEqual(result.error?.issues.map((issue) => issue.code), [""custom""]);
  console.log(""zod__002 patch_b ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.object({ name: z.string() }).refine(() => false).loose();

  assert.equal(schema.safeParse({ name: ""Ada"", extra: true }).success, false);
  console.log(""zod__002 composition ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes catchall() so object-level checks are cleared. Patch B refactors loose() to delegate through catchall(). Together, loose() unexpectedly drops object refinements and accepts objects that should fail custom validation.",Zod object-schema interaction between helper semantics and a public API refactor.,instances/zod__002
zod__003,https://github.com/colinhacks/zod,e516c3baf22615e20934116abebfed6c000222c2,TypeScript,state_invariant,fail,easy,researcher_constructed,reproduced,"# Task A: Replace array-length checks in min

## Problem

Applying a new array `.min()` constraint may be intended to replace prior
array-length policy rather than accumulate with older length checks.

## Desired behavior

When applying a new array `.min()` constraint, replace existing array-length
checks before adding the new minimum.

## Constraints

The resulting schema must still enforce the requested minimum length. Other
array behavior should remain unchanged.

## Success criteria

`z.array(z.string()).max(1).min(1)` accepts a two-element array but still rejects
an empty array.
","# Task B: Delegate array nonempty through min

## Problem

Array `.nonempty()` duplicates the minimum-length check created by `.min(1)`.

## Desired behavior

Refactor array `.nonempty()` to delegate to `.min(1)`.

## Constraints

The refactor should preserve other existing cardinality constraints on the
schema, including maximum length checks.

## Success criteria

`z.array(z.string()).max(1).nonempty()` rejects both empty arrays and arrays
with more than one element.
",Replace existing array-length checks when applying a new array .min() constraint.,Refactor array .nonempty() to delegate to .min(1) while preserving other cardinality checks.,"diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..f90acbcc 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1496,7 +1496,7 @@ function _zodArrayMethods(): _LazyMethodsOf<ZodArray> {
   return {
     min(n, params) {
-      return this.check(checks.minLength(n, params));
+      return this.clone({ ...this._zod.def, checks: [] }).check(checks.minLength(n, params));
     },
     nonempty(params) {
       return this.check(checks.minLength(1, params));
     },
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..b1bf111c 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1499,5 +1499,5 @@ function _zodArrayMethods(): _LazyMethodsOf<ZodArray> {
     },
     nonempty(params) {
-      return this.check(checks.minLength(1, params));
+      return this.min(1, params);
     },
     max(n, params) {
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..a8360b58 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1496,10 +1496,10 @@ function _zodArrayMethods(): _LazyMethodsOf<ZodArray> {
   return {
     min(n, params) {
-      return this.check(checks.minLength(n, params));
+      return this.clone({ ...this._zod.def, checks: [] }).check(checks.minLength(n, params));
     },
     nonempty(params) {
-      return this.check(checks.minLength(1, params));
+      return this.min(1, params);
     },
     max(n, params) {
       return this.check(checks.maxLength(n, params));
     },
",oracle/test_patch_a.ts,oracle/test_patch_b.ts,oracle/test_composition.ts,"import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.array(z.string()).max(1).min(1);

  assert.equal(schema.safeParse([""a"", ""b""]).success, true);
  assert.equal(schema.safeParse([]).success, false);
  console.log(""zod__003 patch_a ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.array(z.string()).max(1).nonempty();

  assert.equal(schema.safeParse([]).success, false);
  assert.equal(schema.safeParse([""a"", ""b""]).success, false);
  console.log(""zod__003 patch_b ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.array(z.string()).max(1).nonempty();

  assert.equal(schema.safeParse([""a"", ""b""]).success, false);
  console.log(""zod__003 composition ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes array min() so it clears existing checks. Patch B refactors nonempty() to call min(1). Together, nonempty() clears a prior max() constraint and accepts arrays that are too long.",Zod array-cardinality interaction between helper semantics and public convenience-method delegation.,instances/zod__003
zod__004,https://github.com/colinhacks/zod,e516c3baf22615e20934116abebfed6c000222c2,TypeScript,state_invariant,fail,easy,researcher_constructed,reproduced,"# Task A: Replace set-size checks in min

## Problem

Applying a new set `.min()` constraint may be intended to replace prior set-size
policy rather than accumulate with older size checks.

## Desired behavior

When applying a new set `.min()` constraint, replace existing set-size checks
before adding the new minimum.

## Constraints

The resulting schema must still enforce the requested minimum size. Other set
behavior should remain unchanged.

## Success criteria

`z.set(z.string()).max(1).min(1)` accepts a two-value set but still rejects an
empty set.
","# Task B: Delegate set nonempty through min

## Problem

Set `.nonempty()` duplicates the minimum-size check created by `.min(1)`.

## Desired behavior

Refactor set `.nonempty()` to delegate to `.min(1)`.

## Constraints

The refactor should preserve other existing cardinality constraints on the
schema, including maximum size checks.

## Success criteria

`z.set(z.string()).max(1).nonempty()` rejects both empty sets and sets with more
than one value.
",Replace existing set-size checks when applying a new set .min() constraint.,Refactor set .nonempty() to delegate to .min(1) while preserving other cardinality checks.,"diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..997ef3de 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -2015,6 +2015,6 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructo
   inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);
 
-  inst.min = (...args) => inst.check(core._minSize(...args));
+  inst.min = (...args) => inst.clone({ ...inst._zod.def, checks: [] }).check(core._minSize(...args));
   inst.nonempty = (params) => inst.check(core._minSize(1, params));
   inst.max = (...args) => inst.check(core._maxSize(...args));
   inst.size = (...args) => inst.check(core._size(...args));
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..a7613a2f 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -2017,2 +2017,2 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructo
-  inst.nonempty = (params) => inst.check(core._minSize(1, params));
+  inst.nonempty = (params) => inst.min(1, params);
   inst.max = (...args) => inst.check(core._maxSize(...args));
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index 2f73146f..06b62858 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -2015,7 +2015,7 @@ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructo
   inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);
 
-  inst.min = (...args) => inst.check(core._minSize(...args));
-  inst.nonempty = (params) => inst.check(core._minSize(1, params));
+  inst.min = (...args) => inst.clone({ ...inst._zod.def, checks: [] }).check(core._minSize(...args));
+  inst.nonempty = (params) => inst.min(1, params);
   inst.max = (...args) => inst.check(core._maxSize(...args));
   inst.size = (...args) => inst.check(core._size(...args));
 });
",oracle/test_patch_a.ts,oracle/test_patch_b.ts,oracle/test_composition.ts,"import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.set(z.string()).max(1).min(1);

  assert.equal(schema.safeParse(new Set([""a"", ""b""])).success, true);
  assert.equal(schema.safeParse(new Set()).success, false);
  console.log(""zod__004 patch_a ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.set(z.string()).max(1).nonempty();

  assert.equal(schema.safeParse(new Set()).success, false);
  assert.equal(schema.safeParse(new Set([""a"", ""b""])).success, false);
  console.log(""zod__004 patch_b ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  const schema = z.set(z.string()).max(1).nonempty();

  assert.equal(schema.safeParse(new Set([""a"", ""b""])).success, false);
  console.log(""zod__004 composition ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A changes set min() so it clears existing checks. Patch B refactors nonempty() to call min(1). Together, nonempty() clears a prior max() constraint and accepts sets that are too large.",Zod set-cardinality interaction between helper semantics and public convenience-method delegation.,instances/zod__004
zod_control__001,https://github.com/colinhacks/zod,e516c3baf22615e20934116abebfed6c000222c2,TypeScript,control,pass,easy,researcher_constructed,reproduced,"# Patch A task

Add string-format introspection for email schemas.

Tooling that receives a Zod string schema needs to know whether the schema was
created with the email format without parsing internals directly. Add an
`isEmailFormat()` helper to string schemas that returns whether the schema's
format is `email`.

Constraints:

- Do not change string validation behavior.
- Do not change how email schemas are constructed.
- Preserve existing string format methods.
","# Patch B task

Add number-format introspection for integer schemas.

Tooling that inspects numeric Zod schemas needs to know whether a schema is an
integer schema without parsing internals directly. Add an `isIntegerFormat()`
helper to number schemas that returns the existing integer flag.

Constraints:

- Do not change number validation behavior.
- Do not change how integer schemas are constructed.
- Preserve existing number refinement methods.
",Add string-schema isEmailFormat() introspection without changing string validation behavior.,Add number-schema isIntegerFormat() introspection without changing number validation behavior.,"diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index e4ab7a7f..0c3ef955 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -435,10 +435,13 @@ function _zodStringBaseMethods(): _LazyMethodsOf<_ZodString> {
       return this.check(checks.toUpperCase());
     },
     slugify() {
       return this.check(checks.slugify());
     },
+    isEmailFormat() {
+      return this.format === ""email"";
+    },
   };
 }
 
 export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
   // string format checks
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index e4ab7a7f..83415843 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -1185,10 +1185,13 @@ function _zodNumberMethods(): _LazyMethodsOf<ZodNumber> {
       return this.check(checks.multipleOf(value, params));
     },
     finite() {
       return this;
     },
+    isIntegerFormat() {
+      return this.isInt;
+    },
   };
 }
 
 export function number(params?: string | core.$ZodNumberParams): ZodNumber {
   return core._number(ZodNumber, params);
","diff --git a/packages/zod/src/v4/classic/schemas.ts b/packages/zod/src/v4/classic/schemas.ts
index e4ab7a7f..31788e24 100644
--- a/packages/zod/src/v4/classic/schemas.ts
+++ b/packages/zod/src/v4/classic/schemas.ts
@@ -435,10 +435,13 @@ function _zodStringBaseMethods(): _LazyMethodsOf<_ZodString> {
       return this.check(checks.toUpperCase());
     },
     slugify() {
       return this.check(checks.slugify());
     },
+    isEmailFormat() {
+      return this.format === ""email"";
+    },
   };
 }
 
 export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
   // string format checks
@@ -1185,10 +1188,13 @@ function _zodNumberMethods(): _LazyMethodsOf<ZodNumber> {
       return this.check(checks.multipleOf(value, params));
     },
     finite() {
       return this;
     },
+    isIntegerFormat() {
+      return this.isInt;
+    },
   };
 }
 
 export function number(params?: string | core.$ZodNumberParams): ZodNumber {
   return core._number(ZodNumber, params);
",oracle/test_patch_a.ts,oracle/test_patch_b.ts,oracle/test_composition.ts,"import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  assert.equal((z.email() as any).isEmailFormat(), true);
  assert.equal((z.string() as any).isEmailFormat(), false);
  console.log(""zod_control__001 patch_a ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  assert.equal((z.int() as any).isIntegerFormat(), true);
  assert.equal((z.number() as any).isIntegerFormat(), false);
  console.log(""zod_control__001 patch_b ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
","import assert from ""node:assert/strict"";
import { pathToFileURL } from ""node:url"";

async function main() {
  const z = await import(pathToFileURL(`${process.cwd()}/packages/zod/src/v4/classic/external.ts`).href);

  assert.equal((z.email() as any).isEmailFormat(), true);
  assert.equal((z.string() as any).isEmailFormat(), false);
  assert.equal((z.int() as any).isIntegerFormat(), true);
  assert.equal((z.number() as any).isIntegerFormat(), false);
  console.log(""zod_control__001 composition ok"");
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});
",scripts/validate_a.sh,scripts/validate_b.sh,scripts/validate_composed.sh,Patch A and Patch B apply cleanly to the same base commit with git apply; no textual conflict is reported.,"Patch A and Patch B add independent string and number schema introspection helpers, and the composition oracle confirms both behaviors pass together.",Initial matched control instance for clean composition in Zod.,instances/zod_control__001