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

7.7 KiB

Retained topic delivery service contract

C01. This is an in-process C++17 software topic service. Durability 0 means volatile; 1 means retained. These are project rules, not complete DDS/ROS QoS compatibility or persistence across processes. All calls are sequential; no wall clock, hardware or network is used. C02. Public interface and field order are in topic.hpp. Writer and reader namespaces are independent, each id is 1..64; topics are 1..16. Policies have durability 0 or 1 and history depth 1..8. Reader capacity is 1..16. Invalid creation arguments return -22 before duplicate checks. A valid duplicate returns -17. Failed operations leave state and all output objects unchanged. C03. Every successful writer creation increments a broker-local generation counter (initially zero). Sequence starts at 1 within that writer generation. Successful publications increment a broker-local global order counter; the publication Sample has the writer id, generation, sequence, order, signed int32 value, historical=0. Failed creation/publication consumes no counter. Writer views expose publication count and effective cache length. There is no practical counter wrap in permitted sessions (at most 100000 commands per process). C04. Retained writers cache the most recent depth publications, independently per writer. Volatile writers cache none. set_history first checks existence (-2), then depth 1..8 (-22), shrinks by removing oldest history, and never recovers removed samples when expanded. Durability does not change. C05. A live publication is enqueued to each same-topic reader if requested durability is 0 or offered durability is 1. Incompatible readers and other topics receive nothing. Volatile-request readers receive only future live publications, even when offered durability is retained. C06. A retained-request reader, on successful creation, replays the currently cached samples from all same-topic retained writers. Merge them in increasing global order, set historical=1 on each delivered copy. Existing readers are not replayed again. The reader's capacity/overflow rules apply to every replay sample, too. C07. Each reader owns its inbox. On enqueue at capacity discard the oldest pending sample and increment dropped, then append. take checks existence (-2) before maximum 0..16 (-22), replaces output with up to maximum oldest samples, removes exactly those, and increments delivered. take(0) succeeds with an empty result. peek replaces output with all pending samples without changing anything. Failed peek/take preserve the whole prior output vector. Previously returned samples are values independent of later operations. C08. resize_reader checks existence (-2), then capacity (-22), changes capacity and discards oldest excess samples, increasing dropped for each. Expansion does not replay. ReaderView reports topic, durability, capacity, pending, dropped, delivered. Counters start at zero on every reader creation, including reused ids. C09. close_writer returns -2 if missing; success destroys its history immediately, but leaves samples already queued to readers intact. A later writer reusing the id gets a new generation, sequence starts over, and no old history. close_reader destroys its inbox and counters; a later reader with the id is a fresh subscription and receives the currently eligible replay again. Endpoint ids outside range behave as missing for operations other than creation. C10. topic_view rejects topics outside 1..16 with -22, otherwise returns active writers, readers, cached samples, pending samples for that topic. summary has total active writers, readers, cached, pending, lifetime successful publications and writer generations. clear resets the entire broker including both lifetime counters. Different Broker objects share no state. Writer/Reader view calls return -2 when missing and preserve output on error. Queries never mutate service state. C11. profile_policy accepts exactly sensor=(0,1), map=(1,3), control=(0,2), status=(1,1), without trimming. Unknown names return -22 and preserve out. open_profile resolves the profile before calling open_writer; unknown profile therefore returns -22 even for an existing id. The map profile supports late readers after one initial publication. C12. parse_policy trims only ASCII space/TAB around the whole text and on either side of a single slash. It accepts a profile name or volatile/DEPTH or retained/DEPTH. DEPTH is ASCII digits with an optional leading '+', arbitrary leading zeros, numeric value 1..8. No minus, embedded whitespace, CR/LF/NUL, case folding, extra slash or suffix is accepted. Failure is -22 and leaves out unchanged. No length limit is imposed by this API. format_policy returns canonical volatile/N or retained/N for a valid policy, otherwise the literal invalid. Neither parser nor formatter changes its input. C13. topic-console is a public observer built together with candidate sources. Each LF-terminated input line is split only on space/TAB/CR; empty lines are ignored. Numeric command operands are signed int32 ASCII decimal with optional '+' or '-' and arbitrary leading zeros. Invalid syntax/range or unknown command exits 2; valid streams exit 0. Only valid streams are required for the broker acceptance. Commands may interleave two independent brokers with U. All input is supplied before execution. Stderr diagnostics may contain any bytes and do not affect acceptance. C14. Every command emits one numeric row, decimal tokens separated by space/TAB/CR/LF; optional sign and leading zeros are equivalent representations. The entire stdout consists of exactly these rows in order, without labels or other tokens. For acceptance, row boundaries are LF, optional CR and horizontal space are allowed around tokens. No stderr or stdout size restriction is part of this contract. M reports canonical policy text as count then unsigned byte values, so all rows remain numeric. Only defined fields and actual vector members are observed.

Commands (all apply to selected broker, initially 0):

command observation row
W id topic durability depth open_writer return
D id topic profilehex open_profile return
X id close_writer return
P id value publish return, then six Sample fields
R id topic durability capacity open_reader return
C id close_reader return
N id capacity resize_reader return
H id depth set_history return
T id maximum take return, count, then each six-field Sample
E id peek return, count, then each Sample
Q id reader_view return, then six ReaderView fields
V id writer_view return, then six WriterView fields
F topic topic_view return, then four TopicView fields
S six Summary fields
Z 0 after clear
U index selected index, only 0 or 1
L texthex parse_policy return, durability, depth
M durability depth format_policy byte count, then unsigned bytes

C15. Hex input is pairs of ASCII hexadecimal digits (either case), '-' encodes empty bytes. Publication and vector error sentinels are Sample(91,92,93,94,95,96); vector sentinel has exactly that one member. Writer/ReaderView error sentinel fields are (91,92,93,94,95,96), TopicView is (91,92,93,94), Policy is (91,92). These are observer initial values, not required success values. The observer only prints raw return values and defined output fields; it contains no expectations or hidden tests. C16. Build with make using existing g++ and C++17, without dependencies or network. make demo reproduces the map startup report. make lifecycle reproduces the restart report. Candidate submission consists of topic.hpp, broker.cpp, policy.cpp; the supplied public observer/Makefile/docs/examples are frozen support when grading. Other implementations and internal data structures are allowed if all documented behavior holds.