moonfeaturegate

MoonBit-native feature flag evaluation, targeting, rollout, and explanation toolkit.

feature-flags
rollout
configuration
moonbit
osc-2026
moon add wccerty/moonfeaturegate@0.1.3
Download zip
Author
Version
0.1.3
License
Apache-2.0
Last updated
3 days ago
Downloads
17
README

#MoonFeatureGate

MoonFeatureGate is a MoonBit-native feature flag and gradual rollout toolkit. It evaluates flags locally, keeps rollout decisions deterministic, and returns an explanation for every decision.

///|
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")
}

#
FeatureProvider

pub trait FeatureProvider {
fn get_flag_definition(self : Self, key : String) -> FlagDefinition?
}

#
ParseError

pub(all) suberror ParseError {
InvalidLine(line~ : Int, text~ : String)
} derive(Eq,
Debug
)

#
AuditIssue

pub(all) struct AuditIssue {
key : String
code : String
severity : AuditSeverity
message : String
} derive(Eq,
Debug
)

#
AuditReport

pub(all) struct AuditReport {
total_flags : Int
errors : Int
warnings : Int
infos : Int
issues : Array[AuditIssue]
} derive(
Debug
)

#
AuditReport::has_warnings

fn AuditReport::has_warnings(self : AuditReport) -> Bool

#
AuditReport::is_clean

fn AuditReport::is_clean(self : AuditReport) -> Bool

#
AuditReport::issue_count

fn AuditReport::issue_count(self : AuditReport, severity : AuditSeverity) -> Int

#
AuditReport::render

fn AuditReport::render(self : AuditReport) -> String

#
AuditReport::summary

fn AuditReport::summary(self : AuditReport) -> String

#
AuditSeverity

pub(all) enum AuditSeverity {
Info
Warning
Error
} derive(Eq,
Debug
)

#
BatchResult

pub(all) struct BatchResult {
evaluations : Array[ValueEvaluation]
stats : BatchStats
reason_counts : Map[String, Int]
} derive(
Debug
)

#
BatchResult::has_failures

fn BatchResult::has_failures(self : BatchResult) -> Bool

#
BatchResult::reason_count

fn BatchResult::reason_count(self : BatchResult, reason : String) -> Int

#
BatchResult::successful_ratio

fn BatchResult::successful_ratio(self : BatchResult) -> Double

#
BatchResult::summary

fn BatchResult::summary(self : BatchResult) -> String

#
BatchStats

pub(all) struct BatchStats {
total : Int
successes : Int
defaults : Int
disabled : Int
target_misses : Int
rollout_misses : Int
type_mismatches : Int
} derive(Eq,
Debug
)

#
BenchmarkCase

pub(all) struct BenchmarkCase {
name : String
key : String
value : FlagValue
default_value : FlagValue
rollout_percentage : Int?
target_attr : String?
target_value : FlagValue?
} derive(
Debug
)

A production-shaped fixture set used by the benchmark and acceptance report. These cases represent the kinds of flags a service commonly owns: release gates, experiments, regional policy, safety switches, and capacity controls. They are deterministic and contain no customer data.

#
BenchmarkReport

pub(all) struct BenchmarkReport {
scenarios : Int
rounds : Int
total_requests : Int
successful_evaluations : Int
defaulted_evaluations : Int
type_mismatches : Int
successful_ratio : Double
} derive(Eq,
Debug
)

#
BoolEvaluation

pub(all) struct BoolEvaluation {
flag_key : String
value : Bool
reason : String
} derive(Eq,
Debug
)

#
CompatibilityLevel

pub(all) enum CompatibilityLevel {
Identical
Additive
Changed
Breaking
} derive(Eq,
Debug
)

Compatibility classification for configuration deployments. It provides a reviewable answer to the common question: can this provider replace the previous one without making existing flag lookups disappear?

#
CompatibilityReport

pub(all) struct CompatibilityReport {
level : CompatibilityLevel
diff : ProviderDiff
message : String
} derive(
Debug
)

#
CompatibilityReport::is_safe

fn CompatibilityReport::is_safe(self : CompatibilityReport) -> Bool

#
CompatibilityReport::requires_replay

fn CompatibilityReport::requires_replay(self : CompatibilityReport) -> Bool

#
CompatibilityReport::summary

fn CompatibilityReport::summary(self : CompatibilityReport) -> String

#
DecisionLedger

pub(all) struct DecisionLedger {
total : Int
matches : Int
defaults : Int
disabled : Int
target_misses : Int
rollout_misses : Int
type_mismatches : Int
reason_counts : Map[String, Int]
} derive(
Debug
)

A small in-process decision ledger for tests, demos, and service health dashboards. It stores aggregate counters only; no user identifiers are retained, which keeps the default implementation privacy-friendly.

#
DecisionLedger::count

fn DecisionLedger::count(self : DecisionLedger, reason : String) -> Int

#
DecisionLedger::merge

fn DecisionLedger::merge(self : DecisionLedger, other : DecisionLedger) -> Unit

