The user wants 2000 tasks, most of them ones Qwen cannot solve. New batch tasks are now measured on their branch first (3 Qwen trials each), and only HARD or MEDIUM tasks reach main; ROUTINE ones stay on the batch branches. A session cut by context_limit or output_limit counts as a failure for difficulty (user decision 2026-11-03); the trajectory stays incomplete. - Batch 26 (route D, real upstream fixes in embedded open-source projects): 7 HARD of 20 (coreJSON, littlefs, CANopen, coreMQTT, LwM2M, Zephyr ring, lwIP SNTP). Most failures are Qwen exhausting its context in the larger workspaces. - Batch 25 (HWE mutation repairs): 1 HARD and 1 MEDIUM of 56. - Batch 27 (spec-dense implementation tasks): 2 MEDIUM of the first 10. Each task comes from the exact commit Qwen measured, and its digest matches the measured one. Failure reasons are not yet reviewed, so difficulty is the automatic label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
102 lines
4.0 KiB
Python
102 lines
4.0 KiB
Python
def _validate(request):
|
|
if type(request) is not dict:
|
|
raise TypeError('request')
|
|
for key in ('pixels', 'window', 'size', 'minimum', 'fill'):
|
|
if key not in request:
|
|
raise KeyError(key)
|
|
pixels = request['pixels']
|
|
if type(pixels) is not list:
|
|
raise TypeError('pixels')
|
|
if len(pixels) > 32:
|
|
raise ValueError('rows')
|
|
for row in pixels:
|
|
if type(row) is not list:
|
|
raise TypeError('row')
|
|
columns = len(pixels[0]) if pixels else 0
|
|
if any(len(row) > 32 or len(row) != columns for row in pixels):
|
|
raise ValueError('columns')
|
|
for row in pixels:
|
|
for value in row:
|
|
if value is not None:
|
|
if type(value) is not int:
|
|
raise TypeError('pixel')
|
|
if not 0 <= value <= 65535:
|
|
raise ValueError('pixel range')
|
|
vectors = []
|
|
for key, length in (('window', 4), ('size', 2), ('minimum', 2)):
|
|
value = request[key]
|
|
if type(value) is not list:
|
|
raise TypeError(key)
|
|
if len(value) != length:
|
|
raise ValueError(key + ' length')
|
|
if any(type(item) is not int for item in value):
|
|
raise TypeError(key + ' element')
|
|
if key == 'window' and (value[0] > value[2] or value[1] > value[3]):
|
|
raise ValueError('window order')
|
|
if key == 'size' and any(not 0 <= item <= 32 for item in value):
|
|
raise ValueError('size range')
|
|
if key == 'minimum' and not (0 <= value[0] <= value[1] and value[1] > 0):
|
|
raise ValueError('coverage threshold')
|
|
vectors.append(value)
|
|
fill = request['fill']
|
|
if type(fill) is not int:
|
|
raise TypeError('fill')
|
|
if not 0 <= fill <= 65535:
|
|
raise ValueError('fill range')
|
|
return pixels, vectors[0], vectors[1], vectors[2], fill
|
|
|
|
def _resample(request):
|
|
from math import gcd
|
|
source, (x0, y0, x1, y1), (width, height), (n, d), fill = _validate(request)
|
|
dx, dy = x1 - x0, y1 - y0
|
|
nominal = dx * dy
|
|
pixels, coverage = [], []
|
|
for j in range(height):
|
|
row, cover = [], []
|
|
for i in range(width):
|
|
area = total = 0
|
|
left, right = x0 * width + i * dx, x0 * width + (i + 1) * dx
|
|
top, bottom = y0 * height + j * dy, y0 * height + (j + 1) * dy
|
|
for r, samples in enumerate(source):
|
|
hy = max(0, min(bottom, (r + 1) * height) - max(top, r * height))
|
|
if not hy:
|
|
continue
|
|
for c, value in enumerate(samples):
|
|
if value is None:
|
|
continue
|
|
wx = max(0, min(right, (c + 1) * width) - max(left, c * width))
|
|
weight = wx * hy
|
|
area += weight
|
|
total += value * weight
|
|
if nominal:
|
|
common = gcd(area, nominal)
|
|
cover.append([area // common, nominal // common])
|
|
else:
|
|
cover.append([0, 1])
|
|
if area and area * d >= nominal * n:
|
|
q, rem = divmod(total, area)
|
|
row.append(q + int(2 * rem > area or (2 * rem == area and q % 2)))
|
|
else:
|
|
row.append(fill)
|
|
pixels.append(row)
|
|
coverage.append(cover)
|
|
return {'pixels': pixels, 'coverage': coverage}
|
|
|
|
class Pixel(int): pass
|
|
class Row(list): pass
|
|
class Result(dict): pass
|
|
class Text(str): pass
|
|
class TypeRejected(TypeError): pass
|
|
class ValueRejected(ValueError): pass
|
|
class Missing(KeyError): pass
|
|
def _convert(value):
|
|
if isinstance(value, dict): return Result((Text(k), _convert(v)) for k, v in value.items())
|
|
if isinstance(value, list): return Row(_convert(v) for v in value)
|
|
if type(value) is int: return Pixel(value)
|
|
return value
|
|
def resample(request):
|
|
try: return _convert(_resample(request))
|
|
except TypeError as exc: raise TypeRejected(str(exc))
|
|
except ValueError as exc: raise ValueRejected(str(exc))
|
|
except KeyError as exc: raise Missing(str(exc))
|