Dimensional Analysis as Reliability Infrastructure
You already have a type system for code.
Your configs are untyped.
YAML doesn't know that 30 means seconds.
Python doesn't know that 512 means megabytes.
Your SLO dashboard doesn't know if 0.999 is a ratio or a percentage.
These aren't edge cases. They're the default failure mode of config-driven infrastructure.
timeout: 30 — but the downstream expects millisecondsint(config["timeout"]) → 30ms timeout → cascading failures → SEV-1config.timeout.to(millisecond) → <30000 ms> → correct behaviorYour SLO is 3.5 nines.
A deploy just caused 90 seconds of errors.
What percentage of your weekly error budget did you burn?
ucon says:
# Same dimension → converts
millisecond = Scale.milli * units.second
t1 = units.second(30)
t1.to(millisecond)
# <30000 ms>
# Memory units
megabyte = Scale.mega * units.byte
gibibyte = Scale.gibi * units.byte
m = megabyte(512)
m.to(gibibyte)
# <0.477 GiB>
# Timeout + memory? No.
megabyte = Scale.mega * units.byte
t = units.second(30)
m = megabyte(512)
t + m
# DimensionMismatch: time + information
# Caught instantly.
# Not at 3 AM.
from pydantic import BaseModel
from ucon import units, Scale, Number, Dimension
megabyte = Scale.mega * units.byte
class ServiceConfig(BaseModel):
timeout: Number[Dimension.time]
memory: Number[Dimension.information]
slo_target: Number[Dimension.ratio]
# ✅ Valid — units are explicit
cfg = ServiceConfig(
timeout=units.second(30),
memory=megabyte(512),
slo_target=units.nines(3.5),
)
# ❌ Fails — wrong dimension at parse time
ServiceConfig(timeout=megabyte(30), ...)
# ValidationError: timeout must be time, got information
Your configs live in YAML. ucon meets them there.
# Plain YAML — no magic
timeout:
value: 30
unit: "second"
memory:
value: 512
unit: "MB"
slo_target:
value: 3.5
unit: "nines"
import yaml
with open("service.yaml") as f:
raw = yaml.safe_load(f)
# Pydantic parses + validates
cfg = ServiceConfig.from_yaml(raw)
cfg.timeout # <30 s>
cfg.timeout.to(ms) # <30000 ms>
cfg.slo_target.to(pct) # <99.968 %>
# Someone puts memory in the timeout field
timeout:
value: 512
unit: "MB" # ← wrong dimension
# ValidationError: timeout must be time, got information
# Caught at load time. Before deploy. Before 3 AM.
Half your code is now AI-assisted.
The configs are no exception.
AI agents are generating configs, autoscaling parameters, and IaC at scale. They make the same unit mistakes humans do — but faster, more confidently, and without the gut check.
meter / second → velocityNumeric type safety for infrastructure quantities.
Questions?