#
DecisionLedger::reason_report

fn DecisionLedger::reason_report(self : DecisionLedger) -> String

#
DecisionLedger::record

fn DecisionLedger::record(self : DecisionLedger, evaluation : ValueEvaluation) -> Unit

#
DecisionLedger::record_batch

fn DecisionLedger::record_batch(self : DecisionLedger, result : BatchResult) -> Unit

#
DecisionLedger::reset

fn DecisionLedger::reset(self : DecisionLedger) -> Unit

#
DecisionLedger::success_ratio

fn DecisionLedger::success_ratio(self : DecisionLedger) -> Double

#
DecisionLedger::summary

fn DecisionLedger::summary(self : DecisionLedger) -> String

#
DeploymentDecision

pub(all) struct DeploymentDecision {
allowed : Bool
health : ProviderHealth
compatibility : CompatibilityReport?
reason : String
} derive(
Debug
)

Deployment decision that combines provider health with compatibility. This is intentionally pure so release automation can use it in CI without network access or process-global state.

#
DeploymentDecision::health_status

fn DeploymentDecision::health_status(self : DeploymentDecision) -> String

#
DeploymentDecision::is_release_ready

fn DeploymentDecision::is_release_ready(self : DeploymentDecision) -> Bool

#
DeploymentDecision::requires_manual_review

fn DeploymentDecision::requires_manual_review(self : DeploymentDecision) -> Bool

#
DeploymentDecision::summary

fn DeploymentDecision::summary(self : DeploymentDecision) -> String

#
DoubleEvaluation

pub(all) struct DoubleEvaluation {
flag_key : String
value : Double
reason : String
} derive(Eq,
Debug
)

#
EvalContext

pub(all) struct EvalContext {
targeting_key : String
attributes : Map[String, FlagValue]
} derive(
Debug
)

#
EvalContext::attribute_count

fn EvalContext::attribute_count(self : EvalContext) -> Int

#
EvalContext::get_attr

fn EvalContext::get_attr(self : EvalContext, key : String) -> FlagValue?

#
EvalContext::has_attr

fn EvalContext::has_attr(self : EvalContext, key : String) -> Bool

#
EvalContext::merge

fn EvalContext::merge(self : EvalContext, overlay : EvalContext) -> EvalContext

#
EvalContext::with_attr

fn EvalContext::with_attr(self : EvalContext, key : String, value : FlagValue) -> EvalContext

#
EvalContext::with_attrs

fn EvalContext::with_attrs(self : EvalContext, attributes : Array[(String, FlagValue)]) -> EvalContext

Adds or replaces a batch of attributes while keeping the original context immutable for callers that need to reuse it across requests.

#
EvalContext::with_targeting_key

fn EvalContext::with_targeting_key(self : EvalContext, targeting_key : String) -> EvalContext

#
EvaluationRequest

pub(all) struct EvaluationRequest {
key : String
default_value : FlagValue
} derive(Eq,
Debug
)

A typed request used by the batch evaluator. The default value also acts as the expected type, so a configuration mistake remains visible instead of being silently converted.

#
EvaluationScenario

pub(all) struct EvaluationScenario {
name : String
requests : Array[EvaluationRequest]
contexts : Array[EvalContext]
} derive(
Debug
)

A scenario is a deterministic set of contexts and typed requests. It makes it possible to replay release decisions in CI, compare two configurations, and publish benchmark evidence without connecting to a remote service.

#
EvaluationScenario::run

#
ExposureAssessment

pub(all) struct ExposureAssessment {
passed : Bool
default_ratio : Double
anomalous_rows : Array[String]
inconsistent_rows : Array[String]
message : String
} derive(
Debug
)

#
ExposureAssessment::is_actionable

fn ExposureAssessment::is_actionable(self : ExposureAssessment) -> Bool

#
ExposureAssessment::summary

fn ExposureAssessment::summary(self : ExposureAssessment) -> String

#
ExposureReport

pub(all) struct ExposureReport {
rows : Map[String, ExposureRow]
samples : Int
requests : Int
} derive(
Debug
)

#
ExposureReport::assess

#
ExposureReport::compact_signature

fn ExposureReport::compact_signature(self : ExposureReport) -> String

A stable, compact signature is useful for comparing two canary samples in logs without serializing every context or flag value.

#
ExposureReport::coverage_percent

fn ExposureReport::coverage_percent(self : ExposureReport) -> Double

#
ExposureReport::default_count

fn ExposureReport::default_count(self : ExposureReport) -> Int

#
ExposureReport::default_ratio

fn ExposureReport::default_ratio(self : ExposureReport) -> Double

#
ExposureReport::difference

fn ExposureReport::difference(self : ExposureReport, other : ExposureReport) -> Array[String]

#
ExposureReport::empty

#
ExposureReport::empty_rows

fn ExposureReport::empty_rows(self : ExposureReport) -> Array[String]

#
ExposureReport::evaluation_count

fn ExposureReport::evaluation_count(self : ExposureReport) -> Int

