Expand description
Unit-conversion constants shared workspace-wide.
Every crate that mixes seconds/milliseconds or dollars/micro-dollars must
use these names rather than open-coding the conversion factors — a
misplaced 1_000 vs 1_000_000 was a real class of bug in earlier
rounds of this review.
Constants§
- COST_
MICROS_ MAX - Upper bound for cumulative
cost_usd_microscounters, aligned withav_atif::validate::MAX_COST_USD(9e9 USD). Introduced in R69 to close R64 F3: the recovery folds inav-harness/src/worker.rsgatedcost_usd_microsonav_core::error::JCS_SAFE_MAX(2^53 = ~$9.007e9 micro-scaled), while the strict ATIF validator refuses anytotal_cost_usd > 9e9. The $7.2M gap between the two ceilings (JCS_SAFE_MAX / USD_MICROS_PER_DOLLAR = 9,007,199 USD past 9e9) meant a hostile / drift-authenticated journal replay whose summed costs landed in the window would fold cleanly through recovery (fold says “safe”), then the very nextav_atif::write_atomiccall would strict-refuse the trajectory — the session became un-writable across every reconciler tick. Tightening the fold cost cap to9e9 * USD_MICROS_PER_DOLLAR = 9e15 micros(still safely belowJCS_SAFE_MAX = 9.007e15) means any cost that passes the fold also passes ATIF strict validation. - MS_
PER_ DAY - Milliseconds per day.
- MS_
PER_ HOUR - Milliseconds per hour.
- MS_
PER_ SEC - Milliseconds per second.
- SECS_
PER_ DAY - Seconds per day.
- USD_
MICROS_ PER_ DOLLAR - USD micro-units per dollar. All internal cost bookkeeping stays in
micro-USD (
u64) to keep every arithmetic step in exact integers; only wire-facing serialization converts to floating point.