lightspeed/tenant/policy
Tenant isolation and policy runtime contracts (M29/M52 expansion).
Types
Policy action category.
pub type Action {
Read(resource_tenant_id: String)
Write(resource_tenant_id: String)
Delete(resource_tenant_id: String)
EmitEvent(units: Int)
OpenSession(units: Int)
StartJob(units: Int)
StartPipelineRun(units: Int)
ReplayPipelineRun(units: Int)
ApplyMitigation(mitigation: Mitigation, units: Int)
}
Constructors
-
Read(resource_tenant_id: String) -
Write(resource_tenant_id: String) -
Delete(resource_tenant_id: String) -
EmitEvent(units: Int) -
OpenSession(units: Int) -
StartJob(units: Int) -
StartPipelineRun(units: Int) -
ReplayPipelineRun(units: Int) -
ApplyMitigation(mitigation: Mitigation, units: Int)
Per-tenant budget configuration.
pub type Budget {
Budget(
max_events: Int,
max_sessions: Int,
max_jobs: Int,
max_pipeline_runs: Int,
max_pipeline_replays: Int,
max_mitigations: Int,
)
}
Constructors
-
Budget( max_events: Int, max_sessions: Int, max_jobs: Int, max_pipeline_runs: Int, max_pipeline_replays: Int, max_mitigations: Int, )
Decision class for full audit traceability.
pub type DecisionKind {
AllowedDecision
DeniedDecision
MitigatedDecision
}
Constructors
-
AllowedDecision -
DeniedDecision -
MitigatedDecision
Decision telemetry emitted for allow/deny/mitigate outcomes.
pub type DecisionTelemetry {
DecisionTelemetry(
actor_id: String,
tenant_id: String,
surface: Surface,
action: Action,
decision: DecisionKind,
reason: String,
usage: Usage,
budget: Budget,
)
}
Constructors
-
DecisionTelemetry( actor_id: String, tenant_id: String, surface: Surface, action: Action, decision: DecisionKind, reason: String, usage: Usage, budget: Budget, )
Tenant containment mitigation strategy.
pub type Mitigation {
ThrottleEvents
PausePipelines
IsolateTenant
}
Constructors
-
ThrottleEvents -
PausePipelines -
IsolateTenant
Policy evaluation result.
pub type Outcome {
Allowed(reason: String)
Denied(denial: DenialTelemetry)
}
Constructors
-
Allowed(reason: String) -
Denied(denial: DenialTelemetry)
Tenant-scoped role for runtime/data policy checks.
pub type Role {
Viewer
Editor
TenantAdmin
}
Constructors
-
Viewer -
Editor -
TenantAdmin
Runtime
opaqueTenant policy runtime state.
pub opaque type Runtime
Policy decision surface.
pub type Surface {
RuntimeSurface
DataSurface
PipelineSurface
PolicySurface
}
Constructors
-
RuntimeSurface -
DataSurface -
PipelineSurface -
PolicySurface
Current per-tenant budget usage.
pub type Usage {
Usage(
events: Int,
sessions: Int,
jobs: Int,
pipeline_runs: Int,
pipeline_replays: Int,
mitigations: Int,
)
}
Constructors
-
Usage( events: Int, sessions: Int, jobs: Int, pipeline_runs: Int, pipeline_replays: Int, mitigations: Int, )
Values
pub fn budget(
max_events: Int,
max_sessions: Int,
max_jobs: Int,
) -> Budget
Build one budget.
pub fn decision_kind_label(decision: DecisionKind) -> String
Stable decision-kind label.
pub fn decision_label(entry: DecisionTelemetry) -> String
Stable decision-telemetry label.
pub fn decision_metric(
entry: DecisionTelemetry,
) -> telemetry.Metric
Convert one decision telemetry event into a counter metric.
pub fn decisions(runtime: Runtime) -> List(DecisionTelemetry)
Runtime decisions in stable order.
pub fn denial_metric(denial: DenialTelemetry) -> telemetry.Metric
Convert one denial telemetry event into a counter metric.
pub fn evaluate(
runtime: Runtime,
action: Action,
) -> #(Runtime, Outcome)
Evaluate one policy action.
pub fn expanded_budget(
max_events: Int,
max_sessions: Int,
max_jobs: Int,
max_pipeline_runs: Int,
max_pipeline_replays: Int,
max_mitigations: Int,
) -> Budget
Build one expanded budget profile for runtime/data/pipeline controls.
pub fn expanded_budget_label(budget: Budget) -> String
Stable expanded budget label for M52 cross-surface policy evidence.
pub fn expanded_usage_label(usage: Usage) -> String
Stable expanded usage label for M52 cross-surface policy evidence.
pub fn repository_scope(context: Context) -> repository.Scope
Convert context to data repository scope.
pub fn telemetry_tags(context: Context) -> List(telemetry.Tag)
Emit telemetry tags for one context.