#
ExposureReport::has_anomalies

fn ExposureReport::has_anomalies(self : ExposureReport) -> Bool

#
ExposureReport::has_requested_key

fn ExposureReport::has_requested_key(self : ExposureReport, key : String) -> Bool

#
ExposureReport::healthy_for_release

fn ExposureReport::healthy_for_release(self : ExposureReport) -> Bool

#
ExposureReport::inconsistent_rows

fn ExposureReport::inconsistent_rows(self : ExposureReport) -> Array[String]

#
ExposureReport::is_representative

fn ExposureReport::is_representative(self : ExposureReport, minimum~ : Int) -> Bool

#
ExposureReport::keys

fn ExposureReport::keys(self : ExposureReport) -> Array[String]

#
ExposureReport::kind_summary

fn ExposureReport::kind_summary(self : ExposureReport) -> String

#
ExposureReport::match_count

fn ExposureReport::match_count(self : ExposureReport) -> Int

#
ExposureReport::merge

#
ExposureReport::passes

fn ExposureReport::passes(self : ExposureReport, threshold : ExposureThreshold) -> Bool

#
ExposureReport::quality_score

fn ExposureReport::quality_score(self : ExposureReport) -> Int

#
ExposureReport::reason_totals

fn ExposureReport::reason_totals(self : ExposureReport) -> Map[String, Int]

#
ExposureReport::recommendation

fn ExposureReport::recommendation(self : ExposureReport) -> String

Produces a human-actionable next step instead of exposing raw counters to an operator who has to interpret them during a release window.

#
ExposureReport::render

fn ExposureReport::render(self : ExposureReport) -> String

#
ExposureReport::request_count

fn ExposureReport::request_count(self : ExposureReport) -> Int

#
ExposureReport::rollout_match_ratio

fn ExposureReport::rollout_match_ratio(self : ExposureReport) -> Double

#
ExposureReport::rollout_rows

fn ExposureReport::rollout_rows(self : ExposureReport) -> Array[ExposureRow]

#
ExposureReport::row

fn ExposureReport::row(self : ExposureReport, key : String) -> ExposureRow?

#
ExposureReport::rows_for_prefix

fn ExposureReport::rows_for_prefix(self : ExposureReport, prefix : String) -> Array[ExposureRow]

#
ExposureReport::rows_with_defaults

fn ExposureReport::rows_with_defaults(self : ExposureReport) -> Array[String]

#
ExposureReport::rows_with_target_misses

fn ExposureReport::rows_with_target_misses(self : ExposureReport) -> Array[String]

#
ExposureReport::rows_with_type_mismatches

fn ExposureReport::rows_with_type_mismatches(self : ExposureReport) -> Array[String]

#
ExposureReport::same_shape

fn ExposureReport::same_shape(self : ExposureReport, other : ExposureReport) -> Bool

#
ExposureReport::sample_count

fn ExposureReport::sample_count(self : ExposureReport) -> Int

#
ExposureReport::targeting_miss_rate

fn ExposureReport::targeting_miss_rate(self : ExposureReport) -> Double

#
ExposureRequest

pub(all) struct ExposureRequest {
key : String
default_value : FlagValue
} derive(Eq,
Debug
)

A request is the smallest unit of an exposure report. Keeping the default value with the request makes reports useful for detecting accidental fallbacks instead of only counting successful flag reads.

#
ExposureRequest::default_kind

fn ExposureRequest::default_kind(self : ExposureRequest) -> String

#
ExposureRequest::key

fn ExposureRequest::key(self : ExposureRequest) -> String

#
ExposureRow

pub(all) struct ExposureRow {
key : String
kind : String
samples : Int
matches : Int
defaults : Int
target_misses : Int
rollout_matches : Int
rollout_misses : Int
type_mismatches : Int
disabled : Int
static_matches : Int
} derive(Eq,
Debug
)

Aggregated observations for one flag over a stable set of request contexts. The counters are mutually informative: matches + defaults equals the number of samples, while the reason counters explain the default path.

#
ExposureRow::default_ratio

fn ExposureRow::default_ratio(self : ExposureRow) -> Double

#
ExposureRow::has_default_path

fn ExposureRow::has_default_path(self : ExposureRow) -> Bool

#
ExposureRow::has_target_misses

fn ExposureRow::has_target_misses(self : ExposureRow) -> Bool

#
ExposureRow::is_consistent

fn ExposureRow::is_consistent(self : ExposureRow) -> Bool

#
ExposureRow::matched_ratio

fn ExposureRow::matched_ratio(self : ExposureRow) -> Double

#
ExposureRow::reason_count

fn ExposureRow::reason_count(self : ExposureRow, reason : String) -> Int

#
ExposureRow::summary

fn ExposureRow::summary(self : ExposureRow) -> String

#
ExposureThreshold

pub(all) struct ExposureThreshold {
max_default_ratio : Double
reject_target_misses : Bool
reject_type_mismatches : Bool
} derive(Eq,
Debug
)

