compiler

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Overview

Package compiler owns source loading, validation, and immutable graph results.

Index

Constants

View Source
const ManifestKind = graph.ManifestKind

Variables

View Source
var (
	Graph                          = graphmodel.Graph
	Context                        = graphmodel.Context
	ContextSnapshot                = graphmodel.ContextSnapshot
	ContextSnapshotWithDiagnostics = graphmodel.ContextSnapshotWithDiagnostics
)
View Source
var (
	Format      = scn.Format
	FormatPaths = scn.FormatPaths
)
View Source
var (
	ManifestSchemaRevision = graph.ManifestSchemaRevision
	DiagnosticCatalog      = graph.DiagnosticCatalog
)

Functions

func BuiltinProviderLock

func BuiltinProviderLock(source string) (integrity string, ok bool)

func CloneSemanticValue

func CloneSemanticValue(value any) any

func ComputeDeploymentRevisions

func ComputeDeploymentRevisions(manifest *Manifest, implementationRevisions map[string]string, providerPlanDigests map[string][]string) map[string]string

func CoreSchema

func CoreSchema(kind string) (map[string]any, bool)

func DecodeHTTPCookie

func DecodeHTTPCookie(value, typeExpression string) (any, error)

func DecodeHTTPHeader

func DecodeHTTPHeader(values []string, typeExpression string) (any, error)

func DecodeHTTPJSON

func DecodeHTTPJSON(input []byte) (any, error)

func DecodeHTTPMultipart

func DecodeHTTPMultipart(body []byte, contentType string, specs []HTTPMultipartPart, maxParts int) (map[string][]HTTPMultipartValue, error)

func DecodeHTTPPathSegment

func DecodeHTTPPathSegment(encoded string) (string, error)

func DecodeHTTPQuery

func DecodeHTTPQuery(values []string, typeExpression string) (any, error)

func DecodeHTTPScalar

func DecodeHTTPScalar(kind, value string) (any, error)

func DecodeRawHTTPQuery

func DecodeRawHTTPQuery(rawQuery, wireName, typeExpression, encoding string) (any, error)

func InputKeyFieldName

func InputKeyFieldName(value any) (string, bool)

func MarshalCanonical

func MarshalCanonical(value any) ([]byte, error)

func NegotiateHTTPMedia

func NegotiateHTTPMedia(accept string, produced []string) (string, error)

func ReadHTTPBody

func ReadHTTPBody(reader io.Reader, contentEncoding string, compressedLimit, decompressedLimit int64, supported []string) ([]byte, error)

func RefreshWorkspaceRevision

func RefreshWorkspaceRevision(result *Result) error

RefreshWorkspaceRevision re-hashes an unchanged compiler result after its already-verified generated artifacts have been materialized.

func ResolveDeployment

func ResolveDeployment(manifest *Manifest, name string) (DeploymentProjection, []Diagnostic)

func ResourceCreateKindSupported

func ResourceCreateKindSupported(kind string) bool

func ResourcePointerValue

func ResourcePointerValue(resource Resource, pointer string) (any, bool)

func ValidAuthoredLabel

func ValidAuthoredLabel(schema *AuthoredBlockSchema, label string) bool

Types

type ApplicationIdentity

type ApplicationIdentity = graph.ApplicationIdentity

type AuthoredAttributeSchema

type AuthoredAttributeSchema = spec.SourceAttributeSchema

type AuthoredBlockSchema

type AuthoredBlockSchema = spec.SourceBlockSchema

func AuthoredResourceSourceSchema

func AuthoredResourceSourceSchema(blockType string) (*AuthoredBlockSchema, bool)

AuthoredResourceSourceSchema returns the canonical authored-source shape for one resource block. Evolution uses it to render source mutations without duplicating compiler schema policy. The result is shared read-only compiler metadata; callers must not mutate it.

type AuthoredChildSchema

type AuthoredChildSchema = spec.SourceChildSchema

type Block

type Block = scn.Block

type ConcreteComment

type ConcreteComment = scn.ConcreteComment

type ConcreteSyntaxTree

type ConcreteSyntaxTree = scn.ConcreteSyntaxTree

type ConcreteToken

type ConcreteToken = scn.ConcreteToken

type ContextBundle

type ContextBundle = graphmodel.ContextBundle

type ContextOptions

type ContextOptions = graphmodel.ContextOptions

type DeploymentProjection

type DeploymentProjection struct {
	machine.ArtifactIdentity
	Deployment       string                                  `json:"deployment"`
	Environment      string                                  `json:"environment"`
	ContractRevision string                                  `json:"contract_revision"`
	Resources        map[string]DeploymentResourceProjection `json:"resources"`
}

type DeploymentResourceProjection

type DeploymentResourceProjection struct {
	Kind       string            `json:"kind"`
	Values     map[string]any    `json:"values"`
	Provenance map[string]string `json:"provenance"`
}

type Diagnostic

type Diagnostic = graph.Diagnostic

func ComputeImplementationRevisions

func ComputeImplementationRevisions(result *Result, buildInputManifestDigests map[string]string) (map[string]string, []Diagnostic)

func TransportDiagnostic

func TransportDiagnostic(kind, message string) Diagnostic

type DiagnosticDefinition

type DiagnosticDefinition = spec.DiagnosticDefinition

func DiagnosticDefinitionFor

func DiagnosticDefinitionFor(code string) (DiagnosticDefinition, bool)

func DiagnosticDefinitions

func DiagnosticDefinitions() []DiagnosticDefinition

type ExpansionStep

type ExpansionStep = graph.ExpansionStep

type Expression

type Expression = scn.Expression

type FieldProvenance

type FieldProvenance = graph.FieldProvenance

