fluid-core/internal/contract/experiment_gen.go

109 lines
5.5 KiB
Go
Raw Normal View History

// Code generated by tools/schemagen. DO NOT EDIT.
// Source: schemas/. Regenerate with `make generate`.
package contract
type FluidExperimentAmendmentsItem struct {
Actor Actor `json:"actor" yaml:"actor"`
At Timestamp `json:"at" yaml:"at"`
Change string `json:"change" yaml:"change"`
Reason string `json:"reason" yaml:"reason"`
}
type FluidExperimentMechanism string
const (
FluidExperimentMechanismSandbox FluidExperimentMechanism = "sandbox"
FluidExperimentMechanismShadow FluidExperimentMechanism = "shadow"
FluidExperimentMechanismSynthetic FluidExperimentMechanism = "synthetic"
FluidExperimentMechanismReplay FluidExperimentMechanism = "replay"
FluidExperimentMechanismCanary FluidExperimentMechanism = "canary"
FluidExperimentMechanismOptIn FluidExperimentMechanism = "opt_in"
FluidExperimentMechanismCohort FluidExperimentMechanism = "cohort"
FluidExperimentMechanismTenant FluidExperimentMechanism = "tenant"
FluidExperimentMechanismPercentage FluidExperimentMechanism = "percentage"
)
// Valid reports whether v is a defined FluidExperimentMechanism.
func (v FluidExperimentMechanism) Valid() bool {
switch v {
case FluidExperimentMechanismSandbox, FluidExperimentMechanismShadow, FluidExperimentMechanismSynthetic, FluidExperimentMechanismReplay, FluidExperimentMechanismCanary, FluidExperimentMechanismOptIn, FluidExperimentMechanismCohort, FluidExperimentMechanismTenant, FluidExperimentMechanismPercentage:
return true
}
return false
}
// Primary metrics and guardrails are kept distinct so a scalar can never hide a
// regression (ArchitectureBlueprint.md section 48.5).
type FluidExperimentMetrics struct {
Guardrails []string `json:"guardrails,omitempty" yaml:"guardrails,omitempty"`
Learning []string `json:"learning,omitempty" yaml:"learning,omitempty"`
Primary []string `json:"primary" yaml:"primary"`
Secondary []string `json:"secondary,omitempty" yaml:"secondary,omitempty"`
}
type FluidExperimentResultState string
const (
FluidExperimentResultStatePLANNED FluidExperimentResultState = "PLANNED"
FluidExperimentResultStateRUNNING FluidExperimentResultState = "RUNNING"
FluidExperimentResultStateSTOPPED FluidExperimentResultState = "STOPPED"
FluidExperimentResultStateCOMPLETED FluidExperimentResultState = "COMPLETED"
FluidExperimentResultStateABANDONED FluidExperimentResultState = "ABANDONED"
)
// Valid reports whether v is a defined FluidExperimentResultState.
func (v FluidExperimentResultState) Valid() bool {
switch v {
case FluidExperimentResultStatePLANNED, FluidExperimentResultStateRUNNING, FluidExperimentResultStateSTOPPED, FluidExperimentResultStateCOMPLETED, FluidExperimentResultStateABANDONED:
return true
}
return false
}
type FluidExperimentResult struct {
EvidenceRefs []EvidenceRef `json:"evidence_refs,omitempty" yaml:"evidence_refs,omitempty"`
PreferredRevision *RevisionID `json:"preferred_revision,omitempty" yaml:"preferred_revision,omitempty"`
State FluidExperimentResultState `json:"state" yaml:"state"`
StoppedReason *string `json:"stopped_reason,omitempty" yaml:"stopped_reason,omitempty"`
}
type FluidExperiment struct {
// Shares by revision id or by the reserved key 'control'. Allocation is
// deterministic and enacted by the router, never by this record.
Allocation map[string]UnitInterval `json:"allocation" yaml:"allocation"`
// Success criteria may not be changed after results are visible without recording
// the amendment (ArchitectureBlueprint.md section 18).
Amendments []FluidExperimentAmendmentsItem `json:"amendments,omitempty" yaml:"amendments,omitempty"`
CandidateRevisions []RevisionID `json:"candidate_revisions" yaml:"candidate_revisions"`
Cohorts []CohortID `json:"cohorts,omitempty" yaml:"cohorts,omitempty"`
ControlRevision RevisionID `json:"control_revision" yaml:"control_revision"`
// An experiment without a hypothesis measures nothing in particular.
HypothesisRefs []HypothesisID `json:"hypothesis_refs" yaml:"hypothesis_refs"`
ID ExperimentID `json:"id" yaml:"id"`
InterfaceID InterfaceID `json:"interface_id" yaml:"interface_id"`
MaxDurationHours *float64 `json:"max_duration_hours,omitempty" yaml:"max_duration_hours,omitempty"`
Mechanism *FluidExperimentMechanism `json:"mechanism,omitempty" yaml:"mechanism,omitempty"`
// Primary metrics and guardrails are kept distinct so a scalar can never hide a
// regression (ArchitectureBlueprint.md section 48.5).
Metrics FluidExperimentMetrics `json:"metrics" yaml:"metrics"`
PlannedEndAt *Timestamp `json:"planned_end_at,omitempty" yaml:"planned_end_at,omitempty"`
Result FluidExperimentResult `json:"result" yaml:"result"`
SchemaVersion SchemaVersion `json:"schema_version" yaml:"schema_version"`
StartAt *Timestamp `json:"start_at,omitempty" yaml:"start_at,omitempty"`
StartConditions []string `json:"start_conditions,omitempty" yaml:"start_conditions,omitempty"`
// Every experiment has a stop condition (ArchitectureBlueprint.md section 55,
// invariant 7).
StopConditions []string `json:"stop_conditions" yaml:"stop_conditions"`
}
// Connects hypotheses to revisions under bounded conditions. Experiments must be
// interruptible (ArchitectureBlueprint.md section 16).
type ExperimentDocument struct {
FluidExperiment FluidExperiment `json:"fluid_experiment" yaml:"fluid_experiment"`
}