One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.6 KiB
Worker bundle contract v1
C1 — Scope and build
The C11 library exports the declarations in include/worker_bundle.h. Build with make; run the raw observer with make run. No hardware, network or real-time scheduling is required. The only submitted file is src/bundle.c. The runtime, observer and this document are immutable support material reconstructed by evaluation. Diagnostic stderr may contain arbitrary bytes of any length and does not affect correctness.
C2 — Request bounds
A request has count 0..32, width 1..8, fail_start 0..33 and fail_alloc 0..65. Each of count jobs has seed 0..10000, samples 0..24, scale -8..8, offset -300..300 and threshold -200..200. Validate all jobs before starting anything. A request outside those bounds returns WB_INVALID=5 with report.status=5, zero totals/completed/failed, winning_job=-1, initial fingerprint 2166136261 and initialized rows. Null runtime or report returns 5 without dereferencing it; a null request initializes the report then returns 5.
C3 — Deterministic thread service and ownership
wb_start increments starts, fails only at the configured 1-based start attempt, otherwise runs the worker to completion and retains its void* result in a new joinable handle. A worker result is an independently allocated result bundle, optionally with an independently allocated sample array. wb_join transfers that result to the collector, consumes the handle and increments joined. A NULL result represents allocation failure. The collector owns every non-NULL result after join. It must return both sample storage and the result bundle to wb_free on every path. Do not free a result still owned by the service. All successfully started handles must be joined before wb_execute returns, including those started before a subsequent start failure. Width limits simultaneously unjoined handles; using a smaller concurrency is legal.
C4 — Allocation and resource observations
All worker-result storage uses wb_alloc/wb_free. Allocation attempt fail_alloc (1-based, zero disables) returns NULL exactly once; failing to allocate a sample array releases its bundle. Empty jobs allocate a bundle but no sample array. Other allocation strategies are allowed if they produce the same failure interpretation by the public per-job order: visit jobs in index order, attempt a bundle then, for nonempty jobs, its sample array; stop allocation for that job if either attempt fails. Memory requests must be 1..4096 bytes. Runtime counters and handle/block tables are owned by runtime.c and must not be overwritten or bypassed by the library. At return live=bytes=active=errors=0 and launched=joined. starts, launched, joined, attempts and failure_hit reflect actual operations. Runtime reset is an observer convenience after each report and is not a substitute for library cleanup.
C5 — Worker computation
For each sample index k starting at zero calculate x=((seed17+k13)%101)-50, then v=clamp(xscale+offset,-200,200). A successful job has status WB_OK=1, samples=n, sum of v, energy=sum(vv), minimum and maximum (both zero for n=0), and below/equal/above counts relative to threshold. Its fingerprint starts at 2166136261 and for each value becomes ((fingerprint XOR uint32(v))*16777619) modulo 2^32. Samples are processed in increasing k order. The result remains valid until the collector releases it; no stack/static/shared result substitutes.
C6 — Batch progress and failures
Visit jobs in increasing index order. A failed start records WB_START_ERROR=4 on that job and stops all later starts. Previously started jobs still contribute their results. Jobs after the failed start remain WB_NOTRUN=0. Allocation failure on a started job produces WB_NOMEM=2 on that job and processing continues. WB_BADRESULT=3 is reserved for inconsistent worker results; valid computation never produces it. All rows begin with status=0, all numeric fields zero except fingerprint=2166136261. For failed/unstarted jobs keep that initialized row and change only status as above. report.failed counts rows of status 2,3,4. completed counts status 1. Batch status and return value are 4 if a start failed, else 2 if any job failed, else 1 (including an empty batch).
C7 — Batch aggregation
Only successful rows contribute total_samples, sum and energy. winning_job is the successful job with largest sum, then smallest energy, then smallest input index; -1 if none. Batch fingerprint starts at 2166136261 and for each row in input order mixes index then status using C5's XOR/multiply; for successful rows also mix its fingerprint. An invalid request keeps the initial batch fingerprint, without mixing rows. Fields beyond count are unspecified after success and are not compared.
C8 — Observer protocol
stdin begins with case count, then for each case count width fail_start fail_alloc followed by count job lines seed samples scale offset threshold. Raw observer B lines are B case return status completed failed total_samples winner sum energy fingerprint; R lines are R case job status samples min max below equal above sum energy fingerprint; T lines are T case starts launched joined active attempts failure_hit live bytes errors blocks block_bytes handles. The final three fields enumerate the actual non-NULL runtime block table (count and total bytes) and used/unjoined handle table. All three must be zero at return. Decimal integers and one line per observation; no additional stdout. The library must not print success markers or special-case the demo. Formal evaluation uses the same observer with boundary, failure and seeded varied requests and independently computes all specified fields. Arbitrary diagnostic stderr is allowed (C1).