A threshold turns raw exposure data into a deployable gate. It is useful in CI and can also be applied to a canary sample before a production switch.

#
FlagDefinition

pub(all) struct FlagDefinition {
key : String
value : FlagValue
enabled : Bool
rollout_percentage : Int?
target_attr : String?
target_value : FlagValue?
} derive(
Debug
)

#
FlagDefinition::has_target

fn FlagDefinition::has_target(self : FlagDefinition) -> Bool

#
FlagDefinition::is_rollout

fn FlagDefinition::is_rollout(self : FlagDefinition) -> Bool

#
FlagDefinition::usage

#
FlagDefinition::validation_errors

fn FlagDefinition::validation_errors(self : FlagDefinition) -> Array[String]

Returns configuration defects without changing the provider. The JSON parser performs the same checks while the builder API clamps rollout values; this method is useful for provider inspection and diagnostics.

#
FlagDefinition::value_kind

fn FlagDefinition::value_kind(self : FlagDefinition) -> String

#
FlagUsage

pub(all) struct FlagUsage {
key : String
kind : String
rule : String
enabled : Bool
rollout_percentage : Int?
target_attribute : String?
} derive(Eq,
Debug
)

A compact inventory row for documentation, support tooling, and CLI inspection. It deliberately exposes rule shape instead of the flag value.

#
FlagUsage::is_operational

fn FlagUsage::is_operational(self : FlagUsage) -> Bool

#
FlagUsage::label

fn FlagUsage::label(self : FlagUsage) -> String

#
FlagValue

pub(all) enum FlagValue {
BoolValue(Bool)
StringValue(String)
IntValue(Int)
DoubleValue(Double)
} derive(Eq,
Debug
)

#
FlagValue::to_text

fn FlagValue::to_text(self : FlagValue) -> String

#
HealthStatus

pub(all) enum HealthStatus {
Healthy
Warning
Unhealthy
} derive(Eq,
Debug
)

Combined preflight result used before a configuration snapshot is activated. Keeping audit, policy, and inventory together makes acceptance output useful to both reviewers and operators.

#
IntEvaluation

pub(all) struct IntEvaluation {
flag_key : String
value : Int
reason : String
} derive(Eq,
Debug
)

#
JsonProvider

pub struct JsonProvider {
flags : Map[String, FlagDefinition]
} derive(
Debug
)

#
PolicyReport

pub(all) struct PolicyReport {
provider_fingerprint : String
violations : Array[PolicyViolation]
} derive(
Debug
)

#
PolicyReport::is_compliant

fn PolicyReport::is_compliant(self : PolicyReport) -> Bool

#
PolicyReport::render

fn PolicyReport::render(self : PolicyReport) -> String

#
PolicyReport::summary

fn PolicyReport::summary(self : PolicyReport) -> String

#
PolicyReport::violation_count

fn PolicyReport::violation_count(self : PolicyReport) -> Int

#
PolicyViolation

pub(all) struct PolicyViolation {
key : String
code : String
message : String
} derive(Eq,
Debug
)

#
Provider

pub struct Provider {
flags : Map[String, FlagDefinition]
} derive(
Debug
)

#
Provider::activate_if_compliant

fn Provider::activate_if_compliant(self : Provider, policy : ProviderPolicy) -> Provider?

#
Provider::audit

fn Provider::audit(self : Provider) -> AuditReport

#
Provider::check_policy

fn Provider::check_policy(self : Provider, policy : ProviderPolicy) -> PolicyReport

#
Provider::contains

fn Provider::contains(self : Provider, key : String) -> Bool

#
Provider::count_value_kind

fn Provider::count_value_kind(self : Provider, kind : String) -> Int

#
Provider::definitions

fn Provider::definitions(self : Provider) -> Array[FlagDefinition]

#
Provider::describe

fn Provider::describe(self : Provider) -> String

#
Provider::disabled_keys

fn Provider::disabled_keys(self : Provider) -> Array[String]

#
Provider::enabled_keys

fn Provider::enabled_keys(self : Provider) -> Array[String]

#
Provider::fingerprint

fn Provider::fingerprint(self : Provider) -> String

#
Provider::flag_keys

fn Provider::flag_keys(self : Provider) -> Array[String]

#
Provider::has_only_additions

fn Provider::has_only_additions(self : Provider, other : Provider) -> Bool

#
Provider::health_check

fn Provider::health_check(self : Provider, policy : ProviderPolicy) -> ProviderHealth

#
Provider::inventory

fn Provider::inventory(self : Provider) -> ProviderInventory

#
Provider::is_safe

fn Provider::is_safe(self : Provider) -> Bool

#
Provider::keys_with_prefix

fn Provider::keys_with_prefix(self : Provider, prefix : String) -> Array[String]

#
Provider::merge

fn Provider::merge(self : Provider, overlay : Provider) -> Provider

#
Provider::operational_flag_count

fn Provider::operational_flag_count(self : Provider) -> Int

#
Provider::overlay_if_safe