type FixtureSeedPlan

type FixtureSeedPlan struct {
	Address     string `json:"address"`
	DataSource  string `json:"data_source"`
	Database    string `json:"database"`
	Environment string `json:"environment"`
	Path        string `json:"path"`
	SQL         string `json:"sql"`
	SHA256      string `json:"sha256"`
}

FixtureSeedPlan is the deterministic SQL projection of one fixture for one selected environment. Deployment providers and the local db seed command use the same projection.

func BuildFixtureSeedPlans

func BuildFixtureSeedPlans(result *Result, environment string) ([]FixtureSeedPlan, error)

BuildFixtureSeedPlans projects validated fixtures into bounded PostgreSQL statements. It never connects to a provider or mutates state.

type FormatResult

type FormatResult = scn.FormatResult

type GoBuildTarget

type GoBuildTarget struct {
	Name      string
	Address   string
	Role      string
	Effective map[string]any
	Resolved  map[string]any
	Context   parse.GoTargetContext
}

func ResolveGoBuildTarget

func ResolveGoBuildTarget(result *Result, name, defaultRole string) (GoBuildTarget, error)

func VerificationGoTargets

func VerificationGoTargets(result *Result) ([]GoBuildTarget, error)

VerificationGoTargets resolves the concrete Go targets selected for default implementation verification, including their exact build contexts.

type GraphEdge

type GraphEdge = graphmodel.GraphEdge

type GraphOptions

type GraphOptions = graphmodel.GraphOptions

type HTTPMultipartPart

type HTTPMultipartPart struct {
	Name           string
	Kind           string
	MediaTypes     []string
	MaxBytes       int64
	Multiple       bool
	RetainFilename bool
}

type HTTPMultipartValue

type HTTPMultipartValue struct {
	Bytes     []byte
	Filename  string
	MediaType string
}

type LockEntry

type LockEntry struct {
	Kind                       string   `json:"kind"`
	Name                       string   `json:"name"`
	Source                     string   `json:"source"`
	Integrity                  string   `json:"integrity"`
	CompileDescriptorDigest    string   `json:"compile_descriptor_digest,omitempty"`
	RuntimeABI                 string   `json:"runtime_abi,omitempty"`
	DeploymentABI              string   `json:"deployment_abi,omitempty"`
	MigrationABI               string   `json:"migration_abi,omitempty"`
	PackageContractABIRevision string   `json:"package_contract_abi_revision,omitempty"`
	Dependencies               []string `json:"dependencies,omitempty"`
}

type Lockfile

type Lockfile struct {
	Entries []LockEntry `json:"entries"`
}

type Manifest

type Manifest = graph.Manifest

type Origin

type Origin = graph.Origin

type PartialGraph

type PartialGraph = graph.PartialGraph

type Position

type Position = scn.Position

type ProviderDescriptor

type ProviderDescriptor struct {
	machine.ArtifactIdentity
	Source        string                                `json:"source"`
	Capabilities  []string                              `json:"capabilities"`
	ConfigSchema  map[string]any                        `json:"config_schema"`
	InstanceKinds map[string]ProviderInstanceDescriptor `json:"instance_kinds"`
	RuntimeABI    string                                `json:"runtime_abi"`
	DeploymentABI string                                `json:"deployment_abi"`
	MigrationABI  string                                `json:"migration_abi,omitempty"`
}

type ProviderInstanceDescriptor

type ProviderInstanceDescriptor struct {
	Capabilities []string `json:"capabilities"`
	Lifecycles   []string `json:"lifecycles"`
}

type Range

type Range = scn.Range
type Related = graph.Related

type Resource

type Resource = graph.Resource

type ResourceGraph

type ResourceGraph = graphmodel.ResourceGraph

type Result

type Result struct {
	Root                    string                     `json:"-"`
	Manifest                *graph.Manifest            `json:"manifest,omitempty"`
	FrameworkResources      []graph.Resource           `json:"-"`
	ViewManifests           map[string]*graph.Manifest `json:"-"`
	PartialGraph            *graph.PartialGraph        `json:"partial_graph,omitempty"`
	ContractStatus          string                     `json:"contract_status"`
	ImplementationStatus    string                     `json:"implementation_status"`
	WorkspaceRevision       string                     `json:"workspace_revision"`
	ImplementationRevisions map[string]string          `json:"implementation_revision,omitempty"`
	DeploymentRevisions     map[string]string          `json:"deployment_revision,omitempty"`
	HTTPSurfaceRevisions    map[string]string          `json:"http_surface_revision,omitempty"`
	OpenAPIRevisions        map[string]string          `json:"openapi_revision,omitempty"`
	Diagnostics             []graph.Diagnostic         `json:"diagnostics"`
	Sources                 []*scn.Source              `json:"-"`
}

func Check

func Check(root string) (*Result, error)

func Compile

func Compile(root string) (*Result, error)

func CompileContractGraph

func CompileContractGraph(root string) (*Result, error)

CompileContractGraph resolves and validates the canonical contract graph. Build, generation, and deployment phases consume this immutable result.

func CompileDuringChangeTransaction

func CompileDuringChangeTransaction(root string) (*Result, error)

CompileDuringChangeTransaction compiles the graph while evolution owns an active source transaction in this process.

func (*Result) ManifestForView

func (r *Result) ManifestForView(view string) (*graph.Manifest, error)

ManifestForView returns one immutable compiler snapshot.

func (*Result) Valid

func (r *Result) Valid() bool

type Source

type Source = scn.Source

Syntax types live in internal/scn. These aliases keep the compiler graph model source-compatible while its callers migrate to the syntax boundary.

type SourceRecord

type SourceRecord = graph.SourceRecord

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL