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>
4.8 KiB
Scanner contract
-
scanner.hdefines the C11 API and structures. All API pointers are non-null exceptsp_plan_valid, which returns false for NULL. Initialize a scanner withsp_initbefore other calls. A scanner is unconfigured (stop 0), FETCH phase (0), cursor -1 and zero counters/digest. Invalid operations return -1, leave the scanner unchanged, and produce no events. Valid operations return 0. The journal count, rather than unused array elements, defines its meaningful range. -
sp_domain_lengthreturns the inclusive work-domain length of an already validated plan (zero for an empty plan). A plan has 0..64 values, each -1000..1000; modulus 1..17 and residue 0..modulus-1. Nonempty first/last indices are within the array. Empty plans require first=last=0. Installation copies the plan, clears all counters, sets phase FETCH and cursor=first, and sets stop READY (1), or DONE (3) with cursor -1 for empty plans. Values outside the inclusive work domain are never scanned. Installing an invalid plan preserves the old scanner.sp_restartresets the currently installed plan exactly as installation, and fails if unconfigured. -
The work domain is every index from first to last inclusive, increasing by one if first<=last and decreasing by one otherwise. Each record requires exactly three transitions in order: FETCH (event kind 1), CLASSIFY (2), COMMIT (3). FETCH reads the current value and clears selected to 0. CLASSIFY sets selected to 1 exactly when the value's normalized modulo equals residue: a negative C remainder is increased by modulus. COMMIT increments visited once; if selected it increments kept, adds value to sum, and updates digest. COMMIT advances to the next record even when excluded; after the last record it sets DONE immediately. Completion retains the last index and FETCH phase. Each transition increments steps once. Pausing preserves the exact next phase and cursor.
-
The accepted-record digest starts at 0. On each selected COMMIT it becomes
(previous*131 + (index+1)*17 + value+1000) modulo 1000003. Excluded records do not change it. Counts and sum cover committed records only. All integer fields are exact; no floating point tolerance applies. -
sp_tickaccepts budgets 0..256; other budgets and unconfigured calls fail without changing state. A valid call clears the journal, performs at most budget transitions and stops early at DONE. If unfinished, its stop is BUDGET (2), including budget 0. A DONE scanner remains unchanged and emits no events. There is no wall-time or infinite-loop requirement: the finite transition budget is the only work limit. Journal entries record each transition after its counter/phase effects but before advancing the record index. Fields are kind, index, value, selected, visited, kept, sum, digest. FETCH's selected is 0; CLASSIFY/COMMIT report the current selection. -
observer.cis a raw observer, not an assertion program. Input is LF-separated ASCII command lines without NUL; a final line may omit LF. Only space, TAB and CR separate tokens; surrounding separators are allowed. Commands areP count first last modulus residue value...(exactly count values),T budget,S(snapshot), andR(restart). Integers are complete ASCII decimal tokens with optional leading + or -, and any number of leading zeros. Values must meet clauses 2 and 5. Missing/extra tokens, other characters or commands are invalid and leave scanner state unchanged. Every input line, including invalid or empty lines, produces one observation; no command terminates the stream. Allocation or input/output failures can terminate the observer nonzero and do not represent valid scanner observations. -
Each observation is one LF-terminated line of ASCII decimal integers separated by horizontal whitespace (space/TAB/CR). Optional signs and leading zeros are allowed in observations as in input. Its ten-field header is
result stop phase cursor steps visited kept sum digest event_count, followed by event_count eight-field records in clause 5 order. No other stdout tokens are allowed. stderr may contain arbitrary diagnostic bytes and does not change a valid observation. Only the active journal prefix is defined. Snapshot and restart commands emit zero events. Invalid decoder input has result -1 and zero events. -
make demouses onlyexamples/demo.txt, a forward traversal with excluded records, a partial budget, a snapshot, and completion.make reverseis an independent optional example using onlyexamples/reverse.txt, with descending indices and restart. The optional example is not loaded or run by the default build/demo. A replacement plan, singleton/empty domain, negative values, all-selected/all-excluded filter, partial transition budgets, zero budget, repeated DONE calls and multiple restarts are all supported combinations under clauses 1..7.