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>
15 lines
4.3 KiB
Markdown
15 lines
4.3 KiB
Markdown
# Packet queue contract
|
|
1. There are three FIFO lanes numbered 0..2. Initial capacity is 8 per lane. No board, network, wall clock or threads are required. Priority is metadata; it does not reorder FIFO.
|
|
2. P lane id priority deadline hex submits a packet. id is 0..999999, priority 0..3, deadline 0..1000000; hex is 1..64 bytes encoded as pairs (case insensitive), or - for zero bytes. Duplicate IDs are allowed. A successful push appends a copy, increments accepted, and returns 0.
|
|
3. Each queued packet owns exactly one Memory Node allocation of 64 bytes followed by one Payload allocation of data length+1 bytes, including empty data. The last payload byte is a zero terminator. Resources must be returned via Memory.release when a packet leaves ownership. Internal organization is otherwise unrestricted; no access to Memory private state is allowed.
|
|
4. Full lanes refuse P with -2 and increment refused without allocation. Otherwise P attempts node then payload; a failure returns -3, increments oom, releases any allocation acquired for that attempt, and leaves lane content unchanged. Memory counts every acquire attempt; successful allocations and releases, failure and invalid-release counts, live nodes/payloads and sum of live allocated bytes are observable. A null release has no effect. Invalid releases are forbidden.
|
|
5. O lane removes and returns its oldest packet, increments popped and returns 0; empty lane returns -2 with no other effect. K lane returns the same oldest packet without mutation, or -2 on empty. After emptying, a lane can accept a new packet normally.
|
|
6. E lane now removes every packet with nonzero deadline <= now, preserving the order of survivors. It returns the number removed and increments expired by that count. Each removed packet must release both owned allocations. now ranges 0..1000000; deadline 0 never expires.
|
|
7. C lane removes every packet, returns the count, increments cleared by that count and releases both allocations of each. Empty C has no effect. X clears all lanes by C in lane order and returns 0. EOF destroys the queue with the same releases; repeated shutdown and destruction of an empty queue have no further effects. Capacity is preserved by C and X.
|
|
8. M from to maximum transfers the oldest prefix, bounded by maximum (0..32), source count and free destination capacity. It appends to the destination in source order; same lane returns 0. It returns the number transferred and adds it to moved. Ownership transfers without acquire/release calls, accepted/popped/expired/cleared do not change.
|
|
9. L lane capacity changes the limit to 1..32, returns 0; a limit below current count returns -2 with no effect. F n sets a one-shot allocation-failure countdown, 0 disables. Each subsequent Memory.acquire decrements a positive countdown; the acquire reaching zero fails. n ranges 0..1000; full/rejected operations do not advance it.
|
|
10. All numbers are unsigned ASCII decimal, leading zeros allowed; signs, overflow, missing/extra tokens, unknown command, invalid hex or out-of-range argument return -1 without queue, statistics, Memory or F mutation. Blank lines are ignored. Input is whitespace separated, one command per line.
|
|
11. After each nonblank line, R step rc is printed; a successful O/K appends id priority deadline lowercase_hex (or -). Then S step prints accepted popped expired cleared moved refused oom, six fields per lane (count payload_bytes head_id tail_id checksum capacity), then Memory fields attempts allocated released failures invalid live_nodes live_payloads live_bytes. An empty lane has head/tail/checksum zero. No extra stdout is permitted; arbitrary diagnostic stderr bytes are permitted.
|
|
12. Packet checksum is 32-bit FNV-1a starting at 2166136261, feeding id as four little-endian bytes, priority as one byte, deadline as four little-endian bytes, then the data bytes; xor each byte then multiply by 16777619 modulo 2^32. Lane checksum starts zero and folds FIFO packet checksums as h=(h*33+packet_checksum) modulo 2^32. IDs of zero are ordinary IDs, not sentinels.
|
|
13. After EOF destruction, Z plus the eight Memory fields is printed. All live resources must be zero and invalid release count zero; the Memory destructor may finally reclaim leftovers to keep diagnostics safe, but that occurs after Z and cannot satisfy queue ownership. Exit status is 0 on normal EOF. Limits describe supported inputs, not permission to omit documented paths.
|