MoonBit-native feature flag evaluation, targeting, rollout, and explanation toolkit.
///|
test "README example evaluates a static flag" {
let provider = empty_provider().with_bool("demo", true)
let detail = evaluate_bool(provider, "demo", context("user-1"), default=false)
inspect(detail.value, content="true")
inspect(detail.reason, content="static")
}pub(all) struct AuditIssue {
key : String
code : String
severity : AuditSeverity
message : String
} derive(Eq, Debug)pub(all) struct AuditReport {
total_flags : Int
errors : Int
warnings : Int
infos : Int
issues : Array[AuditIssue]
} derive(Debug)pub(all) struct BatchResult {
evaluations : Array[ValueEvaluation]
stats : BatchStats
reason_counts : Map[String, Int]
} derive(Debug)pub(all) struct CompatibilityReport {
level : CompatibilityLevel
diff : ProviderDiff
message : String
} derive(Debug)pub(all) struct DeploymentDecision {
allowed : Bool
health : ProviderHealth
compatibility : CompatibilityReport?
reason : String
} derive(Debug)fn EvalContext::with_attrs(self : EvalContext, attributes : Array[(String, FlagValue)]) -> EvalContextpub(all) struct EvaluationScenario {
name : String
requests : Array[EvaluationRequest]
contexts : Array[EvalContext]
} derive(Debug)fn[P : FeatureProvider] EvaluationScenario::run(self : EvaluationScenario, provider : P) -> ScenarioReportpub(all) struct ExposureReport {
rows : Map[String, ExposureRow]
samples : Int
requests : Int
} derive(Debug)fn ExposureReport::assess(self : ExposureReport, threshold : ExposureThreshold) -> ExposureAssessmentpub(all) struct PolicyReport {
provider_fingerprint : String
violations : Array[PolicyViolation]
} derive(Debug)impl FeatureProvider for Providerpub(all) struct ProviderHealth {
status : HealthStatus
audit : AuditReport
policy : PolicyReport
inventory : ProviderInventory
message : String
} derive(Debug)pub(all) struct ProviderRegistry {
snapshots : Map[String, ProviderSnapshot]
active_name : String?
} derive(Debug)pub(all) struct ReleaseChange {
key : String
kind : String
risk : ReleaseRisk
message : String
} derive(Eq, Debug)pub(all) struct ReleaseMetadata {
owner : String
change_ticket : String
environment : ReleaseEnvironment
} derive(Eq, Debug)pub(all) struct ReleasePlan {
metadata : ReleaseMetadata
next : Provider
previous : Provider?
health : ProviderHealth
compatibility : CompatibilityReport?
changes : Array[ReleaseChange]
risk : ReleaseRisk
approval : ReleaseApproval
allowed : Bool
} derive(Debug)fn RolloutDistribution::within_tolerance(self : RolloutDistribution, tolerance_basis_points : Double) -> Boolpub(all) struct ScenarioReport {
name : String
contexts : Int
requests_per_context : Int
total : Int
matches : Int
defaults : Int
disabled : Int
target_misses : Int
rollout_misses : Int
type_mismatches : Int
ledger : DecisionLedger
} derive(Debug)fn analyze_exposure(provider : Provider, requests : Array[ExposureRequest], contexts : Array[EvalContext]) -> ExposureReportfn deployment_check(previous : Provider?, next : Provider, policy : ProviderPolicy) -> DeploymentDecisionfn[P : FeatureProvider] evaluate_batch(provider : P, requests : Array[EvaluationRequest], ctx : EvalContext) -> BatchResultfn[P : FeatureProvider] evaluate_bool(provider : P, flag_key : String, ctx : EvalContext, default~ : Bool) -> BoolEvaluationfn[P : FeatureProvider] evaluate_double(provider : P, flag_key : String, ctx : EvalContext, default~ : Double) -> DoubleEvaluationfn[P : FeatureProvider] evaluate_int(provider : P, flag_key : String, ctx : EvalContext, default~ : Int) -> IntEvaluationfn[P : FeatureProvider] evaluate_string(provider : P, flag_key : String, ctx : EvalContext, default~ : String) -> StringEvaluationfn[P : FeatureProvider] evaluate_value(provider : P, flag_key : String, ctx : EvalContext, default~ : FlagValue) -> ValueEvaluationfn[P : FeatureProvider] evaluate_with_ledger(provider : P, requests : Array[EvaluationRequest], ctx : EvalContext, ledger : DecisionLedger) -> BatchResultfn measure_rollout(flag_key : String, targeting_keys : Array[String], percentage : Int) -> RolloutDistributionfn plan_release(previous : Provider?, next : Provider, environment~ : ReleaseEnvironment, policy~ : ProviderPolicy, owner~ : String, change_ticket~ : String) -> ReleasePlanfn release_metadata(owner : String, change_ticket : String, environment : ReleaseEnvironment) -> ReleaseMetadatafn rollout_matches(flag_key : String, targeting_key : String, percentage : Int) -> Boolfn rollout_percentage_for(flag_key : String, targeting_key : String) -> Intfn scenario(name : String, requests : Array[EvaluationRequest], contexts : Array[EvalContext]) -> EvaluationScenarioMoonBit-native feature flag evaluation, targeting, rollout, and explanation toolkit.