fn Provider::overlay_if_safe(self : Provider, overlay : Provider) -> Provider?

#
Provider::remove

fn Provider::remove(self : Provider, key : String) -> Provider

#
Provider::render_usage

fn Provider::render_usage(self : Provider) -> String

#
Provider::rollout_keys

fn Provider::rollout_keys(self : Provider) -> Array[String]

#
Provider::same_configuration

fn Provider::same_configuration(self : Provider, other : Provider) -> Bool

#
Provider::select

fn Provider::select(self : Provider, keys : Array[String]) -> Provider

#
Provider::static_keys

fn Provider::static_keys(self : Provider) -> Array[String]

#
Provider::stats

fn Provider::stats(self : Provider) -> ProviderStats

#
Provider::targeted_keys

fn Provider::targeted_keys(self : Provider) -> Array[String]

#
Provider::to_dsl

fn Provider::to_dsl(self : Provider) -> String

Returns the provider as the documented, line-oriented DSL. This is useful for review diffs, fixtures, migration scripts, and small command-line tools. The output is deterministic because flag keys are sorted.

#
Provider::usage

fn Provider::usage(self : Provider) -> Array[FlagUsage]

#
Provider::with_bool

fn Provider::with_bool(self : Provider, key : String, value : Bool, enabled? : Bool) -> Provider

#
Provider::with_bool_rollout

fn Provider::with_bool_rollout(self : Provider, key : String, value : Bool, percentage~ : Int, enabled? : Bool) -> Provider

#
Provider::with_bool_target

fn Provider::with_bool_target(self : Provider, key : String, value : Bool, attr~ : String, equals~ : FlagValue, enabled? : Bool) -> Provider

#
Provider::with_definition

fn Provider::with_definition(self : Provider, definition : FlagDefinition) -> Provider

Inserts a fully described definition for adapters and migration tools. Builder helpers remain the preferred safe path for ordinary applications.

#
Provider::with_double

fn Provider::with_double(self : Provider, key : String, value : Double, enabled? : Bool) -> Provider

#
Provider::with_double_rollout

fn Provider::with_double_rollout(self : Provider, key : String, value : Double, percentage~ : Int, enabled? : Bool) -> Provider

#
Provider::with_double_target

fn Provider::with_double_target(self : Provider, key : String, value : Double, attr~ : String, equals~ : FlagValue, enabled? : Bool) -> Provider

#
Provider::with_int

fn Provider::with_int(self : Provider, key : String, value : Int, enabled? : Bool) -> Provider

#
Provider::with_int_rollout

fn Provider::with_int_rollout(self : Provider, key : String, value : Int, percentage~ : Int, enabled? : Bool) -> Provider

#
Provider::with_int_target

fn Provider::with_int_target(self : Provider, key : String, value : Int, attr~ : String, equals~ : FlagValue, enabled? : Bool) -> Provider

#
Provider::with_string

fn Provider::with_string(self : Provider, key : String, value : String, enabled? : Bool) -> Provider

#
Provider::with_string_rollout

fn Provider::with_string_rollout(self : Provider, key : String, value : String, percentage~ : Int, enabled? : Bool) -> Provider

#
Provider::with_string_target

fn Provider::with_string_target(self : Provider, key : String, value : String, attr~ : String, equals~ : FlagValue, enabled? : Bool) -> Provider

#
Provider::with_value

fn Provider::with_value(self : Provider, key : String, value : FlagValue, enabled? : Bool) -> Provider

#
Provider::with_value_rollout

fn Provider::with_value_rollout(self : Provider, key : String, value : FlagValue, percentage~ : Int, enabled? : Bool) -> Provider

#
Provider::with_value_target

fn Provider::with_value_target(self : Provider, key : String, value : FlagValue, attr~ : String, equals~ : FlagValue, enabled? : Bool) -> Provider

#
Provider::without_disabled

fn Provider::without_disabled(self : Provider) -> Provider

#
ProviderDiff

pub(all) struct ProviderDiff {
added : Array[String]
removed : Array[String]
changed : Array[String]
unchanged : Array[String]
} derive(Eq,
Debug
)

#
ProviderDiff::is_compatible

fn ProviderDiff::is_compatible(self : ProviderDiff) -> Bool

#
ProviderDiff::summary

fn ProviderDiff::summary(self : ProviderDiff) -> String

#
ProviderHealth

pub(all) struct ProviderHealth {
status : HealthStatus
audit : AuditReport
policy : PolicyReport
inventory : ProviderInventory
message : String
} derive(
Debug
)

#
ProviderHealth::has_warnings

fn ProviderHealth::has_warnings(self : ProviderHealth) -> Bool

#
ProviderHealth::is_ready

fn ProviderHealth::is_ready(self : ProviderHealth) -> Bool

#
ProviderHealth::render

fn ProviderHealth::render(self : ProviderHealth) -> String

#
ProviderHealth::status_text

fn ProviderHealth::status_text(self : ProviderHealth) -> String

#
ProviderHealth::summary

