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.9 KiB

resource-format-buffer

Identity, origin and software boundary

Version 1; family resource-lifecycle; route C ORIGINAL; source hwe/dbg-valgrind-leak-static-grow; split/base key dbg-valgrind-leak-static-grow. Source's six local files were read only; no source script was executed. Root separately completed source admission/cold-local SHA/visibility/source-use checks. This original exercise is inspired by persistent realloc buffer teardown, not a claim about a real incident. Source CMake/aarch64/Valgrind requirements are background only. Deterministic allocator callbacks preserve final-block ownership and multi-growth correctness without any board, network, hardware timing or Valgrind. Fixed runtime gcc/make/python3 were probed successfully; no new dependency was installed.

Status CALIBRATED; difficulty UNMEASURED. No Pi/Qwen/real Agent run or hardware result is claimed.

Engineering scope

The project implements process-wide telemetry report assembly: bounded raw/escaped appends, field/integer formatting, reserve, reset, copying and teardown. Candidate file buffer.c; public header, allocator ledger, observer and Makefile are supporting material. All original implementation and public support are task-specific. Effective nonblank/noncomment C/header/necessary Makefile lines are counted once from template (fixtures and repeated data excluded):

  • Makefile: 10
  • ledger.h: 22
  • observe.c: 124
  • buffer.c: 252
  • buffer.h: 31
  • ledger.c: 109

Total: 548. Headers describe real state/API/allocator structures; ledger implements actual allocation accounting; observer decodes inputs and prints observations. No repeated sample expansion or cosmetic formatting is counted.

Independent defects

D1: close discards the live block handle without calling release. Trigger: any successful allocation then close, including the default demo. Public C02/C01 require the final block to be freed and closed state zeroed. only_fix_append retains only D1 and must FAIL. only_fix_release repairs D1 but retains D2.

D2: raw append reserves new fragment length rather than accumulated length and then refuses a valid multi-append to avoid out-of-bounds writes. Trigger: append fragments whose sum exceeds current capacity although the session limit permits it. The default demo uses a single field; D2 requires another publicly allowed scenario. C03/C04/C07 require accumulation and growth. only_fix_release retains only D2 and must FAIL. The defects have separate sites and neither requires memory corruption or exploitation to expose.

Fixture mechanisms

  • gold PASS: geometric bounded resize of the existing allocation, write after successful reserve, final release.
  • valid_allocate_copy PASS: exact-sized allocate-new/copy-old/release-old transaction; never resizes an existing live block. This changes allocation organization, growth algorithm and ownership transfer.
  • template FAIL: both independent defects.
  • noop FAIL: callable API stubs without state/content behavior; builds successfully.
  • cheat FAIL: coerces every signed integer field to 7; hidden runtime values and independently formatted decimal fields reject it.
  • cheat_read_grader FAIL: opens protected /grader/check.py and returns invalid when unavailable; isolated reader failure is required. A local failure proves no host isolation.
  • only_fix_release FAIL: teardown is correct; multi-append still refuses a legal report.
  • only_fix_append FAIL: accumulated append growth is correct; final block remains live.
  • mask_symptom FAIL: resets visible content instead of ending the session or releasing its final allocation.

Every fixture contains only buffer.c. All fixtures are rebuilt with the same public harness; negative outcomes must be behavioral, not compile/link errors.

Exact public evidence mapping

The authority is template/docs/format-buffer.md. The following checks use its exact numbered clauses/lines; no hidden behavior is added.

Oracle behavior Public authority
closed initial snapshot, state errors, legal/invalid limit, reopen, idempotent close docs/format-buffer.md:3 (C01)
live block count/bytes match capacity, no invalid release, final block freed docs/format-buffer.md:5 (C02)
capacity lower bound and upper bound, lazy zero operations, reserve reuse/growth, no shrink docs/format-buffer.md:7 (C03)
exact raw bytes including NUL and high bytes; terminator only at logical boundary docs/format-buffer.md:9 (C04)
ASCII safe-set and uppercase hexadecimal escaping docs/format-buffer.md:11 (C05)
field key validation, delimiters, field counter; signed decimal limits/zero docs/format-buffer.md:13 (C06)
limit/state/invalid/allocation-failure preservation; failure arm consumption docs/format-buffer.md:15 (C07)
reset empties logical data/counter but retains allocation and limit docs/format-buffer.md:17 (C08)
copy length/bytes, insufficient capacity keeps initialized destination/written docs/format-buffer.md:19 (C09)
generated input command meanings and numeric/hex encoding docs/format-buffer.md:21 (C10)
raw output protocol, normal process exit, arbitrary stderr accepted docs/format-buffer.md:23 (C11)

The Python oracle computes byte strings, escaped fields and decimal rendering independently. It never invokes gold to calculate expected results. Capacity is accepted within documented bounds and fed into subsequent growth/failure modeling because the growth strategy is unrestricted. Only logical bytes and their terminator are compared, never unused tails. The public C harness has no expected answers or assertions. Input scenarios cover ordinary operation, limits 0/1/17/48/80/128/256/511/65535, maximum raw data, encoded overflow, reserve/failure/retry, resets, reopen, binary values, copy and fixed-seed varied sequences.

Execution and cleanup contract

All context, candidate and inputs are written before the first child. Thereafter parent accesses memory and pipes only. It never traverses candidate-controlled trees. Compiler, candidate, cleanup and independent strict-lstat absence are argv subprocesses under candidate identity, with production deadlines 30/12/8/8 seconds and eight seconds explicit recovery allowance. A Linux child subreaper owns Popen's real leader, polls/reaps that leader before adopted descendants, discovers the current parent closure plus still-live same-start tracked roots, and signals only current PID/start identities. It handles same-group and setsid/closed-stdio descendants. Strict parent metadata guards reject absent/type/identity/range/status conflicts, nonzero/timeout, exception lists, unreaped leader or non-absence. Cleanup and absence are separately supervised; deletion alone cannot conceal cleanup failure. finally includes preparation failures after scratch creation.

Captured IO is bytes; business stdout is strict ASCII by public protocol and arbitrary stderr is ignored by business comparison. Compact lossless repeat/zlib encoding retains offered stdin and actual captured stdout/stderr with byte lengths and SHA, stage nonce, target argv, supervisor/leader PID/start/rc/elapsed and descendant facts. Parent saves wrapper rc/PID and actual raw wire length/SHA before parsing. Malformed/nonzero-wrapper cases retain wire bytes. The final compressed evidence line is decoded and its raw stream lengths/SHA are verified in actual diagnostics/calibrations; no new stderr byte limit is imposed.

Verification and remaining limits

Task-local ownership/strict-metadata predicate tests cover exited/reused roots and live parent closure with synthetic proc tables. They do not exhaust real PID space or disturb unrelated processes. Fixed-image trusted injected copies retain complete loadable packages, actual check/context/candidate/raw log SHA and production deadlines. Diagnostic matrices and final two five-per-fixture gates are recorded in the author report. Old failures are retained. Full repository tests, independent review and central ledger are root's responsibility. This author does not claim task admission or a measured model difficulty.