Skip to content

vox-scaling-policy API Reference (generated)

Crate: vox-scaling-policy · Version: 0.6.0 · Target: Library (lib.rs)

Bounded-resource scaling policy types from the Vox project.

Scaling policy loaded from the repo SSOT contracts/scaling/policy.yaml.

Use [ScalingPolicy::embedded] for stable defaults without I/O. For local overrides in tests, use [ScalingPolicy::from_yaml_str].

DependencyKind
vox-mesh-typesNormal
ModuleDescription
cost_defense—
donations_voxParse, edit, and pretty-print mesh donations.vox policy files (formerly vox-mesh-policy).
mesh_policyAlias for [donations_vox] (former vox-mesh-policy crate surface).
StructDescription
ScalingPolicyFull policy document from SSOT YAML.
FunctionDescription
embeddedPolicy embedded at build time from contracts/scaling/policy.yaml.
from_yaml_strParse policy from YAML (for tests or tooling).
ConstantDescription
SCALING_POLICY_YAML_REPO_PATHRepo-root-relative path to the scaling policy YAML SSOT (for docs, CLI messages, and tooling).
DEFAULT_MENS_RUNS_ROOTCanonical default for Mens/Populi run artifact root (repo-relative).
DEFAULT_MENS_RUNS_LATESTLatest symlink / pointer directory under [DEFAULT_MENS_RUNS_ROOT].
DEFAULT_MENS_RUNS_V1Default training run layout revision under [DEFAULT_MENS_RUNS_ROOT].
DEFAULT_MENS_RUNS_UV_OUTPUTDefault UV / tooling output subdirectory under runs.
DEFAULT_MENS_RUNS_QWEN_QLORADefault QLoRA run directory basename (repo-relative path prefix).
Dependency Topology, diagram 19 nodes, 8 edges: vox-scaling-policy → vox-mesh-types; vox-bounded-fs → vox-scaling-policy; vox-cli → vox-scaling-policy; vox-cli-ci → vox-scaling-policy; vox-cli-research → vox-scaling-policy; vox-code-audit → vox-scaling-policy; vox-integration-tests → vox-scaling-policy; vox-ml-cli → vox-scaling…vox-scaling-policyvox-mesh-typesvox-bounded-fsvox-clivox-cli-civox-cli-researchvox-code-auditvox-integration-testsvox-ml-cli
Diagram source
graph {
direction: right
node vox_scaling_policy: "vox-scaling-policy"
node vox_mesh_types: "vox-mesh-types"
vox_scaling_policy -> vox_mesh_types
node vox_bounded_fs: "vox-bounded-fs"
vox_bounded_fs -> vox_scaling_policy
node vox_cli: "vox-cli"
vox_cli -> vox_scaling_policy
node vox_cli_ci: "vox-cli-ci"
vox_cli_ci -> vox_scaling_policy
node vox_cli_research: "vox-cli-research"
vox_cli_research -> vox_scaling_policy
node vox_code_audit: "vox-code-audit"
vox_code_audit -> vox_scaling_policy
node vox_integration_tests: "vox-integration-tests"
vox_integration_tests -> vox_scaling_policy
node vox_ml_cli: "vox-ml-cli"
vox_ml_cli -> vox_scaling_policy
}
Consumer CrateRole
vox-bounded-fsDirect workspace dependent
vox-cliDirect workspace dependent
vox-cli-ciDirect workspace dependent
vox-cli-researchDirect workspace dependent
vox-code-auditDirect workspace dependent
vox-integration-testsDirect workspace dependent
vox-ml-cliDirect workspace dependent
KindSymbolSignatureSourceDescription
structScalingPolicypub struct ScalingPolicycrates/vox-scaling-policy/src/lib.rs#L31-L45Full policy document from SSOT YAML.
fnembeddedpub fn embedded() -> Selfcrates/vox-scaling-policy/src/lib.rs#L49-L51Policy embedded at build time from contracts/scaling/policy.yaml.
fnfrom_yaml_strpub fn from_yaml_str(s: &str) -> Result<Self, serde_yaml::Error>crates/vox-scaling-policy/src/lib.rs#L54-L56Parse policy from YAML (for tests or tooling).
structcost_defense::CostDefenseConfigpub struct CostDefenseConfigcrates/vox-scaling-policy/src/cost_defense.rs#L24-L44Cost defense policy configuration. Loaded from contracts/scaling/policy.yaml (future) or constructed programmatically. All limits use conservative defaults.
enumcost_defense::CostDefenseRejectionpub enum CostDefenseRejectioncrates/vox-scaling-policy/src/cost_defense.rs#L69-L90Reason a task was rejected by the cost defense layer.
structcost_defense::CostDefenseStatepub struct CostDefenseStatecrates/vox-scaling-policy/src/cost_defense.rs#L94-L103Mutable state tracked by the circuit breaker across tasks.
fncost_defense::record_costpub fn record_cost(&mut self, tenant_id: &str, cost_usd: f64)crates/vox-scaling-policy/src/cost_defense.rs#L107-L114Record a completed task’s cost.
fncost_defense::record_retrypub fn record_retry(&mut self, task_id: &str)crates/vox-scaling-policy/src/cost_defense.rs#L117-L122Record a retry attempt for a task.
fncost_defense::reset_dailypub fn reset_daily(&mut self)crates/vox-scaling-policy/src/cost_defense.rs#L125-L129Reset daily counters (e.g. at midnight).
fncost_defense::reset_monthlypub fn reset_monthly(&mut self)crates/vox-scaling-policy/src/cost_defense.rs#L132-L135Reset monthly counters (e.g. at month boundary).
structcost_defense::CostCircuitBreakerpub struct CostCircuitBreakercrates/vox-scaling-policy/src/cost_defense.rs#L146-L1495-layer cost defense circuit breaker. Call [Self::check_before_task] before dispatching any task. The method returns a list of rejections (empty = task is allowed). Callers should treat any non-empty rejection list as a hard block except for MonthlyPacingWarning which is advisory.
fncost_defense::newpub fn new(config: CostDefenseConfig) -> Selfcrates/vox-scaling-policy/src/cost_defense.rs#L152-L157—
fncost_defense::check_before_taskpub fn check_before_task(crates/vox-scaling-policy/src/cost_defense.rs#L165Run all 5 layers of cost defense checks before dispatching a task. estimated_duration_secs: caller’s estimate of task wall-clock time. task_id: unique identifier for retry tracking. requested_model_tier: the model tier the task wants to use. estimated_cost_usd: estimated incremental cost for this task.
fncost_defense::has_hard_blockpub fn has_hard_block(rejections: &[CostDefenseRejection]) -> boolcrates/vox-scaling-policy/src/cost_defense.rs#L258-L262Returns true if any rejection is a hard block (not just a warning).
fncost_defense::record_task_completionpub fn record_task_completion(&mut self, task_id: &str, tenant_id: &str, actual_cost_usd: f64)crates/vox-scaling-policy/src/cost_defense.rs#L265-L268Record a completed task’s cost and update state.