fluid-core/internal/contract/hypothesis_gen.go
tegwick 76912adef8
Some checks failed
ci / build (push) Failing after 1m6s
Generate contract types, pin fixtures to spec, add build and ADRs
Completes FLUID-WP-0002. The record types in internal/contract are
generated from schemas/ by a dependency-free generator; fixtures
transcribed from the spec's worked examples validate against those
schemas and round-trip through the generated types with
DisallowUnknownFields, so a spec change that misses the schemas fails
CI rather than drifting silently.

Adds identifier prefix helpers, Makefile, GitHub Actions, and five ADRs
recording the Go choice, out-of-process attachment, the wire contract as
boundary, the evidence store, and revision identity.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014KmVxhJ35tCo7rE7UnLwWu

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 1116572@bnt-lap001
Assistant-Session: 8ba9bb93-a72a-4883-b189-2499cce5c400
2026-09-04 02:03:12 +02:00

254 lines
12 KiB
Go

// Code generated by tools/schemagen. DO NOT EDIT.
// Source: schemas/. Regenerate with `make generate`.
package contract
type FluidHypothesisAudit struct {
DecisionRefs []DecisionID `json:"decision_refs,omitempty" yaml:"decision_refs,omitempty"`
ImmutableEventRefs []EventID `json:"immutable_event_refs,omitempty" yaml:"immutable_event_refs,omitempty"`
}
type FluidHypothesisBackendRequirements struct {
Required bool `json:"required" yaml:"required"`
RequirementRefs []BackendRequirementID `json:"requirement_refs,omitempty" yaml:"requirement_refs,omitempty"`
}
// Competing hypotheses are legitimate (FluidAPIStandards.md section 19).
type FluidHypothesisCompetition struct {
Alternatives []HypothesisID `json:"alternatives,omitempty" yaml:"alternatives,omitempty"`
GroupID string `json:"group_id" yaml:"group_id"`
}
type FluidHypothesisComplexity struct {
ExpectedDelta ComplexityDelta `json:"expected_delta" yaml:"expected_delta"`
Score *float64 `json:"score,omitempty" yaml:"score,omitempty"`
}
type FluidHypothesisEconomicsExpectedValueClass string
const (
FluidHypothesisEconomicsExpectedValueClassLOW FluidHypothesisEconomicsExpectedValueClass = "LOW"
FluidHypothesisEconomicsExpectedValueClassMEDIUM FluidHypothesisEconomicsExpectedValueClass = "MEDIUM"
FluidHypothesisEconomicsExpectedValueClassHIGH FluidHypothesisEconomicsExpectedValueClass = "HIGH"
)
// Valid reports whether v is a defined FluidHypothesisEconomicsExpectedValueClass.
func (v FluidHypothesisEconomicsExpectedValueClass) Valid() bool {
switch v {
case FluidHypothesisEconomicsExpectedValueClassLOW, FluidHypothesisEconomicsExpectedValueClassMEDIUM, FluidHypothesisEconomicsExpectedValueClassHIGH:
return true
}
return false
}
// A hypothesis may be valuable but not yet worth exploring
// (ArchitectureBlueprint.md section 29).
type FluidHypothesisEconomics struct {
Currency string `json:"currency,omitempty" yaml:"currency,omitempty"`
EstimatedExperimentCost *float64 `json:"estimated_experiment_cost,omitempty" yaml:"estimated_experiment_cost,omitempty"`
EstimatedImplementationCost *float64 `json:"estimated_implementation_cost,omitempty" yaml:"estimated_implementation_cost,omitempty"`
ExpectedValueClass *FluidHypothesisEconomicsExpectedValueClass `json:"expected_value_class,omitempty" yaml:"expected_value_class,omitempty"`
}
// Explanatory reach is a prioritization signal, never a correctness claim
// (FluidAPIStandards.md section 18).
type FluidHypothesisExplanationReach struct {
Explains []PressureID `json:"explains,omitempty" yaml:"explains,omitempty"`
Notes string `json:"notes,omitempty" yaml:"notes,omitempty"`
Score *float64 `json:"score,omitempty" yaml:"score,omitempty"`
}
// What we think explains the observation.
type FluidHypothesisExplanation struct {
Claim string `json:"claim" yaml:"claim"`
// Explanatory reach is a prioritization signal, never a correctness claim
// (FluidAPIStandards.md section 18).
Reach *FluidHypothesisExplanationReach `json:"reach,omitempty" yaml:"reach,omitempty"`
}
type FluidHypothesisFailureCriteria struct {
Expression string `json:"expression" yaml:"expression"`
}
type FluidHypothesisFitnessDimensions struct {
Expected *FitnessDimensions `json:"expected,omitempty" yaml:"expected,omitempty"`
}
type FluidHypothesisLearningValue struct {
Notes string `json:"notes,omitempty" yaml:"notes,omitempty"`
Score *float64 `json:"score,omitempty" yaml:"score,omitempty"`
}
// What was seen. Not what it means.
type FluidHypothesisObservation struct {
AffectedCohorts []CohortID `json:"affected_cohorts,omitempty" yaml:"affected_cohorts,omitempty"`
EvidenceRefs []EvidenceRef `json:"evidence_refs" yaml:"evidence_refs"`
ObservationWindow *ObservationWindow `json:"observation_window,omitempty" yaml:"observation_window,omitempty"`
Summary string `json:"summary" yaml:"summary"`
}
type FluidHypothesisOutcomeStatus string
const (
FluidHypothesisOutcomeStatusCONFIRMED FluidHypothesisOutcomeStatus = "CONFIRMED"
FluidHypothesisOutcomeStatusREFUTED FluidHypothesisOutcomeStatus = "REFUTED"
FluidHypothesisOutcomeStatusINCONCLUSIVE FluidHypothesisOutcomeStatus = "INCONCLUSIVE"
)
// Valid reports whether v is a defined FluidHypothesisOutcomeStatus.
func (v FluidHypothesisOutcomeStatus) Valid() bool {
switch v {
case FluidHypothesisOutcomeStatusCONFIRMED, FluidHypothesisOutcomeStatusREFUTED, FluidHypothesisOutcomeStatusINCONCLUSIVE:
return true
}
return false
}
// What happened afterwards. Null until evaluation completes.
type FluidHypothesisOutcome struct {
EvidenceRefs []EvidenceRef `json:"evidence_refs,omitempty" yaml:"evidence_refs,omitempty"`
Status *FluidHypothesisOutcomeStatus `json:"status,omitempty" yaml:"status,omitempty"`
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
}
type FluidHypothesisPressure struct {
Classes []PressureClass `json:"classes" yaml:"classes"`
Confidence *UnitInterval `json:"confidence,omitempty" yaml:"confidence,omitempty"`
PressureRefs []PressureID `json:"pressure_refs,omitempty" yaml:"pressure_refs,omitempty"`
Severity *UnitInterval `json:"severity,omitempty" yaml:"severity,omitempty"`
}
type FluidHypothesisPriority struct {
DecidedBy string `json:"decided_by,omitempty" yaml:"decided_by,omitempty"`
Score *float64 `json:"score,omitempty" yaml:"score,omitempty"`
}
type FluidHypothesisProposedAdaptationImplementationScope string
const (
FluidHypothesisProposedAdaptationImplementationScopeInterfaceOnly FluidHypothesisProposedAdaptationImplementationScope = "interface_only"
FluidHypothesisProposedAdaptationImplementationScopeInterfaceAndBackend FluidHypothesisProposedAdaptationImplementationScope = "interface_and_backend"
FluidHypothesisProposedAdaptationImplementationScopeDocumentationOnly FluidHypothesisProposedAdaptationImplementationScope = "documentation_only"
)
// Valid reports whether v is a defined FluidHypothesisProposedAdaptationImplementationScope.
func (v FluidHypothesisProposedAdaptationImplementationScope) Valid() bool {
switch v {
case FluidHypothesisProposedAdaptationImplementationScopeInterfaceOnly, FluidHypothesisProposedAdaptationImplementationScopeInterfaceAndBackend, FluidHypothesisProposedAdaptationImplementationScopeDocumentationOnly:
return true
}
return false
}
// What we propose to change.
type FluidHypothesisProposedAdaptation struct {
// Shape is protocol-specific and deliberately unconstrained.
CandidateContract map[string]any `json:"candidate_contract,omitempty" yaml:"candidate_contract,omitempty"`
Class AdaptationClass `json:"class" yaml:"class"`
ImplementationScope *FluidHypothesisProposedAdaptationImplementationScope `json:"implementation_scope,omitempty" yaml:"implementation_scope,omitempty"`
Summary string `json:"summary" yaml:"summary"`
}
type FluidHypothesisRiskLevel string
const (
FluidHypothesisRiskLevelLOW FluidHypothesisRiskLevel = "LOW"
FluidHypothesisRiskLevelMEDIUM FluidHypothesisRiskLevel = "MEDIUM"
FluidHypothesisRiskLevelHIGH FluidHypothesisRiskLevel = "HIGH"
FluidHypothesisRiskLevelCRITICAL FluidHypothesisRiskLevel = "CRITICAL"
)
// Valid reports whether v is a defined FluidHypothesisRiskLevel.
func (v FluidHypothesisRiskLevel) Valid() bool {
switch v {
case FluidHypothesisRiskLevelLOW, FluidHypothesisRiskLevelMEDIUM, FluidHypothesisRiskLevelHIGH, FluidHypothesisRiskLevelCRITICAL:
return true
}
return false
}
type FluidHypothesisRisk struct {
Level FluidHypothesisRiskLevel `json:"level" yaml:"level"`
Reasons []string `json:"reasons,omitempty" yaml:"reasons,omitempty"`
}
type FluidHypothesisState string
const (
FluidHypothesisStateDRAFT FluidHypothesisState = "DRAFT"
FluidHypothesisStateREADY FluidHypothesisState = "READY"
FluidHypothesisStatePRIORITIZED FluidHypothesisState = "PRIORITIZED"
FluidHypothesisStateDESIGNING FluidHypothesisState = "DESIGNING"
FluidHypothesisStateEXPERIMENTING FluidHypothesisState = "EXPERIMENTING"
FluidHypothesisStateEVALUATING FluidHypothesisState = "EVALUATING"
FluidHypothesisStateACCEPTED FluidHypothesisState = "ACCEPTED"
FluidHypothesisStateREJECTED FluidHypothesisState = "REJECTED"
FluidHypothesisStateSUPERSEDED FluidHypothesisState = "SUPERSEDED"
FluidHypothesisStateDEFERRED FluidHypothesisState = "DEFERRED"
)
// Valid reports whether v is a defined FluidHypothesisState.
func (v FluidHypothesisState) Valid() bool {
switch v {
case FluidHypothesisStateDRAFT, FluidHypothesisStateREADY, FluidHypothesisStatePRIORITIZED, FluidHypothesisStateDESIGNING, FluidHypothesisStateEXPERIMENTING, FluidHypothesisStateEVALUATING, FluidHypothesisStateACCEPTED, FluidHypothesisStateREJECTED, FluidHypothesisStateSUPERSEDED, FluidHypothesisStateDEFERRED:
return true
}
return false
}
type FluidHypothesisSuccessCriteria struct {
Expression string `json:"expression" yaml:"expression"`
}
type FluidHypothesis struct {
Audit *FluidHypothesisAudit `json:"audit,omitempty" yaml:"audit,omitempty"`
BackendRequirements *FluidHypothesisBackendRequirements `json:"backend_requirements,omitempty" yaml:"backend_requirements,omitempty"`
CandidateRevisionRefs []RevisionID `json:"candidate_revision_refs,omitempty" yaml:"candidate_revision_refs,omitempty"`
// Competing hypotheses are legitimate (FluidAPIStandards.md section 19).
Competition *FluidHypothesisCompetition `json:"competition,omitempty" yaml:"competition,omitempty"`
Complexity FluidHypothesisComplexity `json:"complexity" yaml:"complexity"`
CreatedAt *Timestamp `json:"created_at,omitempty" yaml:"created_at,omitempty"`
CreatedBy *Actor `json:"created_by,omitempty" yaml:"created_by,omitempty"`
// A hypothesis may be valuable but not yet worth exploring
// (ArchitectureBlueprint.md section 29).
Economics *FluidHypothesisEconomics `json:"economics,omitempty" yaml:"economics,omitempty"`
// A hypothesis must be falsifiable (FluidAPIStandards.md section 17).
ExpectedOutcomes []ExpectedOutcome `json:"expected_outcomes" yaml:"expected_outcomes"`
ExperimentRefs []ExperimentID `json:"experiment_refs,omitempty" yaml:"experiment_refs,omitempty"`
// What we think explains the observation.
Explanation FluidHypothesisExplanation `json:"explanation" yaml:"explanation"`
FailureCriteria *FluidHypothesisFailureCriteria `json:"failure_criteria,omitempty" yaml:"failure_criteria,omitempty"`
FitnessDimensions *FluidHypothesisFitnessDimensions `json:"fitness_dimensions,omitempty" yaml:"fitness_dimensions,omitempty"`
Guardrails []Guardrail `json:"guardrails" yaml:"guardrails"`
ID HypothesisID `json:"id" yaml:"id"`
InterfaceID InterfaceID `json:"interface_id" yaml:"interface_id"`
LearningValue *FluidHypothesisLearningValue `json:"learning_value,omitempty" yaml:"learning_value,omitempty"`
// What was seen. Not what it means.
Observation FluidHypothesisObservation `json:"observation" yaml:"observation"`
// What happened afterwards. Null until evaluation completes.
Outcome *FluidHypothesisOutcome `json:"outcome,omitempty" yaml:"outcome,omitempty"`
Pressure FluidHypothesisPressure `json:"pressure" yaml:"pressure"`
Priority *FluidHypothesisPriority `json:"priority,omitempty" yaml:"priority,omitempty"`
// What we propose to change.
ProposedAdaptation FluidHypothesisProposedAdaptation `json:"proposed_adaptation" yaml:"proposed_adaptation"`
Risk FluidHypothesisRisk `json:"risk" yaml:"risk"`
SchemaVersion SchemaVersion `json:"schema_version" yaml:"schema_version"`
State FluidHypothesisState `json:"state" yaml:"state"`
SuccessCriteria FluidHypothesisSuccessCriteria `json:"success_criteria" yaml:"success_criteria"`
Title string `json:"title" yaml:"title"`
}
// Why an interface change should be explored. Observation, explanation, prediction,
// intervention and result stay separate on purpose
// (FluidHypothesisRevisionSchema.md section 18).
type HypothesisDocument struct {
FluidHypothesis FluidHypothesis `json:"fluid_hypothesis" yaml:"fluid_hypothesis"`
}