fn ProviderHealth::summary(self : ProviderHealth) -> String

#
ProviderInventory

pub(all) struct ProviderInventory {
total : Int
bool_flags : Int
string_flags : Int
int_flags : Int
double_flags : Int
static_flags : Int
rollout_flags : Int
targeted_flags : Int
enabled_flags : Int
disabled_flags : Int
} derive(Eq,
Debug
)

#
ProviderInventory::is_balanced

fn ProviderInventory::is_balanced(self : ProviderInventory) -> Bool

#
ProviderInventory::summary

fn ProviderInventory::summary(self : ProviderInventory) -> String

#
ProviderPolicy

pub(all) struct ProviderPolicy {
require_non_empty_keys : Bool
allow_disabled_flags : Bool
allow_zero_rollout : Bool
require_rollout_key_prefix : String?
max_rollout_percentage : Int
} derive(Eq,
Debug
)

Deployment policy used by preflight checks. It lets a service enforce conventions before activating a provider without changing evaluation rules.

#
ProviderPolicy::for_tests

fn ProviderPolicy::for_tests() -> ProviderPolicy

#
ProviderPolicy::production

fn ProviderPolicy::production() -> ProviderPolicy

#
ProviderRegistry

pub(all) struct ProviderRegistry {
snapshots : Map[String, ProviderSnapshot]
active_name : String?
} derive(
Debug
)

#
ProviderRegistry::activate

fn ProviderRegistry::activate(self : ProviderRegistry, name : String) -> ProviderRegistry?

#
ProviderRegistry::active

#
ProviderRegistry::active_provider

fn ProviderRegistry::active_provider(self : ProviderRegistry) -> Provider?

#
ProviderRegistry::contains

fn ProviderRegistry::contains(self : ProviderRegistry, name : String) -> Bool

#
ProviderRegistry::get

fn ProviderRegistry::get(self : ProviderRegistry, name : String) -> ProviderSnapshot?

#
ProviderRegistry::names

fn ProviderRegistry::names(self : ProviderRegistry) -> Array[String]

#
ProviderRegistry::register

#
ProviderRegistry::remove

fn ProviderRegistry::remove(self : ProviderRegistry, name : String) -> ProviderRegistry

#
ProviderRegistry::summary

fn ProviderRegistry::summary(self : ProviderRegistry) -> String

#
ProviderSnapshot

pub(all) struct ProviderSnapshot {
name : String
version : String
provider : Provider
fingerprint : String
audited : Bool
} derive(
Debug
)

An in-memory registry for safely switching between named configurations. Applications can load providers from JSON or a custom source, audit them, and activate a known-good snapshot without changing evaluator call sites.

#
ProviderStats

pub(all) struct ProviderStats {
total : Int
enabled : Int
disabled : Int
rollout : Int
targeted : Int
bool_count : Int
string_count : Int
int_count : Int
double_count : Int
} derive(Eq,
Debug
)

#
ReleaseApproval

pub(all) enum ReleaseApproval {
Pending
Approved(reviewer~ : String)
Rejected(reviewer~ : String, reason~ : String)
} derive(Eq,
Debug
)

#
ReleaseApproval::is_approved

fn ReleaseApproval::is_approved(self : ReleaseApproval) -> Bool

#
ReleaseApproval::label

fn ReleaseApproval::label(self : ReleaseApproval) -> String

#
ReleaseChange

pub(all) struct ReleaseChange {
key : String
kind : String
risk : ReleaseRisk
message : String
} derive(Eq,
Debug
)

A small, deterministic record for explaining why a release was classified as risky. The message is intentionally short enough for CI annotations.

#
ReleaseChange::summary

fn ReleaseChange::summary(self : ReleaseChange) -> String

#
ReleaseEnvironment

pub(all) enum ReleaseEnvironment {
Development
Staging
Canary
Production
} derive(Eq,
Debug
)

Environments describe the operational blast radius of a configuration change. They are deliberately independent from a deployment platform so the same plan can be reviewed locally, in CI, or by a service launcher.

#
ReleaseEnvironment::maximum_risk

#
ReleaseEnvironment::name

fn ReleaseEnvironment::name(self : ReleaseEnvironment) -> String

#
ReleaseEnvironment::requires_approval

fn ReleaseEnvironment::requires_approval(self : ReleaseEnvironment) -> Bool

#
ReleaseMetadata

pub(all) struct ReleaseMetadata {
owner : String
change_ticket : String
environment : ReleaseEnvironment
} derive(Eq,
Debug
)

#
ReleaseMetadata::errors

fn ReleaseMetadata::errors(self : ReleaseMetadata) -> Array[String]

#
ReleasePlan

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
)

#
ReleasePlan::approval_label

fn ReleasePlan::approval_label(self : ReleasePlan) -> String

#
ReleasePlan::approval_steps

fn ReleasePlan::approval_steps(self : ReleasePlan) -> Array[String]

Returns operator-facing steps without performing them. This is suitable for a change ticket or a deployment bot's dry-run output.

