amos 4f17b2afe5 Batch 20 (20261027-C-family-20): map batch 15's ad-hoc families to canonical ones
210 batch-15 tasks used 119 ad-hoc family names. Each now carries one of the
canonical root-cause families (11 of the 19 are used), with version + 1 and a
spec.md note, and was recalibrated through both gates. Claude checked that only
family, version and spec.md changed, that every family is canonical, and the
new trace6 Docker receipts against current digests (210/210 USABLE).
Squashed from the 36-local branch batch20-family.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 05:58:17 +08:00

9.5 KiB
Raw Permalink Blame History

resource-watch-instance — route C author specification

Status: CALIBRATED. Difficulty: UNMEASURED. No real Agent sampling, hardware claim, or admission claim.

Source is hwe/gi-leak-inotify-fd-not-closed (base ID and split grouping key). Root verified the unique, unused source and its six-file SHA snapshot before assignment. This original C++17 task uses only its lifecycle direction; it does not reproduce or claim a historical incident. No original script was executed. All business code, public contract, independent oracle, and fixtures were written for this task.

The software replacement preserves the reliability problem: an instance owns several watches and queued observations; releasing watch entries differs from closing the instance, and partial preparation also owns resources. An in-memory event port replaces the Linux monitoring endpoint while retaining quotas, instance identity reuse, automatic watch removal on close, repeated reloads, and transactional failure. There is no board, physical timing, network, or actual filesystem monitoring dependency. The fixed runtime contains g++, gcc, make, and Python; no package installation is required.

The initial project contains a Port ledger, an instance-owning Service, a configuration text parser, and a raw command adapter. Candidate files are watch.hpp, port.cpp, service.cpp, config.cpp. console.cpp is fixed public support: it invokes APIs, initializes publicly documented output sentinels, and prints observations. It contains no expected results or assertions. Its vectors support 16 repeated reload entries, full watch and event maxima, and arbitrary repeated sessions. Template materials are frozen into check.py; the formal candidate contains only the four candidate files.

Two independent defects are present:

  • On a successful reload after the first current instance, the old watches are explicitly removed but their instance remains open. W02/W08 require automatic retirement of that instance and its queued events. The public demo exposes the resource drift. only_fix_success closes that success-path instance but leaves the independent rollback defect.
  • When a later request cannot be added to a newly opened preparation instance, cleanup removes watches but leaves the instance open. This is outside the default valid demo: invalid later requests or global watch quota exhaustion are publicly allowed failure scenarios. W07 requires releasing that preparation instance while preserving the old current instance, normalized configuration, and pending events. only_fix_rollback fixes only that path and still fails the success path.

The gold implementation uses explicit prepare, release, and commit operations. valid_alternative uses scope-owned Lease resources, automatically retires uncommitted instances on all returns, and normalizes duplicate keys with a map plus first-seen ordering. It does not call gold and changes both ownership/control flow and configuration organization.

The independent Python oracle maintains dictionaries of instance/watch records and independent FIFO lists; it computes each result directly from the public contract, never by running a reference implementation. Seed 0x99c105e fixes the generated input. There are 630 observed command rows, including public demo regression, 30 reload cycles, 16 repeated requests, 17-item error, empty loads, partial failure and preserved pending events, all eight fd slots, reuse, full 32-watch quota, exact quota, multi-instance atomic event overflow at 64, partial and zero reads, error precedence, invalid fd/wd, normalized duplicate order, uint64 cookies, 200 randomized stateful commands, and configuration parsing boundaries.

Every behavior comparison maps to these exact public lines:

Judged behavior Public basis
Initial state, API signatures and C++17 linkage template/docs/contract.md:3 (W01), template/watch.hpp:1
Open/close return codes, lowest free fd, instance limit, automatic watch and queue retirement template/docs/contract.md:4 (W02)
add/remove precedence, key/mask range, duplicate-key replacement, wd sequence and watch quota template/docs/contract.md:5 (W03)
Matching, mask intersection, cookie propagation, event order and atomic queue overflow template/docs/contract.md:6 (W04)
Read/inspect error preservation, zero and max capacity, dequeue order and valid output elements template/docs/contract.md:7 (W05)
Current and cumulative counts, reset, discarded events not delivered template/docs/contract.md:8 (W06)
Reload count bound, empty/repeated entries, preparation ordering, rollback and old-event preservation template/docs/contract.md:9 (W07)
Successful replacement, configuration order/last-mask, idempotent stop and active/read proxy template/docs/contract.md:10 (W08)
Text parsing, comments, horizontal whitespace, decimal syntax/range, 4096-byte/16-item bounds, output preservation template/docs/contract.md:11 (W09)
Valid command grammar and publicly allowed boundary arguments template/docs/contract.md:12 (W10), template/console.cpp:1
Raw stdout rows, ASCII numbers/signs/leading zeros, sentinels, stderr and valid output range template/docs/contract.md:13 (W11)
Rebuild only candidate files with fixed public support template/docs/contract.md:14 (W12), template/Makefile:1

