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>
6.6 KiB
Offline quantized frame contract
-
The project is a C++17 offline decoder for signed int32 sample codes. It requires only g++, make and the standard library.
makebuildsquant-demo;make demofeedsdemo.txt. Onlysrc/engine.cppis submitted. The publicinclude/engine.hppAPI and observer are part of the contract. An equivalent implementation is welcome. Stderr may contain arbitrary diagnostic bytes; stdout alone carries observations. Executions for the finite inputs below terminate normally with code 0. -
A profile maps channel 0..7 to zero point in [-2147483648,2147483647], positive scale in [1e-100,1e100], bias in [-1e100,1e100], and inclusive calibrated lower/upper bounds in [-1e110,1e110] with lower<=upper. All floating inputs are finite decimal values interpreted as binary64. The mathematical decoded value is
scale * (code - zero) + biasthroughout the full int32 code and zero domains. It is represented with binary64 accuracy, including values outside float range and values smaller than float precision. No wrap, saturation of the difference or intermediate float rounding is part of this mapping. Hidden observations accept absolute error <=1e-14 or relative error <=3e-12 for each finite decoded, delivered and statistic value; integer fields are exact. Inputs near threshold rounding ambiguity are avoided. -
At construction and after reset all counters, frame IDs, arrays and vectors are empty/zero. An absent profile has present=false, zero=0, scale=1, bias=0, lower=-1, upper=1, revision=0. Empty statistics have count/outside/sum/minimum/maximum/weighted all zero. Profile updates do not reset accumulated statistics or the previous accepted frame.
-
configurevalidates channel and numeric profile domain first, returning -1 with no mutation on invalid input. It then returns -2 without mutation while a frame is active. Otherwise replace that channel, increment global epoch once, store this epoch as its revision, and increment configured only for a previously absent channel.erasevalidates channel first (-1), rejects active frame (-2), otherwise removes a present profile and increments epoch once; erasing an absent channel succeeds without changing epoch. All successes return 0. -
beginvalidates frame ID in [1,1000000000] first (-1); if already active returns -2; otherwise opens a new empty frame. IDs may repeat.appendvalidates channel first (-1), requires active frame (-2), present profile (-3), and fewer than 32 queued samples (-4), in that order. Successful append stores channel/code in original order and updates pending count; int32 code is unrestricted. Errors leave all state unchanged. -
commitvalidates policy 0..2 first (-1), then requires active frame (-2). It converts every queued sample using that channel's current profile. Policy 0 keeps decoded values; policy 1 rejects the entire frame if any decoded value lies strictly outside the inclusive calibrated interval; policy 2 delivers each decoded value clamped to the interval. The outside flag always describes the original decoded value, including policy 2. A rejected frame increments rejected once, closes the frame, and returns -5; it changes neither statistics nor the previous accepted frame. A successful frame, including empty, increments accepted once, replaces last_frame and last values, accumulates all delivered samples and original outside flags, closes the frame, and returns 0.cancelrequires an active frame (-2 otherwise), increments canceled once, closes it and returns 0 without changing statistics or last accepted values. Closing clears active/frame/pending to false/0/0. -
For each channel, statistics count accepted samples, outside counts their original outside flags, sum sums delivered values, min/max cover those delivered values, and weighted sums
delivered * ordinal, where ordinal is this channel's accepted sample count starting at 1 after reset. Sum and weighted use left-to-right binary64 addition in accepted arrival order; multiplication is binary64. Global samples/outside are corresponding totals. All revisions, queued sample order, accepted value code/channel, and frame IDs are observable.state,profile,statistics, andlastdo not mutate. Invalid query channels return default Profile/Statistics. Only vector elements below its valid size are defined; unused capacity is not specified. Inputs contain at most 4000 commands so every counter and finite statistic fits its declared type. -
Public observer input has one command per LF-terminated line, with tokens separated by C++ classic whitespace (space, TAB, CR, VT, FF). Command names are uppercase:
R;P channel zero scale bias lower upper;D channel;B frame;A channel code;C policy;X;S. Command arity must be exact. Integer tokens consist entirely of optional + or - followed by one or more ASCII decimal digits; leading zeroes are unrestricted. Out-of-domain or malformed arguments to a recognized correctly sized command return -1; an empty line, unknown command or wrong arity returns -9. They do not mutate. Decimal tokens follow[+-]?(digits[.digits?]?|.digits)([eE][+-]?digits)?and must yield finite binary64. The observer checks channel/frame/code/policy lexical domains before calling the API; the API error precedence above still applies. -
After each input line, the observer prints these rows in order, separated into tokens by space or TAB and terminated by LF (an optional CR before LF is allowed). Integer tokens use the same optional sign/leading-zero decimal grammar as input. Floating tokens use the finite decimal grammar in clause 8; any decimal spelling within the clause 2 tolerance is valid. There are no other stdout rows.
S step rc configured epoch accepted rejected canceled samples outside active frame pending last_frame last_sizeis followed, for each channel 0..7, byP step channel present zero scale bias lower upper revisionandT step channel count outside sum minimum maximum weighted; then each current last value in order givesV step index channel code decoded delivered outside revision. Step is the one-based input line number. Bool fields are integer 0/1. Empty last emits no V rows. Stderr has no content or size restriction. -
The observed state must comply with every clause for repeated resets, profile replacement/removal, all policies, all eight channels, empty and full frames, rejected/canceled frames, wide signed differences, tiny/huge scales, decimal bias, and threshold endpoints. Invalid calls preserve state except the explicit whole-frame rejection in clause 6. The fixed observer only prints raw API results; it contains no expected values or assertions.