Clarify resolution metadata and sensitivity names
This commit is contained in:
29
lifecycle.go
29
lifecycle.go
@@ -7,14 +7,14 @@ import (
|
||||
)
|
||||
|
||||
// Definition contains reusable application rules for a configuration type.
|
||||
// Secret is a pure predicate that can add sensitivity to semantic paths.
|
||||
// Sensitive is a pure predicate that can add sensitivity to semantic paths.
|
||||
// Definitions should be treated as read-only after being shared.
|
||||
type Definition[T any] struct {
|
||||
Defaults func() T
|
||||
Resolve func(*T, *Resolution) error
|
||||
Validate func(*T, *Validation)
|
||||
Version *VersionRule
|
||||
Secret func(Path) bool
|
||||
Defaults func() T
|
||||
Resolve func(*T, *Resolution) error
|
||||
Validate func(*T, *Validation)
|
||||
Version *VersionRule
|
||||
Sensitive func(Path) bool
|
||||
// SequenceIdentities declares the scalar fields used to combine records and
|
||||
// resolve record inheritance at selected sequence destinations. Registration
|
||||
// errors are reported before source acquisition. Before successful return,
|
||||
@@ -234,14 +234,15 @@ func (r *Resolution) IsExplicit(path Path) bool {
|
||||
return r.engineContext().IsExplicit(toEnginePath(path))
|
||||
}
|
||||
|
||||
// InputInfo returns detached entry-state metadata for path. The entry state is
|
||||
// the decoded configuration, including retained static defaults, immediately
|
||||
// before resolution starts. It is fixed while resolution records mutate the
|
||||
// working configuration; unknown or shape-mismatched paths return false.
|
||||
// EntryInfo returns detached entry-state metadata for path. The entry state is
|
||||
// the decoded configuration, including retained static defaults and CLI
|
||||
// assignments, immediately before resolution starts. It is fixed while
|
||||
// resolution records mutate the working configuration; unknown or
|
||||
// shape-mismatched paths return false.
|
||||
//
|
||||
// InputInfo is valid only during the resolution callback. See the configuration
|
||||
// EntryInfo is valid only during the resolution callback. See the configuration
|
||||
// contract for source and provenance semantics.
|
||||
func (r *Resolution) InputInfo(path Path) (FieldInfo, bool) {
|
||||
func (r *Resolution) EntryInfo(path Path) (FieldInfo, bool) {
|
||||
value, ok := r.engineContext().InputInfo(toEnginePath(path))
|
||||
return fromEngineFieldInfo(value), ok
|
||||
}
|
||||
@@ -368,8 +369,8 @@ func toEngineDefinition[T any](definition Definition[T]) engine.Definition[T] {
|
||||
}
|
||||
}
|
||||
}
|
||||
if definition.Secret != nil {
|
||||
result.Secret = func(path engine.Path) bool { return definition.Secret(fromEnginePath(path)) }
|
||||
if definition.Sensitive != nil {
|
||||
result.Secret = func(path engine.Path) bool { return definition.Sensitive(fromEnginePath(path)) }
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user