No unused vector capacity or padding is compared. Numeric decoding validates full ASCII tokens, strips arbitrary leading zeroes before integer conversion, and accepts the public signs and horizontal separators. It rejects underscore/vertical whitespace extensions. stderr is captured as bytes without a content or size cap, and diagnostics use explicit UTF-8 replacement only when showing a failed command tail. W09 formatting and destructors are public obligations but are not separately scored through a dedicated observation; no undisclosed assertion is added for them.

Fixture mechanisms:

Fixture Expected Mechanism
gold PASS Explicit instance retirement on success and rollback
template FAIL Both independent lifecycle defects
noop FAIL Rejects every reload without implementing the transaction
cheat FAIL Reports zero emit deliveries despite actual matching events
cheat_read_grader FAIL in Docker Runs correct code only if private check.py can be read; otherwise exits 23
only_fix_success FAIL Success fixed; failed preparation still leaks
only_fix_rollback FAIL Rollback fixed; replaced current instances still leak
mask_symptom FAIL Fakes the visible instance count while resources, cumulative counts and eventual allocation still disagree
valid_alternative PASS Scope-owned resources plus a different normalization representation

check.py is the sole private grader attachment; verify.py is byte-for-byte rollout/bos_verify.py. The parent prepares all files/input before the first child, then uses only in-memory/piped observations. Each compiler/candidate/cleanup/independent absence command runs through a same-identity Linux subreaper. It binds PID/starttime, derives descendant closure from actual ancestry or still-live matching tracked tokens, excludes exited Z/X roots, freshly reads each token immediately before signaling, and calls Popen.poll before adopted-child reaping. Ordinary /proc disappearance includes FileNotFoundError and ProcessLookupError. Every phase records the wrapper rc and raw wire length/SHA before decoding; nonce, argv, actual UID/GID/groups, PID/start, deadline, elapsed, leader rc/reaped, controlled rc, timeout, descendant absence, exception lists and actual captured IO length/SHA are strictly checked. Production deadlines are compiler15s, candidate8s, cleanup5s, absence5s, with bounded reclamation. finally covers preparation failures and all executed paths; same-identity deletion and an independent strict os.lstat absence command must both succeed. Any exception presence or invalid/missing metadata rejects even after success flags were assigned.

Fixed-image core._grade diagnostics retain complete load_task-able actual task copies, bindings, actual stdout/stderr logs with lengths/SHA, and decoded compact metadata in this author's diagnostics directory. First four old diagnostics expose a preparation-directory permission failure (compiler rc1, cleanup rc1, scratch present); those historical records remain and do not prove any intended positive scenario. The corrected version has all four positives PASS, all 16 fault scenarios FAIL, and three 5000-leading-zero/sign positives PASS. Supervisor/wire-mutated cases retain wrapper facts without manufacturing absent inner metadata. The malformed-wire cases intentionally lack complete inner-stage metadata and are reported as such. Fourteen single-task behavioral, numeric, metadata and synthetic proc-graph tests pass; synthetic tests cover reuse/Z roots and fresh-signal checks without real PID exhaustion or unrelated process signaling. No full repository suite was run, per batch ownership contract.

Author review found no dependency on hidden assertions, gold outputs, stale build files, host isolation claims, or board behavior. Final trusted-local (actual FAIL solely for the five permitted reader PASS trials) and fixed-image (PASS) calibration receipts are recorded in report.json; local reader behavior is not evidence of host isolation. Both formal fixture gates must bind the final digest. The only admission state claimed after them is CALIBRATED; independent root review and real sampling remain separate. 族名规范化:linux-resource-lifecycle → resource-lifecycle(2026-10-27)