ReviewOS

zig-utils/zig-js

Bench: preserve Shape counters in tier-attribution artifacts

#844
Closed chris opened this 9 days ago ·
9 days ago

Parent: #531 Related: #461, #532

Problem

bench/comparison_zig_js.zig emits an exact shape counter map in every zig-js-tier-attribution snapshot (transition_requests, transition_hits, transition_misses, and transition_lock_yields). The current tools/representative-tier-attribution.ts model, inventory validation, delta reduction, synthetic fixtures, and Markdown renderer omit that map.

The omission is silent: raw runner JSON contains the counters, but the accepted representative artifact drops them. This prevents the standard evidence path from proving #531 request/miss and writer-yield boundaries and makes a one-off report tempting. The fix belongs in the shared attribution pipeline.

Scope

  • Add the exact Shape counter map to snapshot/delta types and the frozen inventory validation.
  • Preserve it through configuration/warmup/invocation subtraction and checkpoint/resume artifacts.
  • Reject missing, extra, non-integral, regressing, or incoherent counters (requests = hits + misses). Treat lock yields as an independent spin-pressure counter: one contended transition can yield repeatedly.
  • Render Shape attribution for relevant shared rows without changing any scored timing boundary.
  • Extend harness self-tests, dependency inventory, docs methodology, and manifest versioning as required.

Acceptance

  • Synthetic self-tests reject missing, extra, regressing, and incoherent Shape maps.
  • Native runner self-test plus representative attribution quick collection retain exact Shape maps in raw JSON and report them in Markdown.
  • Existing timing/checksum/tier/synchronization/allocation/GC/RSS gates remain unchanged.
  • #531 can consume the standard generated output; no hand-authored or benchmark-specific counter path is added.

Security boundary

Property names are attacker-controlled. Shape lock/contention evidence must keep exact-key publication and secure collision behavior visible; missing counters must fail closed rather than be interpreted as zero.

9 days ago

Completed by a6feac57, on top of coherent snapshot #845 and complete cell-lifetime accounting #846. The final quick collector accepted 510/510 V33 snapshots, preserved the exact four-key Shape map, enforced requests = hits + misses, and generated the Shared-realm Shape publication report. Matrix tests pass 73/73, benchmark harness tests 18/18, benchmark-comparison-test and all docs/dependency gates pass, and the full unit suite reports 2,239 passed, 1 expected skip, 0 failed, 0 leaked.

Sign in to comment on this issue.