{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package platform\n\nPackage platform defines the core types and interfaces for the platform abstraction layer. It provides a three-tier model (Infrastructure, Shared Primitives, Application) for declarative infrastructure management through capability-based abstractions that are provider-agnostic.\n\n## Constants\n\n```go\nconst (\n\tSizeXS = interfaces.SizeXS\n\tSizeS  = interfaces.SizeS\n\tSizeM  = interfaces.SizeM\n\tSizeL  = interfaces.SizeL\n\tSizeXL = interfaces.SizeXL\n)\n```\nSize tier constants re-exported from interfaces.\n\n## Variables\n\n```go\nvar (\n\t// ErrPlanNotApproved is returned when attempting to apply a plan that\n\t// has not been approved.\n\tErrPlanNotApproved = fmt.Errorf(\"plan has not been approved\")\n\n\t// ErrPlanAlreadyApplied is returned when attempting to apply a plan\n\t// that has already been applied.\n\tErrPlanAlreadyApplied = fmt.Errorf(\"plan has already been applied\")\n\n\t// ErrPlanExpired is returned when a plan is too old to be applied safely.\n\tErrPlanExpired = fmt.Errorf(\"plan has expired and must be regenerated\")\n\n\t// ErrContextNotFound is returned when a platform context cannot be resolved.\n\tErrContextNotFound = fmt.Errorf(\"platform context not found\")\n\n\t// ErrProviderNotInitialized is returned when a provider method is called\n\t// before Initialize.\n\tErrProviderNotInitialized = fmt.Errorf(\"provider has not been initialized\")\n)\n```\nSentinel errors for common conditions.\n\n```go\nvar SizingMap = interfaces.SizingMap\n```\nSizingMap re-exported from interfaces.\n\n## Functions\n\n```go\nfunc ComputePlan(ctx context.Context, p interfaces.IaCProvider, desired []interfaces.ResourceSpec, current []interfaces.ResourceState) (interfaces.IaCPlan, error)\n```\nComputePlan compares desired ResourceSpecs against current ResourceStates and returns a Plan with the minimal set of ordered actions needed to reconcile them. Creates, updates, and replaces are ordered by DependsOn (dependencies first); deletes are ordered in reverse dependency order.\n\nReturns an error if the DependsOn graph contains a cycle or if any per-resource provider.Diff call fails.\n\nAction classification for resources that exist in both desired and current state is delegated to the provider via p.ResourceDriver(spec.Type).Diff(ctx, spec, currentOut):\n\n  - replace, when DiffResult.NeedsReplace is true OR any FieldChange.ForceNew is true (the latter closes the latent bug-fix surface where ForceNew silently downgraded to update);\n  - update,  when DiffResult.NeedsUpdate is true and replace did not fire;\n  - skip,    when neither flag is set (no plan action emitted for that resource).\n\nNet-new resources (no current state) emit create without dispatching Diff; resources removed from the desired set emit delete in reverse dependency order.\n\nThe Diff dispatch is parallelised across resources via errgroup with a bounded worker pool. The worker count defaults to 8 and can be overridden via the WFCTL\\_PLAN\\_DIFF\\_CONCURRENCY env var (clamped to 1..32). Operators tuning for high-fan-out plans (50+ resources) can raise the cap; constrained-network operators can lower it.\n\nNil-tolerance contract: if p is nil, or if p.ResourceDriver(typ) returns (nil, nil) for a particular resource type, ComputePlan falls back to the legacy ConfigHash compare for the affected resource(s) — emit update when ConfigHash diverges, skip otherwise. Replace cannot be expressed via the legacy path; callers that depend on Replace classification must supply a provider whose drivers implement Diff.\n\nConcurrency contract: p (and the ResourceDriver instances it returns) MUST be safe for concurrent use across goroutines, since Diff dispatch fans out under errgroup. gRPC-loaded plugins satisfy this trivially (each call is an independent RPC); in-process providers must internally serialize state mutations.\n\nPer-resource Diff results are cached via iac/diffcache when the caller has set a non-noop backend (default: filesystem cache at ~/.cache/wfctl/diff/; controlled via the WFCTL\\_DIFFCACHE env var per the diffcache package godoc). Cache hits skip the provider.Diff roundtrip entirely; cache misses store the freshly-computed DiffResult under the (PluginVersion, Type, ProviderID, SHAConfig, SHAOutputs) tuple. Apply-time correctness does not depend on cache hits — fresh CI runners always miss and re-Diff.\n\n```go\nfunc ConfigHash(config map[string]any) string\n```\nConfigHash is the exported counterpart of configHash. It allows callers outside the platform package (e.g. cmd/wfctl) to compute hashes that are byte-for-byte identical to those stored by ComputePlan, eliminating the risk of independent re-implementations diverging.\n\n```go\nfunc ResolveSizing(_ string, size interfaces.Size, hints *interfaces.ResourceHints) (interfaces.SizingDefaults, error)\n```\nResolveSizing returns concrete resource defaults for the given size tier, with any non-empty fields in hints overriding the tier defaults. Returns an error if size is not a recognised tier.\n\nThe first parameter (\\_ string) is resourceType, reserved for future per-resource-type overrides (e.g. database vs container defaults).\n\n```go\nfunc SetDiffCacheForTest(t *testing.T, c diffcache.Cache)\n```\nSetDiffCacheForTest swaps the package-level diff cache for c and restores the previous instance via t.Cleanup. Lives in a non-\\_test.go file so external test packages (notably iac/conformance) can install a no-op cache without touching unexported symbols and without relying on the WFCTL\\_DIFFCACHE env var, which is honoured only on the very first call to getDiffCache thanks to sync.Once initialization.\n\nWhy this exists: the package-level cache is sync.Once-initialized on the first ComputePlan call in a process. A CI run that exercises ComputePlan in another test first leaves a primed cache that masks live-driver regressions in subsequent conformance runs. The architecturally-correct fix is a public helper that Stores into the atomic cache pointer directly (Store is safe concurrently with production Loads) — the prior \\`t.Setenv(\"WFCTL\\_DIFFCACHE\", \"disabled\")\\` workaround inside conformance scenarios was best-effort.\n\nConcurrency contract (round-4 review note): Two tests that BOTH call this helper concurrently (e.g., via t.Parallel) WILL race on the snapshot/restore pair — the second caller may snapshot the first's cache pointer and restore it on cleanup, masking the first's choice. Callers MUST NOT invoke this helper from a t.Parallel test. Nested calls in the same goroutine (e.g., an outer test that calls the helper, then runs subtests that also call it) are supported: each nested call snapshots the current pointer and restores it on its own t.Cleanup, which fires inside-out (Go test framework guarantee), so the outer test still sees its own cache when the nested cleanup completes. The conformance suite + platform's own \\_test.go files rely on this nested-but-sequential pattern (see scenarios\\_test.go:TestRun\\_ConsecutiveRunsObserveLiveDriverIndependently).\n\nCleanup contract: t.Cleanup restores the prior pointer if there was one, or seeds a noop cache when no prior value existed (round-4 review fix: previously seeded diffcache.New() which falls back to ~/.cache/wfctl/diff filesystem unless WFCTL\\_DIFFCACHE is set, leaking test state across runs and across users on shared CI runners). diffcache.NewNoop() is the safe default — every Get misses, so subsequent tests in the same binary do not observe stale cache entries from this test (a NewMemory fallback would persist in-memory, propagating Put results into later tests with matching cache keys). Tests that need a working cache install one explicitly via SetDiffCacheForTest. Marked t.Helper() so Cleanup-time failures attribute to the caller's line.\n\nImporting testing in this non-test file is intentional and consistent with sibling helpers (see wftest/, module/module\\_test\\_helpers.go). The Go linker drops unreferenced testing symbols from production binaries, so callers that import platform without invoking this helper pay no runtime cost.\n\n```go\nfunc ValidatePlatformConfig(cfg *PlatformConfig) error\n```\nValidatePlatformConfig checks that required fields are present and that constraint operators are recognized.\n\n## Types\n\n```go\ntype ActionError = interfaces.ActionError\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype ApplyResult = interfaces.ApplyResult\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype AuthzPolicy struct {\n\t// Role is the tier role this policy applies to.\n\tRole TierRole\n\n\t// AllowedTiers is the set of tiers the role may access.\n\tAllowedTiers []Tier\n\n\t// AllowedOperations is the set of operation names the role may perform.\n\t// An empty slice means no operations are allowed.\n\tAllowedOperations []string\n}\n```\nAuthzPolicy defines the allowed operations for a role within specific tiers.\n\n```go\ntype CapabilityConfig struct {\n\t// Name is the unique identifier for this capability within its tier.\n\tName string `yaml:\"name\" json:\"name\"`\n\n\t// Type is the abstract capability type (e.g., \"container_runtime\", \"database\").\n\tType string `yaml:\"type\" json:\"type\"`\n\n\t// Properties are provider-agnostic configuration values.\n\tProperties map[string]any `yaml:\"properties,omitempty\" json:\"properties,omitempty\"`\n\n\t// DependsOn lists other capability names that must be provisioned first.\n\tDependsOn []string `yaml:\"dependsOn,omitempty\" json:\"dependsOn,omitempty\"`\n}\n```\nCapabilityConfig is the YAML representation of a single capability declaration.\n\n```go\ntype CapabilityDeclaration struct {\n\t// Name is the unique identifier for this capability within a tier.\n\tName string `yaml:\"name\" json:\"name\"`\n\n\t// Type is the abstract capability type (e.g., \"container_runtime\", \"database\", \"message_queue\").\n\tType string `yaml:\"type\" json:\"type\"`\n\n\t// Tier indicates which infrastructure tier this capability belongs to.\n\tTier Tier `yaml:\"tier\" json:\"tier\"`\n\n\t// Properties are abstract, provider-agnostic configuration values\n\t// (e.g., replicas, memory, ports).\n\tProperties map[string]any `yaml:\"properties\" json:\"properties\"`\n\n\t// Constraints are hard limits imposed by parent tiers.\n\tConstraints []Constraint `yaml:\"constraints\" json:\"constraints\"`\n\n\t// DependsOn lists other capability names that must be provisioned first.\n\tDependsOn []string `yaml:\"dependsOn\" json:\"dependsOn\"`\n}\n```\nCapabilityDeclaration is a provider-agnostic resource requirement. This is what users write in YAML configuration files. The platform abstraction layer maps these to provider-specific resources.\n\n```go\ntype CapabilityMapper interface {\n\t// CanMap returns true if this mapper can handle the given capability type.\n\tCanMap(capabilityType string) bool\n\n\t// Map translates a capability declaration into one or more resource plans.\n\t// The PlatformContext provides parent tier outputs and constraints.\n\tMap(decl CapabilityDeclaration, pctx *PlatformContext) ([]ResourcePlan, error)\n\n\t// ValidateConstraints checks if a capability declaration satisfies all\n\t// constraints imposed by parent tiers. Returns any constraint violations found.\n\tValidateConstraints(decl CapabilityDeclaration, constraints []Constraint) []ConstraintViolation\n}\n```\nCapabilityMapper translates abstract capability declarations into provider-specific resource plans. Each provider has one mapper that understands how to convert capability-level abstractions into the concrete resources the provider manages.\n\n```go\ntype CapabilityType struct {\n\t// Name is the capability type identifier (e.g., \"container_runtime\", \"database\").\n\tName string `json:\"name\"`\n\n\t// Description is a human-readable description of the capability.\n\tDescription string `json:\"description\"`\n\n\t// Tier indicates which infrastructure tier this capability belongs to.\n\tTier Tier `json:\"tier\"`\n\n\t// Properties are the property schemas this capability accepts.\n\tProperties []PropertySchema `json:\"properties\"`\n\n\t// Constraints are the constraint schemas this capability can enforce.\n\tConstraints []PropertySchema `json:\"constraints\"`\n\n\t// Fidelity indicates how faithfully this provider implements the capability.\n\tFidelity FidelityLevel `json:\"fidelity\"`\n}\n```\nCapabilityType describes a capability a provider can satisfy. It includes schema information for the properties and constraints the capability accepts.\n\n```go\ntype CapabilityUnsupportedError struct {\n\t// Capability is the unsupported capability type.\n\tCapability string\n\n\t// Provider is the provider that does not support it.\n\tProvider string\n}\n```\nCapabilityUnsupportedError is returned when a provider does not support the requested capability type at all.\n\n```go\nfunc (e *CapabilityUnsupportedError) Error() string\n```\nError implements the error interface.\n\n```go\ntype Constraint struct {\n\t// Field is the property being constrained (e.g., \"memory\", \"replicas\", \"cpu\").\n\tField string `yaml:\"field\" json:\"field\"`\n\n\t// Operator is the comparison operator: \"\u003c=\", \"\u003e=\", \"==\", \"in\", \"not_in\".\n\tOperator string `yaml:\"operator\" json:\"operator\"`\n\n\t// Value is the constraint limit value.\n\tValue any `yaml:\"value\" json:\"value\"`\n\n\t// Source identifies which context or tier imposed this constraint.\n\tSource string `yaml:\"source\" json:\"source\"`\n}\n```\nConstraint represents a limit or requirement imposed by a parent tier on downstream tier resources.\n\n```go\ntype ConstraintConfig struct {\n\t// Field is the property being constrained (e.g., \"memory\", \"replicas\").\n\tField string `yaml:\"field\" json:\"field\"`\n\n\t// Operator is the comparison operator: \"\u003c=\", \"\u003e=\", \"==\", \"in\", \"not_in\".\n\tOperator string `yaml:\"operator\" json:\"operator\"`\n\n\t// Value is the constraint limit value.\n\tValue any `yaml:\"value\" json:\"value\"`\n}\n```\nConstraintConfig is the YAML representation of a constraint imposed by a parent tier.\n\n```go\ntype ConstraintValidator struct{}\n```\nConstraintValidator validates capability declarations against constraints imposed by parent tiers. It supports resource unit parsing (memory, CPU) and standard comparison operators.\n\n```go\nfunc NewConstraintValidator() *ConstraintValidator\n```\nNewConstraintValidator creates a new ConstraintValidator.\n\n```go\nfunc (cv *ConstraintValidator) Validate(properties map[string]any, constraints []Constraint) []ConstraintViolation\n```\nValidate checks the given properties against a set of constraints and returns any violations found. Properties is a map of field names to values (matching CapabilityDeclaration.Properties), and constraints are the accumulated limits from parent tiers.\n\n```go\ntype ConstraintViolation struct {\n\t// Constraint is the constraint that was violated.\n\tConstraint Constraint `json:\"constraint\"`\n\n\t// Actual is the value that violated the constraint.\n\tActual any `json:\"actual\"`\n\n\t// Message is a human-readable description of the violation.\n\tMessage string `json:\"message\"`\n}\n```\nConstraintViolation describes a single constraint check failure. It identifies which constraint was violated and the actual value that caused the violation.\n\n```go\ntype ConstraintViolationError struct {\n\t// Resource is the name of the resource that violated the constraint.\n\tResource string\n\n\t// Constraint is the constraint field that was violated.\n\tConstraint string\n\n\t// Value is the actual value that caused the violation.\n\tValue any\n\n\t// Limit is the constraint limit that was exceeded.\n\tLimit any\n}\n```\nConstraintViolationError is returned when a capability declaration violates a constraint imposed by a parent tier.\n\n```go\nfunc (e *ConstraintViolationError) Error() string\n```\nError implements the error interface.\n\n```go\ntype ContextResolver interface {\n\t// ResolveContext builds a PlatformContext for the given tier and identifiers.\n\t// It reads parent tier state stores to populate ParentOutputs and Constraints.\n\tResolveContext(ctx context.Context, org, env, app string, tier Tier) (*PlatformContext, error)\n\n\t// PropagateOutputs writes resource outputs into the context store so that\n\t// downstream tiers can resolve them via ResolveContext.\n\tPropagateOutputs(ctx context.Context, pctx *PlatformContext, outputs []*ResourceOutput) error\n\n\t// ValidateTierBoundary ensures a workflow operating at the given tier\n\t// does not attempt to modify resources outside its scope. Returns any\n\t// constraint violations found.\n\tValidateTierBoundary(pctx *PlatformContext, declarations []CapabilityDeclaration) []ConstraintViolation\n}\n```\nContextResolver builds PlatformContext instances by aggregating parent tier state. It reads state stores to populate parent outputs and constraints, enabling the downward flow of context through the tier hierarchy.\n\n```go\ntype CredentialBroker interface {\n\t// IssueCredential creates a scoped credential for the given platform context.\n\t// The credential value is stored in the secrets backend and a reference is returned.\n\tIssueCredential(ctx context.Context, pctx *PlatformContext, request CredentialRequest) (*CredentialRef, error)\n\n\t// RevokeCredential invalidates a previously issued credential and removes it\n\t// from the secrets backend.\n\tRevokeCredential(ctx context.Context, ref *CredentialRef) error\n\n\t// ResolveCredential retrieves the actual credential value from a reference.\n\t// This is the only way to access the credential value at runtime.\n\tResolveCredential(ctx context.Context, ref *CredentialRef) (string, error)\n\n\t// RotateCredential replaces an existing credential with a new one, revoking\n\t// the old credential. Returns the new credential reference.\n\tRotateCredential(ctx context.Context, ref *CredentialRef) (*CredentialRef, error)\n\n\t// ListCredentials returns all credential references for a given platform context.\n\tListCredentials(ctx context.Context, pctx *PlatformContext) ([]*CredentialRef, error)\n}\n```\nCredentialBroker issues and manages credentials scoped to specific tiers, environments, and applications. It integrates with the existing secrets.Provider system to store credential values securely. Only credential references are persisted in state; actual values live in the secrets backend.\n\n```go\ntype CredentialRef struct {\n\t// ID is the unique credential identifier.\n\tID string `json:\"id\"`\n\n\t// Name is the human-readable credential name.\n\tName string `json:\"name\"`\n\n\t// SecretPath is the path in the secrets backend where the value is stored.\n\tSecretPath string `json:\"secretPath\"`\n\n\t// Provider is the name of the secrets provider that holds the value.\n\tProvider string `json:\"provider\"`\n\n\t// ExpiresAt is when the credential expires.\n\tExpiresAt time.Time `json:\"expiresAt\"`\n\n\t// Tier is the infrastructure tier the credential is scoped to.\n\tTier Tier `json:\"tier\"`\n\n\t// ContextPath is the hierarchical context path (org/env/app).\n\tContextPath string `json:\"contextPath\"`\n}\n```\nCredentialRef is a pointer to a stored credential. The actual credential value is never stored in state -- only this reference is persisted. Use CredentialBroker.ResolveCredential to retrieve the actual value.\n\n```go\ntype CredentialRequest struct {\n\t// Name is a human-readable name for the credential.\n\tName string `json:\"name\"`\n\n\t// Type is the credential type: \"api_key\", \"database\", \"tls_cert\", \"token\".\n\tType string `json:\"type\"`\n\n\t// Scope lists the resource names this credential can access.\n\tScope []string `json:\"scope\"`\n\n\t// TTL is the credential lifetime. A zero value means no expiry.\n\tTTL time.Duration `json:\"ttl\"`\n\n\t// Renewable indicates whether the credential can be renewed before expiry.\n\tRenewable bool `json:\"renewable\"`\n}\n```\nCredentialRequest specifies what credential to issue, including its type, scope, and lifetime.\n\n```go\ntype CrossTierImpact struct {\n\t// SourceDrift is the drift that triggered the impact analysis.\n\tSourceDrift DriftResult `json:\"sourceDrift\"`\n\n\t// AffectedResources are the downstream resources potentially impacted.\n\tAffectedResources []DependencyRef `json:\"affectedResources\"`\n}\n```\nCrossTierImpact describes how drift in one tier affects resources in another tier.\n\n```go\ntype DependencyRef struct {\n\t// SourceContext is the context path of the depended-upon resource.\n\tSourceContext string `json:\"sourceContext\"`\n\n\t// SourceResource is the name of the depended-upon resource.\n\tSourceResource string `json:\"sourceResource\"`\n\n\t// TargetContext is the context path of the dependent resource.\n\tTargetContext string `json:\"targetContext\"`\n\n\t// TargetResource is the name of the dependent resource.\n\tTargetResource string `json:\"targetResource\"`\n\n\t// Type is the dependency type: \"hard\" (must exist) or \"soft\" (optional).\n\tType string `json:\"type\"`\n}\n```\nDependencyRef tracks cross-resource and cross-tier dependencies. These are used for impact analysis when upstream resources change.\n\n```go\ntype DestroyResult = interfaces.DestroyResult\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype DiffEntry struct {\n\t// Path is the dot-separated field path (e.g., \"properties.replicas\").\n\tPath string `json:\"path\"`\n\n\t// OldValue is the current value of the field.\n\tOldValue any `json:\"oldValue\"`\n\n\t// NewValue is the desired value of the field.\n\tNewValue any `json:\"newValue\"`\n}\n```\nDiffEntry represents a single field difference in a plan action.\n\n```go\ntype DiffResult = interfaces.DiffResult\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype DriftResult struct {\n\t// ContextPath is the hierarchical context path of the resource.\n\tContextPath string `json:\"contextPath\"`\n\n\t// ResourceName is the name of the resource.\n\tResourceName string `json:\"resourceName\"`\n\n\t// ResourceType is the provider-specific resource type.\n\tResourceType string `json:\"resourceType\"`\n\n\t// Tier is the tier the resource belongs to.\n\tTier Tier `json:\"tier\"`\n\n\t// DriftType classifies the drift: \"changed\", \"added\", \"removed\".\n\tDriftType string `json:\"driftType\"`\n\n\t// Diffs contains the individual field differences (for \"changed\" type).\n\tDiffs []DiffEntry `json:\"diffs,omitempty\"`\n\n\t// Expected is the stored state.\n\tExpected map[string]any `json:\"expected,omitempty\"`\n\n\t// Actual is the live state from the provider.\n\tActual map[string]any `json:\"actual,omitempty\"`\n}\n```\nDriftResult represents the outcome of a single resource drift check.\n\n```go\ntype ExecutionConfig struct {\n\t// Tier1Mode controls Tier 1 execution: \"plan_and_approve\" or \"auto_apply\".\n\tTier1Mode string `yaml:\"tier1_mode\" json:\"tier1_mode\"`\n\n\t// Tier2Mode controls Tier 2 execution: \"plan_and_approve\" or \"auto_apply\".\n\tTier2Mode string `yaml:\"tier2_mode\" json:\"tier2_mode\"`\n\n\t// Tier3Mode controls Tier 3 execution: \"plan_and_approve\" or \"auto_apply\".\n\tTier3Mode string `yaml:\"tier3_mode\" json:\"tier3_mode\"`\n\n\t// ReconciliationInterval is how often drift detection runs (e.g., \"5m\").\n\tReconciliationInterval string `yaml:\"reconciliation_interval\" json:\"reconciliation_interval\"`\n\n\t// LockTimeout is the advisory lock TTL (e.g., \"10m\").\n\tLockTimeout string `yaml:\"lock_timeout\" json:\"lock_timeout\"`\n}\n```\nExecutionConfig controls how each tier's changes are applied and how often drift detection runs.\n\n```go\ntype FidelityGap struct {\n\t// Property is the capability property that has a fidelity gap.\n\tProperty string `json:\"property\"`\n\n\t// Description explains what is missing or different.\n\tDescription string `json:\"description\"`\n\n\t// Workaround describes what the provider does instead, if anything.\n\tWorkaround string `json:\"workaround,omitempty\"`\n}\n```\nFidelityGap describes a specific property that is not fully implemented by a provider for a given capability.\n\n```go\ntype FidelityGapError struct {\n\t// Provider is the provider that has the fidelity gap.\n\tProvider string\n\n\t// Capability is the capability type that is not fully supported.\n\tCapability string\n\n\t// Level is the actual fidelity level the provider offers.\n\tLevel FidelityLevel\n\n\t// Details describes what is missing.\n\tDetails string\n}\n```\nFidelityGapError is returned when a provider cannot satisfy a capability at the required fidelity level.\n\n```go\nfunc (e *FidelityGapError) Error() string\n```\nError implements the error interface.\n\n```go\ntype FidelityLevel string\n```\nFidelityLevel indicates how faithfully a provider implements a capability. Providers may not support all capabilities at full fidelity; this type makes gaps explicit so users can make informed decisions.\n\n```go\nconst (\n\t// FidelityFull indicates production-equivalent implementation.\n\tFidelityFull FidelityLevel = \"full\"\n\n\t// FidelityPartial indicates the capability works but with limitations.\n\tFidelityPartial FidelityLevel = \"partial\"\n\n\t// FidelityStub indicates a mock or no-op implementation (e.g., IAM on local).\n\tFidelityStub FidelityLevel = \"stub\"\n\n\t// FidelityNone indicates the capability is not supported by this provider.\n\tFidelityNone FidelityLevel = \"none\"\n)\n```\n\n```go\nfunc WorseOf(a, b FidelityLevel) FidelityLevel\n```\nWorseOf returns the lower fidelity level between two levels. The ordering from best to worst is: Full \u003e Partial \u003e Stub \u003e None.\n\n```go\ntype FidelityReport struct {\n\t// Capability is the abstract capability type being reported on.\n\tCapability string `json:\"capability\"`\n\n\t// Provider is the provider name.\n\tProvider string `json:\"provider\"`\n\n\t// Fidelity is the overall fidelity level for this capability.\n\tFidelity FidelityLevel `json:\"fidelity\"`\n\n\t// Gaps lists the specific properties that are not fully implemented.\n\tGaps []FidelityGap `json:\"gaps\"`\n}\n```\nFidelityReport is returned during plan generation to inform users of capability gaps in the current provider. It identifies which properties of a capability are not fully implemented.\n\n```go\nfunc (fr *FidelityReport) HasGaps() bool\n```\nHasGaps returns true if the fidelity report contains any gaps.\n\n```go\nfunc (fr *FidelityReport) IsFullFidelity() bool\n```\nIsFullFidelity returns true if the fidelity level is Full with no gaps.\n\n```go\ntype FieldChange = interfaces.FieldChange\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype HealthResult = interfaces.HealthResult\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype HealthStatus struct {\n\t// Status is the health state: \"healthy\", \"unhealthy\", \"degraded\", or \"unknown\".\n\tStatus string `json:\"status\"`\n\n\t// Message is a human-readable description of the health state.\n\tMessage string `json:\"message\"`\n\n\t// Details contains provider-specific health check details.\n\tDetails map[string]any `json:\"details,omitempty\"`\n\n\t// CheckedAt is when the health check was performed.\n\tCheckedAt time.Time `json:\"checkedAt\"`\n}\n```\nHealthStatus represents the health of a managed resource as reported by the provider.\n\n```go\ntype IaCProvider = interfaces.IaCProvider\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype IaCStateStore = interfaces.IaCStateStore\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype LockConflictError struct {\n\t// ContextPath is the context path that is locked.\n\tContextPath string\n\n\t// HeldBy is an identifier for the holder, if known.\n\tHeldBy string\n}\n```\nLockConflictError is returned when a lock cannot be acquired because another operation holds it.\n\n```go\nfunc (e *LockConflictError) Error() string\n```\nError implements the error interface.\n\n```go\ntype LockHandle interface {\n\t// Unlock releases the advisory lock.\n\tUnlock(ctx context.Context) error\n\n\t// Refresh extends the lock TTL to prevent expiration during long operations.\n\tRefresh(ctx context.Context, ttl time.Duration) error\n}\n```\nLockHandle represents an advisory lock on a context path. Locks prevent concurrent modifications and must be explicitly released.\n\n```go\ntype NotScalableError struct {\n\t// ResourceType is the resource type that does not support scaling.\n\tResourceType string\n}\n```\nNotScalableError is returned when a Scale operation is attempted on a resource type that does not support scaling.\n\n```go\nfunc (e *NotScalableError) Error() string\n```\nError implements the error interface.\n\n```go\ntype Plan struct {\n\t// ID is a unique identifier for this plan.\n\tID string `json:\"id\"`\n\n\t// Tier indicates which infrastructure tier this plan operates on.\n\tTier Tier `json:\"tier\"`\n\n\t// Context is the hierarchical context path (e.g., \"acme/production/api-service\").\n\tContext string `json:\"context\"`\n\n\t// Actions is the ordered list of changes to execute.\n\tActions []PlanAction `json:\"actions\"`\n\n\t// CreatedAt is when the plan was generated.\n\tCreatedAt time.Time `json:\"createdAt\"`\n\n\t// ApprovedAt is when the plan was approved (nil if pending).\n\tApprovedAt *time.Time `json:\"approvedAt,omitempty\"`\n\n\t// ApprovedBy is the principal who approved the plan.\n\tApprovedBy string `json:\"approvedBy,omitempty\"`\n\n\t// Status is the plan lifecycle state: \"pending\", \"approved\", \"applying\", \"applied\", \"failed\".\n\tStatus string `json:\"status\"`\n\n\t// Provider is the name of the provider that generated this plan.\n\tProvider string `json:\"provider\"`\n\n\t// DryRun indicates whether this plan was generated as a dry-run.\n\tDryRun bool `json:\"dryRun,omitempty\"`\n\n\t// FidelityReports contains any fidelity gap warnings from the provider.\n\tFidelityReports []FidelityReport `json:\"fidelityReports,omitempty\"`\n}\n```\nPlan is the complete execution plan for a set of infrastructure changes. Plans must be approved before they can be applied for Tier 1 and Tier 2.\n\n```go\ntype PlanAction struct {\n\t// Action is the operation type: \"create\", \"update\", \"delete\", or \"no-op\".\n\tAction string `json:\"action\"`\n\n\t// ResourceName is the name of the resource being changed.\n\tResourceName string `json:\"resourceName\"`\n\n\t// ResourceType is the provider-specific resource type.\n\tResourceType string `json:\"resourceType\"`\n\n\t// Provider is the name of the provider executing the action.\n\tProvider string `json:\"provider\"`\n\n\t// Before is the current state properties (nil for create actions).\n\tBefore map[string]any `json:\"before,omitempty\"`\n\n\t// After is the desired state properties (nil for delete actions).\n\tAfter map[string]any `json:\"after,omitempty\"`\n\n\t// Diff contains the individual field differences for update actions.\n\tDiff []DiffEntry `json:\"diff,omitempty\"`\n}\n```\nPlanAction represents a single planned change to infrastructure.\n\n```go\ntype PlanConflictError struct {\n\t// PlanID is the conflicting plan's identifier.\n\tPlanID string\n\n\t// ConflictingResource is the resource that has a conflicting change.\n\tConflictingResource string\n}\n```\nPlanConflictError is returned when a plan conflicts with another plan that is currently being applied or was recently applied.\n\n```go\nfunc (e *PlanConflictError) Error() string\n```\nError implements the error interface.\n\n```go\ntype PlatformConfig struct {\n\t// Org is the organization identifier (e.g., \"acme-corp\").\n\tOrg string `yaml:\"org\" json:\"org\"`\n\n\t// Environment is the target environment name (e.g., \"production\", \"staging\").\n\tEnvironment string `yaml:\"environment\" json:\"environment\"`\n\n\t// Provider configures the infrastructure provider to use.\n\tProvider ProviderConfig `yaml:\"provider\" json:\"provider\"`\n\n\t// Tiers defines the three-tier capability layout.\n\tTiers TiersConfig `yaml:\"tiers\" json:\"tiers\"`\n\n\t// Execution controls per-tier execution modes and reconciliation settings.\n\tExecution ExecutionConfig `yaml:\"execution\" json:\"execution\"`\n}\n```\nPlatformConfig is the top-level platform abstraction configuration. It describes the organization, environment, provider, tier layout, and execution policy for a deployment.\n\n```go\nfunc ParsePlatformConfig(raw map[string]any) (*PlatformConfig, error)\n```\nParsePlatformConfig converts a raw YAML map (typically from the \"platform\" key in WorkflowConfig) into a typed PlatformConfig. It re-marshals the map through YAML to leverage struct tags for parsing.\n\n```go\ntype PlatformContext struct {\n\t// Org is the organization identifier.\n\tOrg string `json:\"org\"`\n\n\t// Environment is the deployment environment name (e.g., \"production\", \"staging\", \"dev\").\n\tEnvironment string `json:\"environment\"`\n\n\t// Application is the application name. Empty for Tier 1 and Tier 2 contexts.\n\tApplication string `json:\"application\"`\n\n\t// Tier is the infrastructure tier this context operates at.\n\tTier Tier `json:\"tier\"`\n\n\t// ParentOutputs are resource outputs inherited from parent tiers, keyed by resource name.\n\tParentOutputs map[string]*ResourceOutput `json:\"parentOutputs\"`\n\n\t// Constraints are the accumulated constraints from all parent tiers.\n\tConstraints []Constraint `json:\"constraints\"`\n\n\t// Credentials holds resolved credential values for this scope.\n\t// This field is never serialized to prevent credential leakage.\n\tCredentials map[string]string `json:\"-\"`\n\n\t// Labels are metadata key-value pairs for resource tagging.\n\tLabels map[string]string `json:\"labels\"`\n\n\t// Annotations are metadata key-value pairs for operational metadata.\n\tAnnotations map[string]string `json:\"annotations\"`\n}\n```\nPlatformContext is the hierarchical context flowing through the tier system. It carries organization, environment, and application identifiers along with the accumulated outputs and constraints from parent tiers. Context flows downward: Tier 1 outputs feed Tier 2 inputs, Tier 2 outputs feed Tier 3.\n\n```go\nfunc (pc *PlatformContext) ContextPath() string\n```\nContextPath returns the full hierarchical path: \"org/env\" or \"org/env/app\".\n\n```go\ntype PlatformRBAC interface {\n\t// CanAuthor checks if a principal can define workflows at the given tier\n\t// and context path.\n\tCanAuthor(ctx context.Context, principal string, tier Tier, contextPath string) (bool, error)\n\n\t// CanApprove checks if a principal can approve plans at the given tier\n\t// and context path.\n\tCanApprove(ctx context.Context, principal string, tier Tier, contextPath string) (bool, error)\n\n\t// CanView checks if a principal can read state at the given tier\n\t// and context path.\n\tCanView(ctx context.Context, principal string, tier Tier, contextPath string) (bool, error)\n\n\t// EnforceConstraints validates that a set of capability declarations\n\t// does not exceed the constraints imposed by parent tiers.\n\t// This is called at plan time before any resources are provisioned.\n\tEnforceConstraints(pctx *PlatformContext, declarations []CapabilityDeclaration) ([]ConstraintViolation, error)\n}\n```\nPlatformRBAC enforces tier-based access control. It validates that principals have the required roles for the operations they attempt, and that capability declarations do not violate parent tier constraints.\n\n```go\ntype PropertySchema struct {\n\t// Name is the property identifier.\n\tName string `json:\"name\"`\n\n\t// Type is the property data type: \"string\", \"int\", \"bool\", \"duration\", \"map\", \"list\".\n\tType string `json:\"type\"`\n\n\t// Required indicates whether the property must be provided.\n\tRequired bool `json:\"required\"`\n\n\t// Description is a human-readable description of the property.\n\tDescription string `json:\"description\"`\n\n\t// DefaultValue is the value used when the property is not specified.\n\tDefaultValue any `json:\"defaultValue,omitempty\"`\n}\n```\nPropertySchema describes a property accepted by a capability.\n\n```go\ntype Provider interface {\n\t// Name returns the provider identifier (e.g., \"aws\", \"docker-compose\", \"gcp\").\n\tName() string\n\n\t// Version returns the provider version string.\n\tVersion() string\n\n\t// Initialize prepares the provider by authenticating and validating configuration.\n\tInitialize(ctx context.Context, config map[string]any) error\n\n\t// Capabilities returns the set of capability types this provider supports.\n\t// Used during plan-time to determine if a provider can satisfy a declaration.\n\tCapabilities() []CapabilityType\n\n\t// MapCapability resolves an abstract capability declaration to a provider-specific\n\t// resource plan. Returns an error if the capability cannot be satisfied.\n\tMapCapability(ctx context.Context, decl CapabilityDeclaration, pctx *PlatformContext) ([]ResourcePlan, error)\n\n\t// ResourceDriver returns the driver for a specific provider resource type.\n\t// Returns ErrResourceDriverNotFound if the resource type is not supported.\n\tResourceDriver(resourceType string) (ResourceDriver, error)\n\n\t// CredentialBroker returns the provider's credential management interface.\n\t// Returns nil if the provider does not support credential brokering.\n\tCredentialBroker() CredentialBroker\n\n\t// StateStore returns the provider's state persistence interface.\n\tStateStore() StateStore\n\n\t// Healthy returns nil if the provider is reachable and authenticated.\n\tHealthy(ctx context.Context) error\n\n\t// Close releases any resources held by the provider.\n\tClose() error\n}\n```\nProvider is the top-level interface for an infrastructure provider. A provider manages a collection of resource drivers and maps abstract capabilities to provider-specific resource types. Providers are registered with the engine and selected based on the platform configuration.\n\n### Three-Layer Provider Architecture {#hdr-Three_Layer_Provider_Architecture}\n\nThe workflow engine has three distinct provider abstractions. Each serves a different layer and MUST NOT be confused with the others:\n\n  - platform.Provider (this interface) — in-core, capability-based declarative abstraction used by the platform.\\* module system and pipeline steps (step.iac\\_plan, step.iac\\_apply, step.platform\\_template, etc.). Live implementations: DockerComposeProvider, MockProvider. The AWS implementation (platform/providers/aws/) was deleted in workflow v0.53.0 (issue #653 Phase 3) because it was build-tag-gated dead code with zero callers; see ADR-0032.\n\n  - interfaces.IaCProvider (in interfaces/iac\\_provider.go) — the gRPC plugin boundary interface used by the wfctl \\`infra.\\*\\` command suite. Implemented by external plugins (workflow-plugin-aws, workflow-plugin-gcp, etc.) via the typedIaCAdapter. This is the canonical AWS IaC path since v0.53.0.\n\n  - provider.CloudProvider (in provider/provider.go) — deploy-pipeline abstraction for container deployments (ECS/EKS/GKE). Used by step.deploy\\_rolling and the deployment executor. Orthogonal to both platform.Provider and interfaces.IaCProvider.\n\nWhen adding a new cloud provider implementation, choose the layer that matches the use case:\n\n  - IaC resource provisioning (VPCs, DBs, clusters): implement interfaces.IaCProvider as an external gRPC plugin.\n  - Container deployment pipelines: implement provider.CloudProvider in provider/.\n  - Local/mock/test capability-based planning: implement platform.Provider here.\n\n```go\ntype ProviderConfig struct {\n\t// Name is the provider identifier (e.g., \"aws\", \"docker-compose\", \"gcp\").\n\tName string `yaml:\"name\" json:\"name\"`\n\n\t// Config holds provider-specific configuration key-value pairs.\n\tConfig map[string]any `yaml:\"config,omitempty\" json:\"config,omitempty\"`\n}\n```\nProviderConfig identifies and configures an infrastructure provider.\n\n```go\ntype ProviderFactory func() Provider\n```\nProviderFactory is a constructor function for creating Provider instances.\n\n```go\ntype ProviderSizing = interfaces.ProviderSizing\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype ReconcileResult struct {\n\t// ContextPath is the context that was reconciled.\n\tContextPath string `json:\"contextPath\"`\n\n\t// DriftResults contains all detected drifts.\n\tDriftResults []DriftResult `json:\"driftResults\"`\n\n\t// CrossTierImpacts describes downstream impacts of detected drifts.\n\tCrossTierImpacts []CrossTierImpact `json:\"crossTierImpacts,omitempty\"`\n\n\t// CheckedAt is when the reconciliation was performed.\n\tCheckedAt time.Time `json:\"checkedAt\"`\n\n\t// Duration is how long the reconciliation took.\n\tDuration time.Duration `json:\"duration\"`\n\n\t// ResourcesChecked is the number of resources that were checked.\n\tResourcesChecked int `json:\"resourcesChecked\"`\n}\n```\nReconcileResult is the complete output of a reconciliation cycle.\n\n```go\ntype Reconciler struct {\n\t// contains filtered or unexported fields\n}\n```\nReconciler runs periodic drift detection by comparing stored state with live provider state. It identifies drifted, added, and removed resources and tracks cross-tier impact.\n\n```go\nfunc NewReconciler(provider Provider, store StateStore, contextPath string, interval time.Duration) *Reconciler\n```\nNewReconciler creates a new reconciler for the given provider and state store.\n\n```go\nfunc (r *Reconciler) Reconcile(ctx context.Context) (*ReconcileResult, error)\n```\nReconcile performs a single reconciliation cycle. It lists all resources in the context path from the state store, reads their live state from the provider, and compares to detect drift.\n\n```go\nfunc (r *Reconciler) ReconcileJSON(ctx context.Context) ([]byte, error)\n```\nReconcileJSON performs a reconciliation and returns the result as JSON. This is a convenience method for trigger integration.\n\n```go\nfunc (r *Reconciler) SetLogger(logger *log.Logger)\n```\nSetLogger sets a custom logger for the reconciler.\n\n```go\nfunc (r *Reconciler) Start(ctx context.Context) error\n```\nStart runs the reconciliation loop until the context is cancelled. It performs an immediate check on start and then at each interval.\n\n```go\ntype ReconcilerDriftReport struct {\n\tID           int64          `json:\"id\"`\n\tContextPath  string         `json:\"contextPath\"`\n\tResourceName string         `json:\"resourceName\"`\n\tResourceType string         `json:\"resourceType\"`\n\tTier         Tier           `json:\"tier\"`\n\tDriftType    string         `json:\"driftType\"`\n\tExpected     map[string]any `json:\"expected\"`\n\tActual       map[string]any `json:\"actual\"`\n\tDiffs        []DiffEntry    `json:\"diffs\"`\n\tDetectedAt   time.Time      `json:\"detectedAt\"`\n\tResolvedAt   *time.Time     `json:\"resolvedAt,omitempty\"`\n\tResolvedBy   string         `json:\"resolvedBy,omitempty\"`\n}\n```\nReconcilerDriftReport is the drift report type used by the reconciler. It matches the DriftReport in the state package but is defined here to avoid circular imports.\n\n```go\ntype ReconcilerStateStore interface {\n\tStateStore\n\tSaveDriftReport(ctx context.Context, report *ReconcilerDriftReport) error\n}\n```\nReconcilerStateStore extends StateStore with drift report capabilities. This interface is satisfied by the state package implementations.\n\n```go\ntype ResourceDriver interface {\n\t// ResourceType returns the fully qualified resource type (e.g., \"aws.eks_cluster\").\n\tResourceType() string\n\n\t// Create provisions a new resource with the given properties.\n\t// Returns the resource output when provisioning is complete.\n\tCreate(ctx context.Context, name string, properties map[string]any) (*ResourceOutput, error)\n\n\t// Read fetches the current state of an existing resource from the provider.\n\tRead(ctx context.Context, name string) (*ResourceOutput, error)\n\n\t// Update modifies an existing resource to match the desired properties.\n\t// Both current and desired property maps are provided for diffing.\n\tUpdate(ctx context.Context, name string, current, desired map[string]any) (*ResourceOutput, error)\n\n\t// Delete removes a resource from the provider.\n\tDelete(ctx context.Context, name string) error\n\n\t// HealthCheck returns the health status of a managed resource.\n\tHealthCheck(ctx context.Context, name string) (*HealthStatus, error)\n\n\t// Scale adjusts resource scaling parameters if the resource type supports it.\n\t// Returns ErrNotScalable if the resource type does not support scaling.\n\tScale(ctx context.Context, name string, scaleParams map[string]any) (*ResourceOutput, error)\n\n\t// Diff compares the desired properties with the actual provider state and\n\t// returns the list of field differences.\n\tDiff(ctx context.Context, name string, desired map[string]any) ([]DiffEntry, error)\n}\n```\nResourceDriver handles CRUD lifecycle for a specific provider resource type. Each provider composes multiple drivers, one per resource type it supports. Drivers are responsible for the actual interaction with the provider API.\n\n```go\ntype ResourceDriverNotFoundError struct {\n\t// ResourceType is the resource type that has no driver.\n\tResourceType string\n\n\t// Provider is the provider that was queried.\n\tProvider string\n}\n```\nResourceDriverNotFoundError is returned when a provider does not have a driver for the requested resource type.\n\n```go\nfunc (e *ResourceDriverNotFoundError) Error() string\n```\nError implements the error interface.\n\n```go\ntype ResourceHints = interfaces.ResourceHints\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype ResourceNotFoundError struct {\n\t// Name is the resource name that was not found.\n\tName string\n\n\t// Provider is the provider where the resource was expected.\n\tProvider string\n}\n```\nResourceNotFoundError is returned when a requested resource does not exist in the provider or state store.\n\n```go\nfunc (e *ResourceNotFoundError) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *ResourceNotFoundError) Is(target error) bool\n```\nIs reports whether target is interfaces.ErrResourceNotFound. Lets errors.Is(err, interfaces.ErrResourceNotFound) natively match this typed error without callers needing both errors.Is and errors.As.\n\n```go\ntype ResourceOutput struct {\n\t// Name is the resource identifier matching the CapabilityDeclaration name.\n\tName string `json:\"name\"`\n\n\t// Type is the abstract capability type.\n\tType string `json:\"type\"`\n\n\t// ProviderType is the provider-specific resource type (e.g., \"aws.eks_cluster\").\n\tProviderType string `json:\"providerType\"`\n\n\t// Endpoint is the primary access endpoint for the resource, if applicable.\n\tEndpoint string `json:\"endpoint,omitempty\"`\n\n\t// ConnectionStr is a connection string for database or messaging resources.\n\tConnectionStr string `json:\"connectionString,omitempty\"`\n\n\t// CredentialRef is a reference to a credential in the credential broker.\n\tCredentialRef string `json:\"credentialRef,omitempty\"`\n\n\t// Properties are provider-specific output properties.\n\tProperties map[string]any `json:\"properties\"`\n\n\t// Status is the current lifecycle state of the resource.\n\tStatus ResourceStatus `json:\"status\"`\n\n\t// LastSynced is the last time the resource state was read from the provider.\n\tLastSynced time.Time `json:\"lastSynced\"`\n}\n```\nResourceOutput represents the concrete output of a provisioned resource. These become inputs and constraints for downstream tiers.\n\n```go\ntype ResourcePlan struct {\n\t// ResourceType is the provider-specific resource type (e.g., \"aws.eks_nodegroup\").\n\tResourceType string `json:\"resourceType\"`\n\n\t// Name is the resource instance name.\n\tName string `json:\"name\"`\n\n\t// Properties are the provider-specific properties for the resource.\n\tProperties map[string]any `json:\"properties\"`\n\n\t// DependsOn lists other resource names that must be created first.\n\tDependsOn []string `json:\"dependsOn\"`\n}\n```\nResourcePlan is the provider-specific plan for a single resource. It is the output of capability mapping and the input to resource drivers.\n\n```go\ntype ResourceRef = interfaces.ResourceRef\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype ResourceSpec = interfaces.ResourceSpec\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype ResourceState = interfaces.ResourceState\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype ResourceStatus string\n```\nResourceStatus represents the lifecycle state of a managed resource.\n\n```go\nconst (\n\t// ResourceStatusPending indicates the resource has been declared but not yet provisioned.\n\tResourceStatusPending ResourceStatus = \"pending\"\n\n\t// ResourceStatusCreating indicates the resource is being provisioned.\n\tResourceStatusCreating ResourceStatus = \"creating\"\n\n\t// ResourceStatusActive indicates the resource is provisioned and healthy.\n\tResourceStatusActive ResourceStatus = \"active\"\n\n\t// ResourceStatusUpdating indicates the resource is being modified.\n\tResourceStatusUpdating ResourceStatus = \"updating\"\n\n\t// ResourceStatusDeleting indicates the resource is being torn down.\n\tResourceStatusDeleting ResourceStatus = \"deleting\"\n\n\t// ResourceStatusDeleted indicates the resource has been removed.\n\tResourceStatusDeleted ResourceStatus = \"deleted\"\n\n\t// ResourceStatusFailed indicates provisioning or update failed.\n\tResourceStatusFailed ResourceStatus = \"failed\"\n\n\t// ResourceStatusDegraded indicates the resource is running but not fully healthy.\n\tResourceStatusDegraded ResourceStatus = \"degraded\"\n\n\t// ResourceStatusDrifted indicates the actual state diverges from declared state.\n\tResourceStatusDrifted ResourceStatus = \"drifted\"\n)\n```\n\n```go\ntype Size = interfaces.Size\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype SizingDefaults = interfaces.SizingDefaults\n```\nIaC type aliases — re-export from interfaces/ for backward compatibility. Code that previously imported platform for these types can continue to do so.\n\n```go\ntype StateStore interface {\n\t// SaveResource persists the state of a resource within a context path.\n\tSaveResource(ctx context.Context, contextPath string, output *ResourceOutput) error\n\n\t// GetResource retrieves a resource's state by context path and resource name.\n\tGetResource(ctx context.Context, contextPath, resourceName string) (*ResourceOutput, error)\n\n\t// ListResources returns all resources in a context path.\n\tListResources(ctx context.Context, contextPath string) ([]*ResourceOutput, error)\n\n\t// DeleteResource removes a resource from state.\n\tDeleteResource(ctx context.Context, contextPath, resourceName string) error\n\n\t// SavePlan persists an execution plan.\n\tSavePlan(ctx context.Context, plan *Plan) error\n\n\t// GetPlan retrieves an execution plan by its ID.\n\tGetPlan(ctx context.Context, planID string) (*Plan, error)\n\n\t// ListPlans lists plans for a context path, ordered by creation time descending.\n\t// The limit parameter controls the maximum number of plans returned.\n\tListPlans(ctx context.Context, contextPath string, limit int) ([]*Plan, error)\n\n\t// Lock acquires an advisory lock for a context path to prevent concurrent\n\t// modifications to the same infrastructure. The TTL controls the maximum\n\t// lock duration.\n\tLock(ctx context.Context, contextPath string, ttl time.Duration) (LockHandle, error)\n\n\t// Dependencies returns dependency references for resources that depend on\n\t// the given resource.\n\tDependencies(ctx context.Context, contextPath, resourceName string) ([]DependencyRef, error)\n\n\t// AddDependency records a cross-resource or cross-tier dependency.\n\tAddDependency(ctx context.Context, dep DependencyRef) error\n}\n```\nStateStore manages the persistent state of provisioned resources. Each provider has its own state store, and there is an aggregate layer that spans across providers. State is partitioned by context path.\n\n```go\ntype StdContextResolver struct {\n\t// contains filtered or unexported fields\n}\n```\nStdContextResolver implements the ContextResolver interface. It builds PlatformContext instances by reading tier outputs from a StateStore and assembling the parent context chain with accumulated constraints.\n\n```go\nfunc NewStdContextResolver(store StateStore) *StdContextResolver\n```\nNewStdContextResolver creates a new StdContextResolver backed by the given StateStore.\n\n```go\nfunc (r *StdContextResolver) PropagateOutputs(ctx context.Context, pctx *PlatformContext, outputs []*ResourceOutput) error\n```\nPropagateOutputs writes resource outputs into the state store so that downstream tiers can resolve them via ResolveContext. It also stores any constraints defined in the context for downstream consumption.\n\n```go\nfunc (r *StdContextResolver) RegisterConstraints(ctx context.Context, pctx *PlatformContext, constraints []Constraint) error\n```\nRegisterConstraints stores constraints in the state store for a given tier context. These constraints will be picked up by ResolveContext when building contexts for downstream tiers.\n\n```go\nfunc (r *StdContextResolver) ResolveContext(ctx context.Context, org, env, app string, tier Tier) (*PlatformContext, error)\n```\nResolveContext builds a PlatformContext for the given tier and identifiers. It reads parent tier outputs from the state store, assembles them into the ParentOutputs map, and collects applicable constraints from all parent tiers.\n\nContext flows downward through the tier hierarchy:\n\n  - Tier 1 (Infrastructure): no parent outputs or constraints\n  - Tier 2 (SharedPrimitive): receives Tier 1 outputs and constraints\n  - Tier 3 (Application): receives Tier 1 + Tier 2 outputs and constraints\n\n```go\nfunc (r *StdContextResolver) ValidateTierBoundary(pctx *PlatformContext, declarations []CapabilityDeclaration) []ConstraintViolation\n```\nValidateTierBoundary ensures a workflow operating at the given tier does not attempt to modify resources outside its scope. Returns any constraint violations found.\n\n```go\ntype StdTemplateRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nStdTemplateRegistry is an in-memory implementation of the TemplateRegistry interface. It stores templates indexed by name and version, supports listing, and resolves templates by substituting parameters into capability declarations.\n\n```go\nfunc NewStdTemplateRegistry() *StdTemplateRegistry\n```\nNewStdTemplateRegistry creates a new in-memory template registry.\n\n```go\nfunc (r *StdTemplateRegistry) Get(_ context.Context, name, version string) (*WorkflowTemplate, error)\n```\nGet retrieves a template by name and version. If version is empty, it returns the latest version (determined by semver-like string sorting).\n\n```go\nfunc (r *StdTemplateRegistry) GetLatest(_ context.Context, name string) (*WorkflowTemplate, error)\n```\nGetLatest retrieves the latest version of a template by name.\n\n```go\nfunc (r *StdTemplateRegistry) List(_ context.Context) ([]*WorkflowTemplateSummary, error)\n```\nList returns summaries of all registered templates.\n\n```go\nfunc (r *StdTemplateRegistry) Register(_ context.Context, template *WorkflowTemplate) error\n```\nRegister adds a template to the registry. It returns an error if a template with the same name and version already exists, or if the template is invalid.\n\n```go\nfunc (r *StdTemplateRegistry) Resolve(_ context.Context, name, version string, params map[string]any) ([]CapabilityDeclaration, error)\n```\nResolve instantiates a template with the given parameters, producing concrete CapabilityDeclarations. If version is empty, the latest version is used.\n\n```go\ntype StdTierAuthorizer struct {\n\t// contains filtered or unexported fields\n}\n```\nStdTierAuthorizer is the standard implementation of TierAuthorizer. It holds a list of AuthzPolicy entries and checks incoming requests against them.\n\n```go\nfunc NewStdTierAuthorizer() *StdTierAuthorizer\n```\nNewStdTierAuthorizer creates a StdTierAuthorizer populated with default policies for the built-in roles.\n\nDefault policies:\n\n  - RoleTierAdmin: all tiers, all operations\n  - RoleTierAuthor: Tier 2 and 3, read and write operations\n  - RoleTierViewer: all tiers, read-only operations\n  - RoleTierApprover: Tier 1 and 2, read and approve operations\n\n```go\nfunc (a *StdTierAuthorizer) Authorize(_ context.Context, role TierRole, tier Tier, operation string) error\n```\nAuthorize checks whether role is permitted to perform operation on tier. It returns nil when authorized or a \\*TierBoundaryError when the role lacks sufficient privileges.\n\n```go\nfunc (a *StdTierAuthorizer) RegisterPolicy(policy AuthzPolicy)\n```\nRegisterPolicy adds or replaces a policy for the given role.\n\n```go\ntype TemplateOutput struct {\n\t// Name is the output identifier.\n\tName string `yaml:\"name\" json:\"name\"`\n\n\t// Value is an expression referencing a resource output (e.g., \"service-name.endpoint\").\n\tValue string `yaml:\"value\" json:\"value\"`\n}\n```\nTemplateOutput declares a named output of a template that references a resource output from the resolved capabilities.\n\n```go\ntype TemplateParameter struct {\n\t// Name is the parameter identifier used in placeholder expressions.\n\tName string `yaml:\"name\" json:\"name\"`\n\n\t// Type is the parameter data type: \"string\", \"int\", \"bool\", \"list\", \"map\".\n\tType string `yaml:\"type\" json:\"type\"`\n\n\t// Required indicates whether the parameter must be provided during resolution.\n\tRequired bool `yaml:\"required\" json:\"required\"`\n\n\t// Default is the value used when the parameter is not provided.\n\tDefault any `yaml:\"default,omitempty\" json:\"default,omitempty\"`\n\n\t// Description is a human-readable description of the parameter.\n\tDescription string `yaml:\"description,omitempty\" json:\"description,omitempty\"`\n\n\t// Validation is a regex pattern or constraint expression for validating the value.\n\tValidation string `yaml:\"validation,omitempty\" json:\"validation,omitempty\"`\n}\n```\nTemplateParameter describes a configurable input for a workflow template.\n\n```go\ntype TemplateRegistry interface {\n\t// Register adds or updates a template in the registry.\n\tRegister(ctx context.Context, template *WorkflowTemplate) error\n\n\t// Get retrieves a specific template by name and version.\n\tGet(ctx context.Context, name, version string) (*WorkflowTemplate, error)\n\n\t// GetLatest retrieves the latest version of a template by name.\n\tGetLatest(ctx context.Context, name string) (*WorkflowTemplate, error)\n\n\t// List returns summaries of all available templates.\n\tList(ctx context.Context) ([]*WorkflowTemplateSummary, error)\n\n\t// Resolve instantiates a template with the given parameters, producing\n\t// a set of concrete capability declarations.\n\tResolve(ctx context.Context, name, version string, params map[string]any) ([]CapabilityDeclaration, error)\n}\n```\nTemplateRegistry manages versioned platform workflow templates. Templates are parameterized, reusable definitions of capability declarations that can be instantiated with specific values.\n\n```go\ntype TemplateResolver struct{}\n```\nTemplateResolver resolves a WorkflowTemplate with concrete parameter values, producing a list of CapabilityDeclarations with all placeholders substituted.\n\n```go\nfunc NewTemplateResolver() *TemplateResolver\n```\nNewTemplateResolver creates a new TemplateResolver.\n\n```go\nfunc (r *TemplateResolver) Resolve(template *WorkflowTemplate, params map[string]any) ([]CapabilityDeclaration, error)\n```\nResolve substitutes parameter values into the template's capability declarations. It validates that all required parameters are present, applies defaults for optional parameters, and performs deep substitution in nested structures.\n\n```go\ntype Tier int\n```\nTier represents the infrastructure tier a resource belongs to. The three tiers form a hierarchy where each tier's outputs constrain the tier below it.\n\n```go\nconst (\n\t// TierInfrastructure represents Tier 1: compute, networking, IAM.\n\t// Changes are infrequent and approval-gated.\n\tTierInfrastructure Tier = 1\n\n\t// TierSharedPrimitive represents Tier 2: namespaces, queues, shared DBs.\n\t// Changes are moderate frequency.\n\tTierSharedPrimitive Tier = 2\n\n\t// TierApplication represents Tier 3: app deployments, scaling policies.\n\t// Changes are frequent and CI/CD-driven.\n\tTierApplication Tier = 3\n)\n```\n\n```go\nfunc (t Tier) String() string\n```\nString returns the human-readable name of the tier.\n\n```go\nfunc (t Tier) Valid() bool\n```\nValid returns true if the tier is a recognized value.\n\n```go\ntype TierAuthorizer interface {\n\t// Authorize checks whether the given role may perform operation on tier.\n\t// Returns nil if authorized, or a TierBoundaryError if not.\n\tAuthorize(ctx context.Context, role TierRole, tier Tier, operation string) error\n\n\t// RegisterPolicy adds or replaces a policy for the given role.\n\tRegisterPolicy(policy AuthzPolicy)\n}\n```\nTierAuthorizer checks whether a role is permitted to perform an operation on a given tier. It is the low-level authorization primitive used by middleware and the PlatformRBAC implementation.\n\n```go\ntype TierBoundaryError struct {\n\t// SourceTier is the tier the operation originated from.\n\tSourceTier Tier\n\n\t// TargetTier is the tier the operation attempted to reach.\n\tTargetTier Tier\n\n\t// Operation is the operation that was attempted.\n\tOperation string\n\n\t// Reason explains why the operation is not allowed.\n\tReason string\n}\n```\nTierBoundaryError is returned when an operation attempts to cross tier boundaries in a prohibited direction.\n\n```go\nfunc (e *TierBoundaryError) Error() string\n```\nError implements the error interface.\n\n```go\ntype TierConfig struct {\n\t// Capabilities lists the abstract resources declared in this tier.\n\tCapabilities []CapabilityConfig `yaml:\"capabilities,omitempty\" json:\"capabilities,omitempty\"`\n\n\t// ConstraintsForDownstream are hard limits imposed on lower tiers.\n\tConstraintsForDownstream []ConstraintConfig `yaml:\"constraints_for_downstream,omitempty\" json:\"constraints_for_downstream,omitempty\"`\n}\n```\nTierConfig describes the capabilities and downstream constraints for a single tier.\n\n```go\ntype TierRole string\n```\nTierRole defines what a principal can do within a specific tier. Roles are scoped to a tier and context path combination.\n\n```go\nconst (\n\t// RoleTierAdmin grants full CRUD on tier resources.\n\tRoleTierAdmin TierRole = \"tier_admin\"\n\n\t// RoleTierAuthor grants permission to create and update workflows for a tier.\n\tRoleTierAuthor TierRole = \"tier_author\"\n\n\t// RoleTierViewer grants read-only access to tier state.\n\tRoleTierViewer TierRole = \"tier_viewer\"\n\n\t// RoleTierApprover grants permission to approve plans for a tier.\n\tRoleTierApprover TierRole = \"tier_approver\"\n)\n```\n\n```go\ntype TiersConfig struct {\n\t// Infrastructure is Tier 1: compute, networking, IAM.\n\tInfrastructure TierConfig `yaml:\"infrastructure\" json:\"infrastructure\"`\n\n\t// SharedPrimitives is Tier 2: namespaces, queues, shared databases.\n\tSharedPrimitives TierConfig `yaml:\"shared_primitives\" json:\"shared_primitives\"`\n\n\t// Application is Tier 3: app deployments, scaling policies.\n\tApplication TierConfig `yaml:\"application\" json:\"application\"`\n}\n```\nTiersConfig groups the three infrastructure tiers.\n\n```go\ntype WorkflowTemplate struct {\n\t// Name is the template identifier.\n\tName string `yaml:\"name\" json:\"name\"`\n\n\t// Version is the template version following semantic versioning.\n\tVersion string `yaml:\"version\" json:\"version\"`\n\n\t// Description is a human-readable description of what the template provides.\n\tDescription string `yaml:\"description\" json:\"description\"`\n\n\t// Parameters are the configurable inputs for this template.\n\tParameters []TemplateParameter `yaml:\"parameters\" json:\"parameters\"`\n\n\t// Capabilities are the capability declarations with parameter placeholders.\n\tCapabilities []CapabilityDeclaration `yaml:\"capabilities\" json:\"capabilities\"`\n\n\t// Outputs are the declared outputs of this template, referencing resource outputs.\n\tOutputs []TemplateOutput `yaml:\"outputs\" json:\"outputs\"`\n\n\t// Tier is the infrastructure tier this template targets.\n\tTier Tier `yaml:\"tier\" json:\"tier\"`\n}\n```\nWorkflowTemplate is a parameterized, reusable platform workflow definition. Users define templates with parameters that are substituted at resolution time to produce concrete capability declarations.\n\n```go\ntype WorkflowTemplateSummary struct {\n\t// Name is the template identifier.\n\tName string `json:\"name\"`\n\n\t// Version is the template version.\n\tVersion string `json:\"version\"`\n\n\t// Description is a human-readable description.\n\tDescription string `json:\"description\"`\n\n\t// Parameters lists the parameter names accepted by this template.\n\tParameters []string `json:\"parameters\"`\n}\n```\nWorkflowTemplateSummary is a condensed view of a template for listing purposes.\n\n","path":"github.com/GoCodeAlone/workflow/platform","name":"platform","synopsis":"Package platform defines the core types and interfaces for the platform abstraction layer.","isRedistributable":true}
