Phase 2: Define measured work and packed-storage contracts #622

Merged
erikinkinen merged 2 commits from phase2/p2-05-operation-counters into main 2026-10-20 17:31:06 +02:00
Owner

Task

Closes #88 (P2-05).

Summary

Define the measured work unit before instrumentation: ten unsigned record-access counters with fixed unit weights, explicit invocation/bucket ownership, actual frontier peaks and abstract packed-storage accounting. Overflow and duplicate invocation charges fail without partially changing accounting state.

Scope

Included

  • OperationCountersV1, the seven work buckets, per-invocation meters and conserved ledger totals.
  • Stable counter/bucket column names and one terminal counting point per semantic access.
  • Packed-layout constants, record-type inventories and checked multiplication/aggregation.
  • Analytical and boundary fixtures plus detailed integration rules and acceptance evidence.

Explicitly excluded

  • Connecting actual strategy/access paths to meters; P2-06 owns that integration and its trace conservation.
  • Changing legacy estimated counters or adding production scientific data.

Design intent

An invocation belongs to one bucket and is committed once under its event/ordinal key. Nested helpers share its meter. Reads include unsuccessful lookups; iteration counts returned records, and cached field use does not add a read. Queue/stack peaks use observed entry counts. Packed storage uses declared model widths, including the 56-byte token estimate, independently of host allocation or prototype wire formats.

Phase discipline

Oracle, analytical-history, validation and analysis work stay outside mechanism W. Existing outputs retain their bytes and meanings. Meter contracts cannot certify correct instrumentation by themselves; P2-06 must verify actual call sites against hand-counted traces.

Verification

All 48 CTests pass at the source commit in Debug, Release and Clang 22 ASan/UBSan. Tests check counter positions, field/aggregate overflow, duplicate ownership across buckets, atomic failures, zero-work records, conservation, frontier maxima, all packed widths and frozen layout/count updates. All hooks and archived legacy compatibility fixtures pass.

Commands, logs and JUnit evidence are pinned in artifacts/backlog/2.2.1/P2-05/acceptance.json. All eight exact-head Forgejo checks are required before checklist update and merge.

Notes

Reviewing mutation integration exposed the separate preexisting revocation atomicity defect #621. This contract-only change does not modify those paths; the defect is being repaired before fallible instrumentation is connected to them.

# Task Closes #88 (P2-05). ## Summary Define the measured work unit before instrumentation: ten unsigned record-access counters with fixed unit weights, explicit invocation/bucket ownership, actual frontier peaks and abstract packed-storage accounting. Overflow and duplicate invocation charges fail without partially changing accounting state. ## Scope ### Included - OperationCountersV1, the seven work buckets, per-invocation meters and conserved ledger totals. - Stable counter/bucket column names and one terminal counting point per semantic access. - Packed-layout constants, record-type inventories and checked multiplication/aggregation. - Analytical and boundary fixtures plus detailed integration rules and acceptance evidence. ### Explicitly excluded - Connecting actual strategy/access paths to meters; P2-06 owns that integration and its trace conservation. - Changing legacy estimated counters or adding production scientific data. ## Design intent An invocation belongs to one bucket and is committed once under its event/ordinal key. Nested helpers share its meter. Reads include unsuccessful lookups; iteration counts returned records, and cached field use does not add a read. Queue/stack peaks use observed entry counts. Packed storage uses declared model widths, including the 56-byte token estimate, independently of host allocation or prototype wire formats. ## Phase discipline Oracle, analytical-history, validation and analysis work stay outside mechanism W. Existing outputs retain their bytes and meanings. Meter contracts cannot certify correct instrumentation by themselves; P2-06 must verify actual call sites against hand-counted traces. ## Verification All 48 CTests pass at the source commit in Debug, Release and Clang 22 ASan/UBSan. Tests check counter positions, field/aggregate overflow, duplicate ownership across buckets, atomic failures, zero-work records, conservation, frontier maxima, all packed widths and frozen layout/count updates. All hooks and archived legacy compatibility fixtures pass. [Commands, logs and JUnit evidence](https://git.erikinkinen.fi/attachments/875787e0-25c6-41f0-9449-87021ac4b5b8) are pinned in `artifacts/backlog/2.2.1/P2-05/acceptance.json`. All eight exact-head Forgejo checks are required before checklist update and merge. ## Notes Reviewing mutation integration exposed the separate preexisting revocation atomicity defect #621. This contract-only change does not modify those paths; the defect is being repaired before fallible instrumentation is connected to them.
erikinkinen added this to the Phase 2 milestone 2026-10-20 17:26:18 +02:00
Phase 2: Record P2-05 accounting contract acceptance (#88)
All checks were successful
markdownlint / markdown-lint (pull_request) Successful in 19s
clang-format / check-format (pull_request) Successful in 20s
ci / sanitizers (pull_request) Successful in 4m12s
ci / smoke (pull_request) Successful in 4m14s
markdownlint / markdown-lint (push) Successful in 15s
clang-format / check-format (push) Successful in 16s
ci / sanitizers (push) Successful in 5m4s
ci / smoke (push) Successful in 5m44s
20942a14fe
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erikinkinen/AES!622
No description provided.