Documentation
¶
Overview ¶
Package contractplan owns portable immutable compilation snapshots. It has no catalog, Git, environment, credential, or execution capability.
Index ¶
- Constants
- Variables
- func ApplyOperationDefaults(p *pipelinespec.Pipeline, operations []Operation) error
- func CapturePipelinePins(pipeline *pipelinespec.Pipeline, projection *odcs.ProjectionPlan, ...) ([]model.PinnedODCSPort, error)
- func CapturePort(ref *pipelinespec.ODCSContractRef, revision *model.ODCSRevision, ...) (model.PinnedODCSPort, error)
- func Compile(input Input) ([]byte, string, error)
- func OperationContracts(op Operation) (input, output *payload.Contract, err error)
- func SelectStructuralProjection(plan *odcs.ProjectionPlan, ref *pipelinespec.ODCSContractRef, ...) (*payload.Structure, string, error)
- func Specialize(raw []byte, id string, values map[string]odcs.ResolutionValue) ([]byte, string, error)
- type Input
- type Operation
- type OperationContent
- type OperationParameter
- type Plan
- type Source
Constants ¶
const ( FormatVersion = 4 CompilerID = "braidplane/contract-plan/v4" StructuralPolicyID = "braidplane/structural-policy/v1" )
Variables ¶
var ErrInvalid = xerror.New(xerror.KindInvalidInput, "COMPILED_PLAN_INVALID", "compiled contract plan is incomplete, corrupt, or unsupported")
Functions ¶
func ApplyOperationDefaults ¶
func ApplyOperationDefaults(p *pipelinespec.Pipeline, operations []Operation) error
ApplyOperationDefaults preserves both origins. Defaults affect only omitted directions; an explicit step declaration remains an independent obligation.
func CapturePipelinePins ¶
func CapturePipelinePins(pipeline *pipelinespec.Pipeline, projection *odcs.ProjectionPlan, lookup func(*pipelinespec.ODCSContractRef) (*model.ODCSRevision, error)) ([]model.PinnedODCSPort, error)
CapturePipelinePins resolves every authored port through an authorized catalog lookup. Selected structures never pass through the flat ODCS converter.
func CapturePort ¶
func CapturePort(ref *pipelinespec.ODCSContractRef, revision *model.ODCSRevision, projection *odcs.ProjectionPlan) (model.PinnedODCSPort, error)
func Compile ¶
Compile freezes every input before computing identity. Authored identity is deliberately independent of saved-operation, projection and compiler changes.
func OperationContracts ¶
OperationContracts uses only the captured declarations and their exact pins. The step's promise/requirement is deliberately not part of this result.
func SelectStructuralProjection ¶
func SelectStructuralProjection(plan *odcs.ProjectionPlan, ref *pipelinespec.ODCSContractRef, contract *payload.Contract) (*payload.Structure, string, error)
SelectStructuralProjection identifies one exact executable check shape when a contract object is reused through several mappings.
func Specialize ¶
func Specialize(raw []byte, id string, values map[string]odcs.ResolutionValue) ([]byte, string, error)
Specialize resolves only declared non-secret projection parameters from the stored template. It never reads catalog revisions or mutable operations.
Types ¶
type Input ¶
type Input struct {
Source Source
Authored json.RawMessage
Operations []Operation
Pins []model.PinnedODCSPort
Projection *odcs.ProjectionRequest
}
Input contains only already-authorized, environment-independent material. Rich selections retain structural checks independently of catalog access.
type Operation ¶
type Operation struct {
DataSourceType model.DataSourceType `json:"data_source_type,omitempty"`
Step slug.Slug `json:"step"`
Role string `json:"role"`
DataSource slug.Slug `json:"data_source"`
Slug slug.Slug `json:"slug"`
Revision string `json:"revision"`
Content json.RawMessage `json:"content"`
Digest string `json:"digest"`
}
Operation retains the complete saved definition, including parameter defaults and input requirements. Revision is the authoring revision, never a live alias.
type OperationContent ¶
type OperationContent struct {
ResourceScope *resourcescope.Scope `json:"resource_scope,omitempty"`
Data json.RawMessage `json:"data"`
ExpectedInputContract json.RawMessage `json:"expected_input_contract,omitempty"`
ExpectedInputContractRef *pipelinespec.ODCSContractRef `json:"expected_input_contract_ref,omitempty"`
OutputContract json.RawMessage `json:"output_contract,omitempty"`
OutputContractRef *pipelinespec.ODCSContractRef `json:"output_contract_ref,omitempty"`
ContractPins []model.PinnedODCSPort `json:"contract_pins,omitempty"`
Parameters []OperationParameter `json:"parameters"`
}
type OperationParameter ¶
type Plan ¶
type Plan struct {
Source Source `json:"source"`
FormatVersion int `json:"format_version"`
CompilerID string `json:"compiler_id"`
StructuralPolicyID string `json:"structural_policy_id"`
Authored json.RawMessage `json:"authored"`
AuthoredSpecHash string `json:"authored_spec_hash"`
Operations []Operation `json:"operations"`
Pins []model.PinnedODCSPort `json:"pins"`
Projection *odcs.ProjectionPlan `json:"projection,omitempty"`
ProjectionDigest string `json:"projection_digest,omitempty"`
ProjectionInputs *odcs.ProjectionRequest `json:"projection_inputs,omitempty"`
}
func Read ¶
Read uses only stored material. In particular, it never reruns the compiler, so a future compiler cannot reinterpret a stored snapshot.
func (*Plan) RuntimePipeline ¶
func (p *Plan) RuntimePipeline() (*pipelinespec.Pipeline, error)
RuntimePipeline reconstructs executable declarations from stored material only.
func (*Plan) ValidateProjectionBindings ¶
ValidateProjectionBindings rejects new public compilations whose selected projections cannot supply the exact port checks. Historical readers stay unchanged.