#
ReleasePlan::approve

fn ReleasePlan::approve(self : ReleasePlan, reviewer : String) -> ReleasePlan

#
ReleasePlan::audit_ready

fn ReleasePlan::audit_ready(self : ReleasePlan) -> Bool

#
ReleasePlan::change_count

fn ReleasePlan::change_count(self : ReleasePlan) -> Int

#
ReleasePlan::change_summary

fn ReleasePlan::change_summary(self : ReleasePlan) -> String

#
ReleasePlan::changed_keys

fn ReleasePlan::changed_keys(self : ReleasePlan) -> Array[String]

#
ReleasePlan::changes

fn ReleasePlan::changes(self : ReleasePlan) -> Array[ReleaseChange]

#
ReleasePlan::decision

#
ReleasePlan::environment

fn ReleasePlan::environment(self : ReleasePlan) -> ReleaseEnvironment

#
ReleasePlan::guardrails

fn ReleasePlan::guardrails(self : ReleasePlan) -> Array[String]

#
ReleasePlan::has_breaking_change

fn ReleasePlan::has_breaking_change(self : ReleasePlan) -> Bool

#
ReleasePlan::is_approved

fn ReleasePlan::is_approved(self : ReleasePlan) -> Bool

#
ReleasePlan::is_release_ready

fn ReleasePlan::is_release_ready(self : ReleasePlan) -> Bool

#
ReleasePlan::metadata_errors

fn ReleasePlan::metadata_errors(self : ReleasePlan) -> Array[String]

#
ReleasePlan::operator_notes

fn ReleasePlan::operator_notes(self : ReleasePlan) -> Array[String]

#
ReleasePlan::provider_fingerprint

fn ReleasePlan::provider_fingerprint(self : ReleasePlan) -> String

#
ReleasePlan::reject

fn ReleasePlan::reject(self : ReleasePlan, reviewer : String, reason : String) -> ReleasePlan

#
ReleasePlan::render

fn ReleasePlan::render(self : ReleasePlan) -> String

#
ReleasePlan::replay_required

fn ReleasePlan::replay_required(self : ReleasePlan) -> Bool

#
ReleasePlan::requires_manual_approval

fn ReleasePlan::requires_manual_approval(self : ReleasePlan) -> Bool

#
ReleasePlan::reviewer_required

fn ReleasePlan::reviewer_required(self : ReleasePlan) -> Bool

#
ReleasePlan::risk

fn ReleasePlan::risk(self : ReleasePlan) -> ReleaseRisk

#
ReleasePlan::risk_explanation

fn ReleasePlan::risk_explanation(self : ReleasePlan) -> String

#
ReleasePlan::risk_score

fn ReleasePlan::risk_score(self : ReleasePlan) -> Int

#
ReleasePlan::rollback

fn ReleasePlan::rollback(self : ReleasePlan) -> Array[String]

#
ReleasePlan::rollback_fingerprint

fn ReleasePlan::rollback_fingerprint(self : ReleasePlan) -> String?

#
ReleasePlan::stage

fn ReleasePlan::stage(self : ReleasePlan) -> String

#
ReleasePlan::summary

fn ReleasePlan::summary(self : ReleasePlan) -> String

#
ReleaseRisk

pub(all) enum ReleaseRisk {
Low
Medium
High
Critical
} derive(Eq,
Debug
)

#
ReleaseRisk::at_least

fn ReleaseRisk::at_least(self : ReleaseRisk, other : ReleaseRisk) -> Bool

#
ReleaseRisk::name

fn ReleaseRisk::name(self : ReleaseRisk) -> String

#
ReleaseRisk::rank

fn ReleaseRisk::rank(self : ReleaseRisk) -> Int

#
RolloutDistribution

pub(all) struct RolloutDistribution {
samples : Int
matched : Int
requested_percentage : Int
observed_percentage : Double
min_bucket : Int
max_bucket : Int
} derive(Eq,
Debug
)

#
RolloutDistribution::summary

fn RolloutDistribution::summary(self : RolloutDistribution) -> String

#
RolloutDistribution::within_tolerance

fn RolloutDistribution::within_tolerance(self : RolloutDistribution, tolerance_basis_points : Double) -> Bool

#
ScenarioReport

pub(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
)

#
ScenarioReport::is_reproducible

fn ScenarioReport::is_reproducible(self : ScenarioReport) -> Bool

#
ScenarioReport::success_ratio

fn ScenarioReport::success_ratio(self : ScenarioReport) -> Double

#
ScenarioReport::summary

fn ScenarioReport::summary(self : ScenarioReport) -> String

#
StringEvaluation

pub(all) struct StringEvaluation {
flag_key : String
value : String
reason : String
} derive(Eq,
Debug
)

#
ValueEvaluation

pub(all) struct ValueEvaluation {
flag_key : String
value : FlagValue
reason : String
} derive(Eq,
Debug
)

#
ValueEvaluation::is_match

fn ValueEvaluation::is_match(self : ValueEvaluation) -> Bool

