amos 8b7616bfd8 Batch 22 (20261027-C-hwe-hard-22): add 63 calibrated HWE hard-design tasks
From the 101 lk/man/pth code-gen sources: 63 tasks (C11 36, C++17 27,
11 canonical families), 38 skipped for scope or duplication. Each task
has at least one independent contract-edge defect, boundary types
rotate, and public docs state trap clauses as plain contract prose.
Claude reviewed 63/63 USABLE against current digests. Difficulty is
unmeasured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 16:14:57 +08:00

10 lines
3.4 KiB
Markdown

# Offline journal format
C01. The supplied `socket-console` owns channels 0, 1, and 2, each initialized once using its own adapter. It reads ASCII lines of at most 8192 bytes excluding LF. Tokens are separated by space or tab. Final LF is optional. Numbers have an optional ASCII plus/minus and one or more ASCII digits, any number of leading zeros, and numeric value between -1000000 and 1000000. Blank, overlength, embedded-NUL, malformed, unknown, excess-token and out-of-range-channel lines return INVALID without state or port mutation. An overlength line is consumed through its LF or EOF.
C02. `O channel`, `C channel`, and `F channel` call open, close, and finish respectively. `Q channel hex` queues the bytes, accepting uppercase or lowercase pairs or `-` for empty, up to 65 bytes; length 65 is passed to the library. `T channel quota`, `R channel quota`, and `D channel count` call transmit, receive, and take; nonnegative values up to 1000000 are passed to the library. Other numeric values are INVALID without invocation.
C03. `S channel steps...` replaces that adapter's send script; `V channel steps...` replaces its receive script. Each has zero to 64 steps in -4..64, and replacement resets only its own next-script index to zero. Invalid scripts have no effect. Positive steps return min(step,request); zero returns zero; -1, -2, -3, -4 return -1 with errno EINTR, EAGAIN, EPIPE, EIO respectively. One callback consumes one script step; exhausted sends accept the whole request, and exhausted receives return EAGAIN. Scripts and their indices survive connection open/close.
C04. Adapter receive bytes are `(seed + 17 * cursor) mod 256` with seeds 31, 102, 173 for channels 0, 1, 2. Its cursor begins at zero and increments per returned byte, surviving script replacement and connection open/close. `H channel error` sets the adapter's shutdown error to 0, EIO (5), or EAGAIN (11). A shutdown call returns zero when that setting is zero, otherwise -1 with that errno; the setting is retained until another H.
C05. Each output line is a JSON object with rc, n, out, channels, and ports. rc is the command status; n is the progress/taken count for T/R/D and zero otherwise; out is the lowercase hex bytes taken by D and empty otherwise. channels contains three objects: state is [generation,opened,read_end,write_end,last_error,accepted,received,delivered], tx and rx are logical FIFO contents as lowercase hex. All JSON numeric values are integers, with flags represented by 0 or 1.
C06. ports contains three objects: next is [send_next,recv_next], cursor is the receive cursor, and calls contains the callbacks made by the current command in order. A call is [kind,requested,flags,result,error,hex], where kind is send=1, receive=2, shutdown=3. Send includes the complete requested bytes on every result; receive includes the returned bytes on positive results and empty hex otherwise; errors are zero unless the result is negative. Shutdown has requested=flags=0 and empty hex. Observer logs clear before each line; all other adapter fields remain. No stream or script changes occur beyond those defined for the selected operation.
C07. The public ring helpers can also be called independently under their stated preconditions. The console and adapter are observation tools; their source is supplied for reproducibility and is not part of the collected repair. Output JSON whitespace is not significant. Normal EOF, including an empty journal, exits zero.