Skip to main content

Module cost_unit

Module cost_unit 

Source
Expand description

ADR-103 Amendment 1: deterministic cost_unit for the per-dispatch audit-row resource payload enrichment.

cost_unit = base_weight(verb) + per_item_weight(verb) x item_count x model_count, computed with checked i64 arithmetic and clamped to i64::MAX on overflow rather than omitted (ADR-103 Amendment 1 Part 1).

Amendment 1 commits only to the formula’s shape and to per_item_weight(verb) = 0 for every verb outside its closed embedding-bearing family. The base_weight / per_item_weight magnitudes are left as “deterministic, hand-set constants … fixed at implementation time and not measured”. This module ships base_weight = 1 uniformly across every verb and per_item_weight = 1 for every embedding-bearing verb, as the documented default pending a dedicated per-verb weights table (see the PR body that introduced this module).

Functions§

base_resource_payload
Build the resource payload object for a dispatch that did not resolve Ok: {"work_class": "interactive"}, with no cost_unit key.
cost_unit_for_dispatch
Compute resource.cost_unit for one successful dispatch.
resource_payload
Build the resource payload object, {"work_class": "interactive", "cost_unit": N}, for one successful verb dispatch.