amos 73a5240295 Batches 21 and 18: add 74 calibrated tasks (40 Bos redo, 34 HWE code-gen)
Batch 21 (20261027-A-bos-redo-21) rebuilt 40 of the 53 rejected Bos-qiao
environments: hidden assertions that ran inside the candidate's process
now run in a trusted parent that reads observations from a low-UID
worker; gold bytes are unchanged. 9 were excluded for scope (ROS2,
oversize, security core), 3 are blocked because the source requires an
exec bit the platform does not freeze, 1 lacks requests/bs4 in trace6.

Batch 18 (20261026-C-hwe-codegen-18) adds its last 34 of 134 tasks; the
first 100 landed in 2f32624d.

Claude reviewed 74/74 USABLE against current digests, canonical
families, no ID or source overlap with main, plain public docs. Only the
new task directories are taken; the stale pre-batch-20 copies of
concur-release-capsule and resource-temp-link on the batch 21 branch and
both branches' progress notes stay as main has them. Difficulty is
unmeasured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:23:12 +08:00

6.9 KiB

Runtime contract

This is a deterministic Linux userspace model. It uses no threads, operating system signals, clocks or devices. C++17 and the standard library are sufficient. The source of this software contract is this document.

Objects and data

Each cancelrt::Runtime starts empty. Instances have independent state; object IDs in one instance do not reserve IDs in another. An ID is an integer from 1 through 31. create(id,total,seed) accepts total from 0 through 32 and seed from -1000 through 1000. It creates input element i equal to seed+i, no output, factor 1, bias 0, attempts 0, releases 0 and active 0. An existing ID returns EXISTS. list() returns current IDs in increasing order.

configure(id,factor,bias) accepts factor from -8 through 8 and bias from -1000 through 1000. It replaces the two configuration fields. write(id,offset,count,value) replaces count consecutive input elements with value. Offset and count each range from 0 through 32, and value ranges from -1000 through 1000. The span must fit the input. Configure and write return BUSY when any output has been committed; a zero count still follows this rule. A zero count span may start at the input's end.

read(id,offset,count,view) accepts offset and count from 0 through 32 and view 0 or 1. View 0 selects input and view 1 selects committed output. The span must fit the selected vector. The reply values contain that span in order. A zero count span may start at the selected vector's end. Reading does not modify any state. inspect(id) returns the object's fields without vector elements.

Running and lifecycle

run(id,budget,cancel_after) accepts budget from 0 through 32 and cancel_after from -1 through 32. It returns BUSY if the object is active. If all total elements are already committed it returns DONE without acquiring a lease. Otherwise it acquires a lease, increments attempts and produces up to budget elements starting at the committed prefix's end. Element i is input[i]*factor+bias+i, using signed 64-bit arithmetic. The input and configuration are unchanged by running.

For each step that fits the budget and remains in the task, pending is tested before the step changes output. Pending is false when cancel_after is -1; otherwise it is true once the number of elements produced in this invocation is at least cancel_after. Pending returns INTR with the previously committed prefix retained and the unstarted step absent. Completing the total returns DONE; consuming the budget with work remaining returns YIELD. Each acquired lease is released on return, releases increments once and active becomes 0. Budget zero on an unfinished task returns YIELD and acquires and releases a lease. Produced counts only elements committed by this invocation.

rewind(id) clears output and resets attempts, releases and active to 0, preserving input, total, factor and bias. It may be repeated. erase(id) removes the object and returns an empty successful reply. Reusing its ID through create starts a fresh object. Methods do not affect other objects.

API and replies

The public declarations are in runtime.hpp. All numerical method parameters are std::int64_t, including IDs, sizes and selectors. Methods are create, configure, write, read, inspect, run, rewind, erase and list with the signatures in that header. The header's storage declarations are implementation details and may be changed; the public signatures, Reply fields and enum values remain available. print_reply(std::ostream&, const Reply&) and run_cli(std::istream&, std::ostream&, std::ostream&) are public functions.

Code values are OK=0, RANGE=1, EXISTS=2, MISSING=3, BUSY=4. Stop values are NONE=0, DONE=1, YIELD=2, INTR=3. Each method first checks the numerical domains of all parameters in signature order, returning RANGE if any fails. It then checks object presence: create returns EXISTS for an existing ID; other ID methods return MISSING for an absent ID. Read and write then check span fit and return RANGE if it fails. Configure and write then apply their committed-output rule; run then applies its active rule. A failed method leaves the entire runtime unchanged and returns its code with every other Reply field zero and both vectors empty.

For a successful object operation except erase, Reply contains total input size, done output size, factor, bias, attempts, releases, active and sum of all committed output. Produced is zero and stop is NONE except for run. Values is empty except for read. IDs is empty. Erase and list return zero scalar fields, NONE stop and empty values, with list's IDs as described above. The default Reply is an empty successful reply. std::int64_t sum and each values element contain the full mathematical value; all other scalar payload fields and IDs are int. Successful read, inspect and list do not change state.

print_reply emits these space-separated decimal fields on one line: code stop total done produced factor bias attempts releases active sum values_count, then values_count elements, then ids_count, then ids_count IDs. Integers use canonical base-ten notation without a plus sign or leading zeros, except zero itself. Each separator is one ASCII space; there is no trailing space and the line ends in LF. It prints the enum's underlying integer even if a caller has constructed a value outside the named enum constants. It preserves every Reply payload field supplied by the caller.

Command stream

The executable has no command-line arguments and calls run_cli on stdin, stdout and stderr. Each run_cli call creates a fresh runtime and fresh line count, writes no diagnostic bytes and returns 0 for every command stream described here. It is usable multiple times in one process with separate streams. Input uses ASCII tokens; LF ends a physical line. The last nonempty physical line is processed even without LF. Within a physical line only space, tab and CR separate tokens, and leading and trailing separators are allowed. Blank lines produce SYNTAX.

Verbs are create with 3 arguments, configure with 3, write with 4, read with 4, inspect with 1, run with 3, rewind with 1, erase with 1 and list with 0. They call the same-named methods in the written argument order and print the reply using print_reply. Verbs are lowercase. Numeric tokens consist of an optional sign followed by one or more ASCII digits, and must fit signed 64-bit. Leading zeros are accepted. Unknown verbs, wrong argument counts and malformed or overflowing numeric tokens print only SYNTAX and LF; those lines do not change the runtime. Domain errors are method replies.

A call dispatches at most 4096 physical lines; blank, syntax-error and method-error lines consume this count along with successful lines. If another physical line exists it prints only LIMIT and LF for that line, performs no further commands, and returns. Empty input produces no bytes. Stdout contains only the specified replies, SYNTAX and LIMIT lines. Stderr is empty and process exit is 0.