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>
7.6 KiB
Shared value service contract
L01. This is a deterministic C++17 service. It models resource sharing with integer handles. No board, clock, allocation failure injection, or real pointer lifetime is part of the interface.
L02. Each Store starts empty. reset() empties it, clears release history, and restarts object epochs and event sequences at one.
L03. Owners are integers 0 through 3. Handle values are integers 1 through 16. At most 8 live objects and 16 live handles exist at once.
L04. A handle belongs to exactly one owner and refers to exactly one live object. Each live object has a value in 0 through 1,000,000 and a reference count equal to its live handles.
L05. create(owner,value,out) chooses the smallest free object number (1 through 8) and smallest free handle number, then creates a value and one owner handle. out changes only on success.
L06. retain(handle,owner,out) chooses the smallest free handle for the same object; the new handle belongs to owner. It increases that object's reference count by one. The source handle and value stay valid. out changes only on success.
L07. release(handle,event) removes exactly that handle. If another handle remains, the object and value remain live and event is all zero. If it was the last handle, the object becomes free and event contains sequence, object number, last value, and last owner. Each final release appends one event to history. Sequence numbers increase by one.
L08. Released handle numbers and object numbers may be reused. An object's epoch is a monotonically increasing creation number within one reset, regardless of object number reuse.
L09. transfer(handle,owner) changes the owner of that handle only. It does not change its object, value, reference count, or history. Repeating a transfer to the same owner has no effect.
L10. set_value(handle,value) replaces the object's value for every holder. add_value(handle,delta) adds a signed delta for every holder. The resulting value must stay in 0 through 1,000,000.
L11. view(handle,out) reports handle, object number, owner, shared value, reference count, and epoch. On failure out is untouched.
L12. owner_value_sum(owner,out) sums one value per handle of that owner, so two handles for one object contribute twice. On failure out is untouched.
L13. retain_owner(owner,new_owner,out) takes a snapshot of handles owned by owner in ascending handle order and retains each once for new_owner; it writes the new handles in source order. If the entire batch cannot fit, it fails without effects and leaves out untouched. Newly made handles are not source handles in that call.
L14. release_owner(owner,out) snapshots that owner's handles in ascending handle order and releases each. out contains only final-release events, in release order. An empty owner succeeds and produces an empty result.
L15. transfer_owner(owner,new_owner,out) snapshots source handles in ascending order and transfers them all. out is the count moved. If owners are equal it succeeds with count zero.
L16. add_owner(owner,delta,out) adds delta once to each distinct object with at least one handle owned by that owner. It changes no object if any resulting value would be out of range; on success out is the distinct object count.
L17. totals() reports live handle count, live object count, four owner handle counts, and total final releases since reset. history() reports all final-release events in sequence order.
L18. Invalid handle returns -9; invalid owner, value, or delta outside [-1,000,000,1,000,000] returns -22; exhausted handle/object capacity returns -24; a resulting value outside range returns -34. Success returns zero. Handle validation precedes argument validation in handle methods; other methods validate arguments before capacity.
L19. For failed calls, state and reference outputs remain unchanged. The console prints explicitly initialized placeholders where it has no output value. No operation dereferences a freed pointer; failures are reported through return codes.
L20. The public console reads one command per LF-terminated line (the final line may omit LF). Tokens use ASCII space, tab, carriage return, vertical tab, or form feed as separators. Blank lines and lines whose first token begins with # are ignored. Input integers are base-10 signed 32-bit tokens with optional - and no +; all supplied commands must be syntactically valid. It emits one LF-terminated observation per command.
L21. Commands and observations are: C owner value nonce -> C rc handle_or_nonce; R handle owner nonce -> R rc handle_or_nonce; L handle -> L rc sequence object value last_owner (zero event if no final release or failure); T handle owner, S handle value, A handle delta -> same letter plus rc.
L22. V handle nonce -> V rc handle object owner value references epoch (all six fields equal nonce on failure); O owner nonce -> O rc sum_or_nonce; B owner new_owner -> B rc count new_handle...; X owner -> X rc count event_quadruples....
L23. M owner new_owner nonce -> M rc moved_or_nonce; D owner delta nonce -> D rc changed_or_nonce; K -> K handles objects owner0 owner1 owner2 owner3 releases; H -> H count event_quadruples...; Z -> Z 0 and reset.
L24. Output decimal fields may have an optional + or - sign and any number of leading zeroes, with the same numeric value. Fields are separated by one or more ASCII horizontal whitespace bytes (space, tab, carriage return); lines by LF. Extra stdout records or fields are errors. Stderr is unrestricted diagnostic output and has no business meaning.
L25. The Makefile builds a native observe executable with the fixed image's g++ and make; run it with commands on stdin. Native output does not claim an ARM binary.
L26. clone(handle,owner,out) creates an independent object with the source object's current value, one new handle owned by owner, the smallest free object and handle numbers, and a fresh epoch. Capacity failure has no effects. same_object(first,second,out) reports 1 if both live handles reference one object and 0 otherwise; it validates the first handle before the second and leaves out unchanged on error. Console N handle owner nonce and E first second nonce report N/E rc output_or_nonce.
L27. owner_summary(owner,out) reports the owner's handle count, distinct referenced object count, sum per handle, minimum and maximum distinct object values, and oldest distinct object epoch. An empty owner yields six zero fields. Error leaves out untouched. Console Q owner nonce reports Q rc handles objects sum minimum maximum oldest_epoch; all six fields are nonce on error.
L28. compare_exchange(handle,expected,desired,matched,observed) validates both values within 0 through 1,000,000. It reports the old shared value in observed; if equal to expected, it writes desired and reports matched=1, otherwise leaves value and reports matched=0. Invalid call leaves both outputs untouched. Console J handle expected desired nonce reports J rc matched_or_nonce observed_or_nonce.
L29. rotate_owners(steps,out) accepts steps 0 through 3. Zero is a no-op with moved count zero; otherwise every live handle moves from owner x to (x+steps)%4 and moved count is the number of handles. Values and object counts do not change. Invalid call leaves output untouched. Console Y steps nonce reports Y rc moved_or_nonce.
L30. release_object(handle,out) snapshots every handle referencing that handle's object in ascending handle order and releases all of them. It reports the single final-release event. Invalid handle leaves out untouched. Console F handle reports F rc count event_quadruples....