Documentation
¶
Index ¶
Constants ¶
const ( Version = 1 ResolverVersion = 1 MaximumItemCount = 12 MaximumStackHeight = 3 )
Variables ¶
This section is empty.
Functions ¶
func ContentHash ¶
ContentHash is the SHA-256 of normalized compact JSON with spec_hash blank, matching the established Spatial Contract hashing convention.
Types ¶
type Member ¶
type Member struct {
DescriptorID string `json:"descriptor_id"`
MinimumCount int `json:"minimum_count"`
MaximumCount int `json:"maximum_count"`
SelectionWeight float64 `json:"selection_weight"`
AffinityGroup string `json:"affinity_group"`
}
Member describes one eligible descriptor and its count range in an arrangement. SelectionWeight is a normalized, relative preference; it does not relax any geometry or support validation.
type Spec ¶
type Spec struct {
SurfaceArrangementVersion int `json:"surface_arrangement_version"`
ArrangementID string `json:"arrangement_id"`
TargetElementID string `json:"target_element_id"`
TargetFrameID string `json:"target_frame_id"`
Members []Member `json:"members"`
Preset Preset `json:"preset"`
Amount float64 `json:"amount"`
Orderliness float64 `json:"orderliness"`
Grouping float64 `json:"grouping"`
Stacking float64 `json:"stacking"`
EdgeMargin float64 `json:"edge_margin"`
MaxStackHeight int `json:"max_stack_height"`
SeedOffset int64 `json:"seed_offset"`
ResolverVersion int `json:"resolver_version"`
SpecHash string `json:"spec_hash"`
}
Spec is independent from Spatial Contract v1. It describes how already approved support interactions may be composed on a target surface.
func Decode ¶
Decode rejects unknown fields and trailing JSON, normalizes stable fields, and strictly verifies the required spec_hash. Draft authoring and repair tools must use DecodeForHash so the validate path cannot bless an unhashed document by inventing its integrity value.
func DecodeForHash ¶
DecodeForHash is the schema-strict parsing path for recomputing a spec hash. It validates raw values but replaces (rather than verifies) a missing or stale embedded spec_hash.
func LoadForHash ¶
LoadForHash loads and validates a spec while intentionally ignoring an embedded spec_hash. It is used by the read-only hash command so callers can calculate the replacement for a stale hash without weakening validation.