Documentation
¶
Overview ¶
Package authority manages source authority for catalog data reconciliation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchesPattern ¶
MatchesPattern checks if a field path matches a pattern (supports * wildcards).
Types ¶
type AttributePolicy ¶ added in v0.1.0
type AttributePolicy struct {
Resource sources.ResourceType
Path string
AuthorityOrder []sources.ID
Merge MergePolicy
Empty EmptyPolicy
Rationale string
}
AttributePolicy is the complete merge contract for one canonical field family.
func CanonicalPolicies ¶ added in v0.1.0
func CanonicalPolicies(resource sources.ResourceType) []AttributePolicy
CanonicalPolicies returns a caller-owned policy inventory for a canonical resource.
func FindCanonicalPolicy ¶ added in v0.1.0
func FindCanonicalPolicy(resource sources.ResourceType, path string) (AttributePolicy, bool)
FindCanonicalPolicy returns the policy whose pattern covers path.
type Authority ¶
type Authority interface {
// Find returns the authority configuration for a specific field
Find(resourceType sources.ResourceType, fieldPath string) *Field
// List returns all authorities for a resource type
ModelFields() []Field
ProviderFields() []Field
AuthorFields() []Field
}
Authority determines which source is authoritative for each field.
type EmptyPolicy ¶ added in v0.1.0
type EmptyPolicy string
EmptyPolicy defines whether a Go zero/empty value carries source evidence.
const ( // EmptyReject makes an empty identity or required field invalid. EmptyReject EmptyPolicy = "reject" // EmptyAbsent treats nil/empty as no claim and permits fallback. EmptyAbsent EmptyPolicy = "absent" // EmptyAuthoritative preserves explicit zero and false values as evidence. EmptyAuthoritative EmptyPolicy = "authoritative" )
type Field ¶
type Field struct {
Path string `json:"path" yaml:"path"` // e.g., "pricing.input", "metadata.knowledge_cutoff"
Source sources.ID `json:"source" yaml:"source"` // Which source is authoritative
Priority int `json:"priority" yaml:"priority"` // Priority (higher = more authoritative)
}
Field defines source priority for a specific field.
type MergePolicy ¶ added in v0.1.0
type MergePolicy string
MergePolicy defines how accepted values compose after authority selection.
const ( // MergeIdentity requires one stable value and rejects disagreement. MergeIdentity MergePolicy = "identity" // MergeReplace selects one complete value without mixing subfields. MergeReplace MergePolicy = "replace" // MergeFillMissing accepts lower-authority values only for absent subfields. MergeFillMissing MergePolicy = "fill_missing" // MergeSetUnion combines unique members while preserving authority order. MergeSetUnion MergePolicy = "set_union" // MergeDeep combines named maps/records while resolving each leaf by authority. MergeDeep MergePolicy = "deep_merge" )