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>
5.0 KiB
Sequence service contract
The service is a Linux user-space deterministic model. Implement every clause below. C++17 and the standard library are sufficient. sequence.hpp is the public interface; callers own Engine objects and pass references. Engines have independent state and need not be copyable or assignable. An Engine starts with three empty banks numbered 0 through 2 and next_ticket=1. Each bank holds at most 16 records. Record fields are signed 64-bit key, payload, ticket. Accepted append keys are -2147483648 through 2147483647 and payloads 0 through 65535. Tickets are assigned from next_ticket, then next_ticket increments; ticket 255 is the final assignable ticket. Clearing banks does not rewind next_ticket. Records keep all fields when moved or copied between banks. Reply contains integer code and an ordered vector of signed 64-bit values. Every nonzero API code returns an empty vector and leaves every bank and next_ticket unchanged. For all methods bank validation precedes other checks. Codes are 0 success, 1 invalid bank, 2 invalid numeric argument, 3 insufficient bank capacity, 4 source order mismatch, 5 missing position or ticket, 6 ticket pool exhausted. Other than codes 7 and 8 generated by run_cli, no other code is produced. reset(bank) removes all records from that bank and returns the prior record count as one value. Reset of an empty bank succeeds. append(bank,key,payload) checks key and payload, bank capacity, then ticket availability in that order; on success it appends the record and returns the new bank count. order(bank,descending) accepts descending 0 or 1. It orders the bank by key ascending for 0 and descending for 1. Records with equal keys retain their order from immediately before the call. It returns the original zero-based positions in their new order. Sorting empty or already ordered banks succeeds. merge(destination,left,right,descending) checks all three bank numbers, descending 0 or 1, both sources monotone in that direction, then their combined count at most 16. On success it replaces destination with the merged records and returns the resulting count. Each source retains its internal order; equal keys from left precede equal keys from right. Sources are read from the state at entry, including when destination aliases a source or both sources are the same bank. Other banks and next_ticket remain unchanged. Empty sources are permitted. item(bank,index) accepts index 0 through 15, then checks whether it exists. It returns that record's key, payload, and ticket in this order. range(bank,offset,count) accepts offset and count individually 0 through 16, then requires offset+count no greater than the bank size. It returns count, sum of keys, minimum key, maximum key, sum of payloads. An empty range returns five zeros. A zero count at the bank end is permitted. locate(bank,ticket) accepts ticket 1 through 255. It returns every zero-based position containing that ticket in increasing order, or code 5 when there are none. Duplicated records from merge can produce multiple positions. inspect() returns next_ticket and all three complete banks in bank order and record order. Returned values are independent values; modifying a returned State does not change the Engine. run_cli(engine,input,output) operates on the caller's Engine, returns 0, and produces no stderr. Each call has a fresh physical-line count. It processes up to 1024 lines, counting blank, syntax, and API failure lines. On receiving any further line it emits code 8 with no values and returns before executing that line. A final line without LF is processed. No input is success with no output. Each line is at most 256 bytes excluding LF. Separators are space, tab, and CR. NUL and bytes above 127 make the line syntax code 7. Blank lines, unknown verbs, wrong argument counts, or malformed integers produce code 7 and no mutation; processing then continues. Integers use optional '-' followed by one or more ASCII digits with signed 64-bit range. '+' is not accepted. Leading zeros and negative zero are accepted. Other control bytes are not separators and cannot occur inside a valid verb or integer. Commands are reset b; append b key payload; order b descending; merge destination left right descending; item b index; range b offset count; locate b ticket; inspect. Each verb has only the listed number of arguments. Responses to all commands except inspect are canonical decimal 'code value_count' followed by each value prefixed with one space and then LF. Inspect responds 'S next_ticket' followed for each bank by one space and its count, then each record's key, payload, ticket each with one preceding space, followed by LF. Output is independent of caller stream flags, width, fill, and locale. Successful commands and failures both use these formats. The standalone program creates a fresh Engine, calls run_cli once on stdin/stdout, emits no other bytes and no stderr, and exits 0. This applies to empty, malformed, and over-limit input. Preserve sequence.hpp declarations and implement the public API; internal representation and algorithms can change.