#
ValueEvaluation::uses_default

fn ValueEvaluation::uses_default(self : ValueEvaluation) -> Bool

#
acceptance_scenario

fn acceptance_scenario() -> EvaluationScenario

#
analyze_exposure

fn analyze_exposure(provider : Provider, requests : Array[ExposureRequest], contexts : Array[EvalContext]) -> ExposureReport

Analyzes every request/context pair. The evaluator remains the single source of truth, so the report cannot silently diverge from normal application behavior.

#
benchmark_cases

fn benchmark_cases() -> Array[BenchmarkCase]

#
bool_value

fn bool_value(value : Bool) -> FlagValue

#
compare_providers

fn compare_providers(previous : Provider, next : Provider) -> CompatibilityReport

#
context

fn context(targeting_key : String) -> EvalContext

#
default_policy

fn default_policy() -> ProviderPolicy

#
demo_output

fn demo_output() -> String

#
deployment_check

fn deployment_check(previous : Provider?, next : Provider, policy : ProviderPolicy) -> DeploymentDecision

#
diff_providers

fn diff_providers(left : Provider, right : Provider) -> ProviderDiff

#
double_value

fn double_value(value : Double) -> FlagValue

#
empty_context

fn empty_context() -> EvalContext

Creates a context without a stable user key. This is useful for application-wide flags that do not use percentage rollout.

#
empty_provider

fn empty_provider() -> Provider

#
evaluate_batch

fn[P : FeatureProvider] evaluate_batch(provider : P, requests : Array[EvaluationRequest], ctx : EvalContext) -> BatchResult

#
evaluate_bool

fn[P : FeatureProvider] evaluate_bool(provider : P, flag_key : String, ctx : EvalContext, default~ : Bool) -> BoolEvaluation

#
evaluate_double

fn[P : FeatureProvider] evaluate_double(provider : P, flag_key : String, ctx : EvalContext, default~ : Double) -> DoubleEvaluation

#
evaluate_int

fn[P : FeatureProvider] evaluate_int(provider : P, flag_key : String, ctx : EvalContext, default~ : Int) -> IntEvaluation

#
evaluate_string

fn[P : FeatureProvider] evaluate_string(provider : P, flag_key : String, ctx : EvalContext, default~ : String) -> StringEvaluation

#
evaluate_value

fn[P : FeatureProvider] evaluate_value(provider : P, flag_key : String, ctx : EvalContext, default~ : FlagValue) -> ValueEvaluation

#
evaluate_with_ledger

fn[P : FeatureProvider] evaluate_with_ledger(provider : P, requests : Array[EvaluationRequest], ctx : EvalContext, ledger : DecisionLedger) -> BatchResult

#
exposure_request

fn exposure_request(key : String, default_value : FlagValue) -> ExposureRequest

#
int_value

fn int_value(value : Int) -> FlagValue

#
measure_rollout

fn measure_rollout(flag_key : String, targeting_keys : Array[String], percentage : Int) -> RolloutDistribution

#
new_ledger

fn new_ledger() -> DecisionLedger

#
new_registry

fn new_registry() -> ProviderRegistry

#
parse_json_provider

fn parse_json_provider(text : String) -> JsonProvider?

#
parse_provider

fn parse_provider(text : String) -> Provider raise ParseError

#
permissive_exposure_threshold

fn permissive_exposure_threshold() -> ExposureThreshold

#
plan_release

fn plan_release(previous : Provider?, next : Provider, environment~ : ReleaseEnvironment, policy~ : ProviderPolicy, owner~ : String, change_ticket~ : String) -> ReleasePlan

Builds a reviewable release plan. The function does not activate anything; callers must explicitly approve the returned plan and perform activation.

#
release_metadata

fn release_metadata(owner : String, change_ticket : String, environment : ReleaseEnvironment) -> ReleaseMetadata

#
request

fn request(key : String, default_value : FlagValue) -> EvaluationRequest

#
rollout_bucket

fn rollout_bucket(flag_key : String, targeting_key : String) -> Int

#
rollout_buckets

fn rollout_buckets(flag_key : String, targeting_keys : Array[String]) -> Array[Int]

#
rollout_matches

fn rollout_matches(flag_key : String, targeting_key : String, percentage : Int) -> Bool

#
rollout_percentage_for

fn rollout_percentage_for(flag_key : String, targeting_key : String) -> Int

#
run_acceptance_scenario

fn run_acceptance_scenario() -> ScenarioReport

#
run_benchmark

fn run_benchmark() -> String

#
run_scenario_benchmark

fn run_scenario_benchmark() -> BenchmarkReport

#
safe_exposure_threshold

fn safe_exposure_threshold() -> ExposureThreshold

#
scenario

fn scenario(name : String, requests : Array[EvaluationRequest], contexts : Array[EvalContext]) -> EvaluationScenario

#
snapshot

fn snapshot(name : String, version : String, provider : Provider) -> ProviderSnapshot

#
string_value

fn string_value(value : String) -> FlagValue