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>
14 KiB
io-buffered-close-errors author specification
1. Identity and source
Task io-buffered-close-errors v1, base syn-arm-116, family linux-userspace-abi, C++17. Author: batch18 single author; independent review: pending root full-text review. Status DRAFT, difficulty UNMEASURED.
Route C, original authored software task inspired by the public/easy synthetic HWE direction of FILE-like buffered output and resource release. Source is exactly hwe/syn-arm-116; grouping key syn-arm-116. The only source assets read are metadata.yaml, prompt.md and reference/main.c under factory/20261026-C-hwe-codegen-18/hwe/arm-linux/code-gen/syn-arm-116. The supplied reference is not executed or reused as a grader. No historical user bug or hardware reproduction is claimed. The richer memory backend, API, limits and failure policies are newly published software contracts. There is no personal data, credential, model, hardware or external service dependency.
The substitute is a pure memory backend. Short writes, flush failure and close failure remain observable without files, board timing, privileges or actual fd exhaustion. Verification establishes software transitions only. No Qwen or other real Agent sampling, hardware result, training or difficulty success rate has been measured.
2. Initial state and defects
The public workspace contains README.md, docs/contract.md and five candidate files. All are original. Private assets are check.py, the raw observer.cc, verify.py, spec.md and all fixture implementations. verify.py is copied byte-for-byte from rollout/bos_verify.py. The observer owns Session lifetimes via unique_ptr and invokes methods through references; it does not require copying, moving or assigning candidate sessions.
A: stream drain discards the pending tail after a successful short write, instead of retiring just the accepted prefix. The public smoke opens capacity four, submits six A bytes and closes. Initial output retains only four A bytes while reporting success. Backend.cpp contains the progress rule while stream.cpp contains the state conversion, and CLI/main only report the symptom.
B: close returns immediately on failed flush, so it omits the backend close and leaves a live stream. This is the assigned non-smoke boundary type: error-path resource release plus first-error preservation. The ordinary public contract says flush then close, free the stream and retain the first failing result, including simultaneous flush/close failures. Smoke has no enabled fault. Repeated close makes no additional attempt. Raw history W/F/C observes call ordering as well as all three counters.
Both defects are independent. fix_short_write fixes A only; fix_close_cleanup fixes B only. mask_symptom repairs A only for the smoke capacity, so complete public smoke is correct while other capacities and B fail. Fault-return operations intentionally change their documented state; input/live-state rejections must be atomic.
Candidate source counts will be recorded in factory/report.json after development. Counts exclude blank, comment-only and preprocessor lines and separately exclude pure braces; only the five candidate files and necessary header fields/signatures count, without fixtures or generated branches. Gold and template contain no inactive macros or alternative-solution scaffolding.
Environment: Linux user space, C++17 compiler and Python 3 standard library. Both binaries use argv-based offline compilation. Formal timeout 120 seconds, wrapper deadline 100 seconds, compiler 20 seconds and each scene 12 seconds. Formal fixed image is ccr-29eug8s3-pub.cnc.bj.baidubce.com/algo/bench-runtime@sha256:1519f8daa403998e5401eeb70b973e8aac8346e25a937033bc502dc5de1641a1. Actual image identity is supplied by formal receipts. Host only executes trusted authored fixtures.
3. Public entry points
Build c++ -std=c++17 backend.cpp stream.cpp cli.cpp main.cpp -o buffered; run ./buffered with stdin commands. Public smoke is in prompt.md. All published clauses in template/docs/contract.md apply, including the Session API and caller-owned-session run_cli entry point. The five submitted files are io.hpp, backend.cpp, stream.cpp, cli.cpp and main.cpp. The grader compiles these with a raw observer, and separately compiles the standalone main.
4. Check-to-source basis matrix
All line references below are actual public contract lines. Each row is independently exercised, with exact bytes and integer fields, without tolerated approximation.
| Check | Public basis | Actual scenarios and observation |
|---|---|---|
| Session ownership/defaults/multi-instance | template/docs/contract.md:3 | Two simultaneously live sessions, same ID 0 with different bytes, interleaved calls and all fields of both sessions after every operation |
| Numeric Code identity | template/docs/contract.md:5 | Raw numeric return/last/code, CLI spelling, unknown raw enum never normalized |
| Open ID/capacity successful endpoints | template/docs/contract.md:7 | API and real CLI open ID 0/3 and capacity 1/8, code0 guards and retained record/counters |
| Open range rejection and order | template/docs/contract.md:7 | Each arg's two neighbours, Number min/max, simultaneous invalid ID/capacity, live plus invalid capacity |
| Open live rejection/reopen | template/docs/contract.md:7 | EXISTS in nonzero multi-stream background, retained record replaced after close, lifetime counters preserved |
| Put ID/byte/count successful endpoints | template/docs/contract.md:9 | API/CLI ID 0/3, byte 0/255, count 0/16; code0 endpoint sets guarded separately |
| Put zero preservation and byte zero effect | template/docs/contract.md:9 | Count0 after nonzero pending/data, and positive count of byte0, raw pending/durable readback |
| Put validation order/atomicity | template/docs/contract.md:9 | Per-param neighbours and native extremes, simultaneous bad ID/byte/count, live/missing with invalid args |
| Partial successful progress | template/docs/contract.md:11 | Capacities 1..8 and varying data counts, exact durable/pending bytes, writes count and W history |
| Failed write/pending prefix | template/docs/contract.md:9 | Write fault after previous nonzero data, attempt counted, zero acceptance and preserved pending tail, unappended remainder |
| Arm success endpoints | template/docs/contract.md:13 | API/CLI ID 0/3, stages 1/3 and enabled 0/1 return OK with changed policy; stage2 too |
| Arm range/order/last retention | template/docs/contract.md:13 | Per-param neighbours and native extremes, simultaneous bad stage/enabled, nonzero last error preserved |
| Fault persistence/clear | template/docs/contract.md:13 | Repeated failure, clearing fault and retry, fault replacement and reopen reset |
| Flush empty/nonempty success | template/docs/contract.md:15 | Direct return, per-stream and lifetime attempts, bytes/history, empty flush still calls backend |
| Flush failure/skipped flush after write error | template/docs/contract.md:15 | Both error codes, durable data retained; W without F after failed drain |
| Flush ID/live validation | template/docs/contract.md:15 | API/CLI endpoints, neighbours, native extrema, MISSING in nonzero background |
| Close success and only close fault | template/docs/contract.md:17 | Return OK/CLOSE_ERROR, close once, pending discarded, retained view and live/closed totals |
| Close after write/flush failure | template/docs/contract.md:17 | WRITE_ERROR/FLUSH_ERROR despite close success/failure, W/F before C and first error in last |
| Repeated close/ID reuse | template/docs/contract.md:17 | Second close MISSING, full state/counters/history unchanged, same ID reopened cleanly |
| Close invalid ID/missing | template/docs/contract.md:17 | API/CLI endpoints, neighbours, native extremes, nonzero other streams retained |
| All validation failures preserve all state | template/docs/contract.md:19 | Every API rejection followed by direct views of all eight live-session slots and independent stats; CLI bad inputs followed by views/stats; last-error and enabled-fault background included |
| View all fields and defaults | template/docs/contract.md:21 | Raw code/id/seen/live/capacity/pending/durable/history/last/three flags/writes/flushes/closes; virgin/invalid/closed/reopened |
| Stats independent method | template/docs/contract.md:23 | All six raw fields after every API call and CLI invocation, initial/live/closed/reopen cases |
| Fresh run_cli counter and preserved Session | template/docs/contract.md:25 | Real same-process repeated calls on same Session after limit, querying previous state and processing another 64 lines |
| Physical line count and suppression | template/docs/contract.md:25 | Prefix includes successful commands, API error and syntax error, line64 PUT changes pending, line65 CLOSE and subsequent VIEW suppressed; raw post-call view/stats proves effects |
| Empty/noLF and independent app | template/docs/contract.md:25 | Separate app smoke, empty stdin, mixed limit; CLI empty/noLF and direct returned processed count |
| Fixed verb arity and dispatch | template/docs/contract.md:27 | Every verb actual success, too many args for each, too few for each requiring args; STATS has zero args and therefore no smaller arity |
| Numeric syntax before execution | template/docs/contract.md:27 | Every numeric position: letters, plus, lone minus, suffix, positive/negative overflow at the last digit and at an oversized prefix, CR and NUL, with nonzero bytes/faults/last error retained |
| Whitespace/case/leading zeros | template/docs/contract.md:27 | Space/tab surroundings, unknown/lowercase verbs, empty lines, leading zero and -0 successes |
| Canonical output independent of caller settings | template/docs/contract.md:29 | hex/showbase/showpos/boolalpha/uppercase, width19, fill@, grouped locale; exact bytes from real run_cli |
| Strict bytes/stderr/exit | template/docs/contract.md:25 and :29 | All five scenes require stdout match, stderr empty, exit0 and no timeout independently; stdout_noise/stderr_noise fixture and external exit-only development control |
Model guards require the following actually reached Code sets independently for API and CLI: OPEN {0,1,2,7}; PUT {0,1,3,4,8,9}; ARM {0,1,5,6,8}; FLUSH {0,1,8,9,10}; CLOSE {0,1,8,9,10,11}; VIEW {0,1,8}; STATS {0}. Endpoint guards require 22 distinct (method, numeric parameter, domain endpoint) successful observations for API and another 22 for CLI. All per-parameter domain neighbours and Number extrema are included independently of these success sets. Syntax and LIMIT are separate from API Code sets. The check calls its own independent Python state model, never candidate code inside Python. Deterministic random compositions use seed 116125.
Gold uses mutable streams/devices and cumulative counters. valid_journal stores the event sequence as authority and folds it into ephemeral state for each query or operation; its put commits available space in batches instead of one byte at a time. Its Session explicitly deletes copy/assignment through the public header. It demonstrates a materially different state/transition algorithm with identical observations.
Scratch is created by tempfile.mkdtemp(dir=Path.cwd()) inside the wrapper-owned working directory. All scene generation/expectations, source reads/copies and observer write complete before the first compiler. After that the check only uses argv subprocesses, pipes and in-memory comparison; it never reads, writes, stats, resolves or cleans scratch. The wrapper owns cleanup. No chmod/chown is performed by the check.
Each actual compiler/scene emits one evidence row containing real PID, full argv, actual process exit, timeout, input/expected/actual/stderr [byte-length, SHA256 first16], and the union of exit/timeout/stdout/stderr rejection reasons. The shared cwd applies to every row. The JSON column schema is carried in the same object. Both compiler rows and all five scene rows fit below 3900 UTF-8 bytes and are retained intact by bos_verify's final stderr tail. Build diagnostics are retained but not treated as candidate stderr. Raw full streams are not retained by formal wrapper; complete base64 streams and expected bytes for development are in own factory development evidence. The formal stdout digest proves byte comparison but is not a claim that full stdout is archived there.
5. Fixtures and calibration
Eleven fixtures, each non-template directory containing exactly the five candidate files:
| Fixture | Expected | Purpose |
|---|---|---|
| gold | PASS | Mutable implementation |
| template | FAIL | A and B |
| noop | FAIL | Valid put acknowledges without recording data |
| cheat | FAIL | Standalone main hardcodes complete public smoke stdout |
| cheat_read_grader | FAIL | Real grader read attempt, then exit23 if inaccessible; host may PASS when parent check.py readable |
| fix_short_write | FAIL | A repaired, B retained |
| fix_close_cleanup | FAIL | B repaired, A retained |
| mask_symptom | FAIL | Complete public smoke repaired using capacity4 condition; other capacities and B retained |
| valid_journal | PASS | Event-fold alternative |
| stdout_noise | FAIL | Correct app plus additional stdout |
| stderr_noise | FAIL | Correct app output with nonempty stderr |
All ordinary negative fixtures must compile and execute with actual exit0 and be rejected for behavior. cheat_read_grader is the documented read-denial exit exception. Exit-only control is factory-only, correct stdout/empty stderr with exit7. Full development results/streams are recorded before requesting root freeze review. No task changes are allowed after root grants FIRST_FREEZE_GO without a new identity and new gates. Formal gates, including spec.md full-tree freeze, await that root authorization. Each fixture will run five times on trusted host and fixed Docker; host reader PASS is preserved as an allowed isolation exception rather than changing expected.
6. Real rollout and limitations
No model/Agent/hardware sampling is authorized for this batch. Difficulty remains UNMEASURED. There are no native tool events and no claim of a complete rollout. No credentials, Salty, network or hardware are used. Existing runs are read-only and this task only creates unique output directories. Both /home and /var/lib/docker require at least 10 GiB free; low disk stops work and preserves evidence. No cold migration or unrelated cleanup is performed.
7. Review / next
Pending root independent full-text review, then ROOT125_FIRST_FREEZE_GO, first full-tree freeze and unique host/Docker calibration identity. Gate evidence and real status are factory-only additions; task bytes, including this spec, remain unchanged during the gates. No admission or PASS is claimed before actual receipts. Final report must preserve all failures and actual cleanup/status/digest facts.