fluid-core/internal/contract/common_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

207 lines
8.3 KiB
Go

// Code generated by tools/schemagen. DO NOT EDIT.
// Source: schemas/. Regenerate with `make generate`.
package contract
import "time"
type ActorType string
const (
ActorTypeHuman ActorType = "human"
ActorTypeDaimon ActorType = "daimon"
ActorTypePolicy ActorType = "policy"
ActorTypeSystem ActorType = "system"
ActorTypeConsumer ActorType = "consumer"
)
// Valid reports whether v is a defined ActorType.
func (v ActorType) Valid() bool {
switch v {
case ActorTypeHuman, ActorTypeDaimon, ActorTypePolicy, ActorTypeSystem, ActorTypeConsumer:
return true
}
return false
}
// Who or what performed an action. FLUID distinguishes these because trust levels
// differ (ArchitectureBlueprint.md section 47).
type Actor struct {
ID string `json:"id" yaml:"id"`
ModelOrAgent string `json:"model_or_agent,omitempty" yaml:"model_or_agent,omitempty"`
Type ActorType `json:"type" yaml:"type"`
}
// FluidAPIStandards.md section 16.
type AdaptationClass string
const (
AdaptationClassPresentation AdaptationClass = "presentation"
AdaptationClassContract AdaptationClass = "contract"
AdaptationClassComposition AdaptationClass = "composition"
AdaptationClassImplementation AdaptationClass = "implementation"
AdaptationClassRequirementEscalation AdaptationClass = "requirement_escalation"
)
// Valid reports whether v is a defined AdaptationClass.
func (v AdaptationClass) Valid() bool {
switch v {
case AdaptationClassPresentation, AdaptationClassContract, AdaptationClassComposition, AdaptationClassImplementation, AdaptationClassRequirementEscalation:
return true
}
return false
}
// Opaque reference into the artifact store.
type ArtifactRef string
type BackendRequirementID string
type CohortID string
// Standard dimensions, implementation-defined scoring (FluidAPIStandards.md section
// 22).
type ComplexityDelta struct {
ActiveRevisionCount *float64 `json:"active_revision_count,omitempty" yaml:"active_revision_count,omitempty"`
AlternativePathCount *float64 `json:"alternative_path_count,omitempty" yaml:"alternative_path_count,omitempty"`
BackendCompositionCount *float64 `json:"backend_composition_count,omitempty" yaml:"backend_composition_count,omitempty"`
CognitiveLoad *float64 `json:"cognitive_load,omitempty" yaml:"cognitive_load,omitempty"`
ConceptCount *float64 `json:"concept_count,omitempty" yaml:"concept_count,omitempty"`
DependencyCount *float64 `json:"dependency_count,omitempty" yaml:"dependency_count,omitempty"`
ExceptionCount *float64 `json:"exception_count,omitempty" yaml:"exception_count,omitempty"`
OperationCount *float64 `json:"operation_count,omitempty" yaml:"operation_count,omitempty"`
ParameterDimensionality *float64 `json:"parameter_dimensionality,omitempty" yaml:"parameter_dimensionality,omitempty"`
SemanticOverlap *float64 `json:"semantic_overlap,omitempty" yaml:"semantic_overlap,omitempty"`
SurfaceArea *float64 `json:"surface_area,omitempty" yaml:"surface_area,omitempty"`
}
type DecisionID string
// Content address of an artifact.
type Digest string
type EventID string
// Opaque reference into the evidence store, conventionally '<kind>:<locator>' such
// as 'telemetry:invoice-pattern-2026w36'.
type EvidenceRef string
type ExpectedOutcomeDirection string
const (
ExpectedOutcomeDirectionLower ExpectedOutcomeDirection = "lower"
ExpectedOutcomeDirectionHigher ExpectedOutcomeDirection = "higher"
ExpectedOutcomeDirectionUnchanged ExpectedOutcomeDirection = "unchanged"
)
// Valid reports whether v is a defined ExpectedOutcomeDirection.
func (v ExpectedOutcomeDirection) Valid() bool {
switch v {
case ExpectedOutcomeDirectionLower, ExpectedOutcomeDirectionHigher, ExpectedOutcomeDirectionUnchanged:
return true
}
return false
}
type ExpectedOutcome struct {
Baseline *float64 `json:"baseline,omitempty" yaml:"baseline,omitempty"`
Cohort string `json:"cohort,omitempty" yaml:"cohort,omitempty"`
Direction ExpectedOutcomeDirection `json:"direction" yaml:"direction"`
Metric string `json:"metric" yaml:"metric"`
Target float64 `json:"target" yaml:"target"`
}
type ExperimentID string
type FeedbackID string
// FluidAPIStandards.md section 20. No universal scalar is defined on purpose.
type FitnessDimensions struct {
Availability *float64 `json:"availability,omitempty" yaml:"availability,omitempty"`
ClientUtility *float64 `json:"client_utility,omitempty" yaml:"client_utility,omitempty"`
Compatibility *float64 `json:"compatibility,omitempty" yaml:"compatibility,omitempty"`
Correctness *float64 `json:"correctness,omitempty" yaml:"correctness,omitempty"`
Discoverability *float64 `json:"discoverability,omitempty" yaml:"discoverability,omitempty"`
ImplementationCost *float64 `json:"implementation_cost,omitempty" yaml:"implementation_cost,omitempty"`
Maintainability *float64 `json:"maintainability,omitempty" yaml:"maintainability,omitempty"`
OperationalCost *float64 `json:"operational_cost,omitempty" yaml:"operational_cost,omitempty"`
Performance *float64 `json:"performance,omitempty" yaml:"performance,omitempty"`
Reliability *float64 `json:"reliability,omitempty" yaml:"reliability,omitempty"`
ResourceConsumption *float64 `json:"resource_consumption,omitempty" yaml:"resource_consumption,omitempty"`
Security *float64 `json:"security,omitempty" yaml:"security,omitempty"`
Simplicity *float64 `json:"simplicity,omitempty" yaml:"simplicity,omitempty"`
}
type GuardrailOperator string
const (
GuardrailOperatorLt GuardrailOperator = "<"
GuardrailOperatorLte GuardrailOperator = "<="
GuardrailOperatorEq GuardrailOperator = "=="
GuardrailOperatorNeq GuardrailOperator = "!="
GuardrailOperatorGte GuardrailOperator = ">="
GuardrailOperatorGt GuardrailOperator = ">"
)
// Valid reports whether v is a defined GuardrailOperator.
func (v GuardrailOperator) Valid() bool {
switch v {
case GuardrailOperatorLt, GuardrailOperatorLte, GuardrailOperatorEq, GuardrailOperatorNeq, GuardrailOperatorGte, GuardrailOperatorGt:
return true
}
return false
}
// A constraint that must not regress beyond threshold. Guardrails are evaluated
// deterministically.
type Guardrail struct {
Metric string `json:"metric" yaml:"metric"`
Operator GuardrailOperator `json:"operator" yaml:"operator"`
Threshold any `json:"threshold" yaml:"threshold"`
}
type HypothesisID string
// Stable identifier of the owning interface.
type InterfaceID string
type ObservationWindow struct {
// Null while the window is still open.
End *Timestamp `json:"end,omitempty" yaml:"end,omitempty"`
Start Timestamp `json:"start" yaml:"start"`
}
// FluidAPIStandards.md section 13.
type PressureClass string
const (
PressureClassNaturalUsage PressureClass = "natural_usage"
PressureClassSuccessfulButInefficientUsage PressureClass = "successful_but_inefficient_usage"
PressureClassRecoverableMisunderstanding PressureClass = "recoverable_misunderstanding"
PressureClassRepeatedExpectationMismatch PressureClass = "repeated_expectation_mismatch"
PressureClassPoorDiscoverability PressureClass = "poor_discoverability"
PressureClassMissingInterfaceCapability PressureClass = "missing_interface_capability"
PressureClassMissingBackendCapability PressureClass = "missing_backend_capability"
PressureClassOutOfScopeDemand PressureClass = "out_of_scope_demand"
PressureClassProhibitedDemand PressureClass = "prohibited_demand"
PressureClassImplementationFailure PressureClass = "implementation_failure"
)
// Valid reports whether v is a defined PressureClass.
func (v PressureClass) Valid() bool {
switch v {
case PressureClassNaturalUsage, PressureClassSuccessfulButInefficientUsage, PressureClassRecoverableMisunderstanding, PressureClassRepeatedExpectationMismatch, PressureClassPoorDiscoverability, PressureClassMissingInterfaceCapability, PressureClassMissingBackendCapability, PressureClassOutOfScopeDemand, PressureClassProhibitedDemand, PressureClassImplementationFailure:
return true
}
return false
}
type PressureID string
type RevisionID string
type SchemaVersion string
type Timestamp = time.Time
type UnitInterval float64