contractfinal

package
v1.0.60-beta.2 Latest Latest
Warning

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

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

Documentation

Overview

Package contractfinal owns the Cobra-keyed ContractFinal runtime store and the annotate+store registration seam.

All registration — products, helpers, shortcuts, and framework code (corecmd.AttachContract) — calls RegisterRuntimeContractFinal here directly. internal/corecmd never imports any internal/cli package.

Types remain in internal/corecmd/contract (DTO only — no cobra store). Annotate writers live in internal/corecmd/runtimeannotate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyParamDecls

func ApplyParamDecls(cmd *cobra.Command, decls []contract.ParamDecl) error

ApplyParamDecls emits parameter declarations as dws.schema.* annotations on the command's flags. Called at assembly time when all flags exist on the tree. Each non-blank ParamDecl.Name must resolve to an existing Cobra flag; unknown names fail closed so typos cannot silently drop during generation.

func ClearRuntimeContractFinalForTest

func ClearRuntimeContractFinalForTest(cmd *cobra.Command)

ClearRuntimeContractFinalForTest removes a registration (tests only).

func HasDeclaredOrAnnotatedConfirmation

func HasDeclaredOrAnnotatedConfirmation(cmd *cobra.Command) bool

HasDeclaredOrAnnotatedConfirmation reports whether confirmation semantics are covered by typed Contract SafetySpec. The risk/gate annotation branches are residual bridges: their production writers are retired, so they only fire for hand-built annotations (tests and overlay-bridge probes).

func HasRuntimeContractFinal

func HasRuntimeContractFinal(cmd *cobra.Command) bool

HasRuntimeContractFinal reports whether the leaf has a registered final overlay.

func RegisterRuntimeContractFinal

func RegisterRuntimeContractFinal(cmd *cobra.Command, payload contract.ContractFinalPayload)

RegisterRuntimeContractFinal annotates dws.schema.contract then stores the typed final Schema overlay. This is the atomic annotate+store implementation.

Ownership lives under the command framework (this package). All callers — products and corecmd.AttachContract alike — call this function directly.

func ResolveRuntimeSafety added in v1.0.58

func ResolveRuntimeSafety(canonicalPath, cliPath string) (safety contract.SafetySpec, declared, ok bool)

ResolveRuntimeSafety finds the live ContractFinal safety declaration for an invocation identity. declared distinguishes a matched declaration whose safety is unavailable or conflicting from a legacy invocation with no unified declaration context. Repeated equivalent command-tree registrations are accepted; conflicting matches fail closed with ok=false.

func RuntimeContractFinal

func RuntimeContractFinal(cmd *cobra.Command) (contract.ContractFinalPayload, bool)

RuntimeContractFinal returns the registered final Schema overlay (read-only).

func StoreRuntimeContractFinalRawForTest

func StoreRuntimeContractFinalRawForTest(cmd *cobra.Command, raw any)

StoreRuntimeContractFinalRawForTest injects a raw map value (tests only).

Types

This section is empty.

Jump to

Keyboard shortcuts

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