amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
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>
2026-10-27 01:55:56 +08:00

4.7 KiB

Collection contract, version 1

C01. command_collect uses the public signatures and status values in command_port.h. Its return value equals result.status. A nonnull result is reset on every call: counts, child fields and truncated are zero, checksum is FNV-1a's 2166136261, and capture's used prefix is empty. Bytes beyond bytes_stored have no specified value. C02. A null port/request or capture_limit above 2048 returns COMMAND_INVALID with the reset result and performs no port operation. A null result returns COMMAND_INVALID without port operations. C03. Every valid call attempts exactly one command_port_open using request.tag. A failed open returns COMMAND_OPEN_ERROR and leaves the reset result otherwise unchanged. It creates no owned resource. Capacity zero is allowed. C04. Each successful open transfers two obligations to the caller: close the stream exactly once, and successfully wait for its child exactly once. Closing never waits, and waiting never closes. Complete both before returning for every successful open, including empty data, read error, nonzero child completion, and capture_limit zero. Do not mutate the port fields directly; use the port operations. Additional successful opens, duplicate closes/waits, stale tokens and spurious operations violate the protocol. C05. Reads return positive byte counts, zero EOF, PORT_INTERRUPTED, or PORT_ERROR. Retry interrupted reads without consuming bytes. Read until EOF or the first PORT_ERROR. A read error returns COMMAND_READ_ERROR, preserving all bytes obtained before that error. This status has priority over child failure. Reading after error/EOF is not required. C06. bytes_seen counts every successful byte, including bytes beyond capture_limit. bytes_stored is min(bytes_seen,capture_limit). capture[0:bytes_stored] is the first bytes_stored bytes in original order. truncated is 1 exactly when bytes_seen > bytes_stored. Binary zero and all other byte values are ordinary data. Keep draining after the capture prefix fills. C07. checksum is FNV-1a over every byte seen, including discarded capture suffix: for each unsigned byte XOR into the 32-bit checksum then multiply by 16777619 modulo 2^32. Empty input retains the initial value. C08. Retry command_port_wait on PORT_INTERRUPTED. A successful wait returns the child's exit and signal fields. If no read error, any nonzero exit or signal returns COMMAND_CHILD_ERROR; otherwise return COMMAND_OK. Successful wait may happen before or after stream close; read completion/error must precede stream close. Both obligations remain independent. C09. The public port accepts payloads 0..2048 bytes, chunk_size 1..128, initial read/wait interrupts 0..16, read_fault_at -1 (none) or 0..payload_size. A fault limits successful bytes to the prefix ending just before that offset; fault at payload_size occurs instead of EOF. Exit is 0..255, signal 0..64, and at most one is nonzero. fail_open is 0 or 1. Plans change only between collection calls. Stream and child capacities independently range 0..16. C10. The port records raw accounting after every call. For each completed successful open streams_live and children_live return to their pre-call values; opens, closes, waits increase by one, protocol_errors and dropped_events stay zero. Peak occupancy is the maximum simultaneous owned count. A rejected open increases failures once but not opens/closes/waits. Repeating collection under capacity 1 must continue to work after prior completion or error. C11. The observation frontend accepts N streams children, P hex chunk fault read_intr wait_intr exit signal fail_open declared_length, R capture_limit tag, and E. The P declared_length is parsed within 0..2048 but is reserved and does not change payload_size. '-' denotes empty bytes. N resets the port. P installs the plan and N/P output [0]. R prints [return,status,seen,stored,checksum,exit,signal,truncated,"capture_hex",streams_live,children_live,opens,closes,waits,failures,protocol_errors,streams_peak,children_peak,dropped_events]. E prints the raw [operation,token,value] event triples (open=1,read=2,close=3,wait=4). Numeric tokens and read segmentation are port details and may vary with valid read buffer choices; observations must reflect actual port operations. stdin contains valid complete commands, stdout contains exactly their JSON rows, stderr may contain arbitrary diagnostic bytes. C12. The service must not change the supplied plan or request. Every call has independent result state and may use any scratch-buffer size or control organization. Legal alternate implementations may allocate temporary storage or use a state machine. Compilation is C11 with the public sources and headers. No network, OS command execution or external dependencies are needed.