boundarycontract

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReviewStatusReviewed      = "reviewed"
	ReviewStatusPendingReview = "pending_review"
)
View Source
const RegistryVersion = 1
View Source
const ThreadstoreBoundaryManifestVersion = 1

Variables

This section is empty.

Functions

func LoadReviewedThreadstorePhysicalSchema

func LoadReviewedThreadstorePhysicalSchema(path string) (map[string][]string, map[string]string, map[string]string, error)

func Validate

func Validate(registry Registry, findings []Finding) []string

func ValidateThreadstoreBoundaryManifest

func ValidateThreadstoreBoundaryManifest(manifest ThreadstoreBoundaryManifest, schemaColumns map[string][]string, schemaIndexes map[string]string, schemaTriggers map[string]string, scanned []ThreadstoreQueryContract) []string

func WriteRegistry

func WriteRegistry(path string, registry Registry) error

func WriteThreadstoreBoundaryManifest

func WriteThreadstoreBoundaryManifest(path string, manifest ThreadstoreBoundaryManifest) error

Types

type Finding

type Finding struct {
	Path      string
	SHA256    string
	SinkKinds []string
	Tables    []string
	Keys      []string
	Codecs    []string
	DTOs      []string
}

func Scan

func Scan(root string) ([]Finding, error)

type Registry

type Registry struct {
	Version int             `json:"version"`
	Entries []RegistryEntry `json:"entries"`
}

func LoadRegistry

func LoadRegistry(path string) (Registry, error)

func RefreshRegistry

func RefreshRegistry(existing Registry, findings []Finding) Registry

RefreshRegistry preserves review metadata only when the previously reviewed source fingerprint and scanner inventory still match exactly. Every other finding requires an explicit human or agent review before validation passes.

type RegistryEntry

type RegistryEntry struct {
	Path         string   `json:"path"`
	SHA256       string   `json:"sha256"`
	SinkKinds    []string `json:"sink_kinds"`
	ReviewStatus string   `json:"review_status"`
	Owner        string   `json:"owner"`
	Authority    string   `json:"authority"`
	DataClasses  []string `json:"data_classes"`
	Tables       []string `json:"tables,omitempty"`
	Keys         []string `json:"keys,omitempty"`
	Codecs       []string `json:"codecs,omitempty"`
	DTOs         []string `json:"dtos,omitempty"`
	ReviewNote   string   `json:"review_note"`
}

func NewReviewedEntry

func NewReviewedEntry(finding Finding) RegistryEntry

type ThreadstoreBoundaryManifest

type ThreadstoreBoundaryManifest struct {
	Version int                        `json:"version"`
	Tables  []ThreadstoreTableContract `json:"tables"`
	Queries []ThreadstoreQueryContract `json:"queries"`
}

func LoadThreadstoreBoundaryManifest

func LoadThreadstoreBoundaryManifest(path string) (ThreadstoreBoundaryManifest, error)

func RefreshThreadstorePhysicalContracts

func RefreshThreadstorePhysicalContracts(manifest ThreadstoreBoundaryManifest, columns map[string][]string, indexes, triggers map[string]string) (ThreadstoreBoundaryManifest, error)

type ThreadstoreIndexUse

type ThreadstoreIndexUse struct {
	Name            string   `json:"name"`
	Purpose         string   `json:"purpose"`
	IntegrityOnly   bool     `json:"integrity_only"`
	AllowedQueryIDs []string `json:"allowed_query_ids"`
}

type ThreadstoreQueryContract

type ThreadstoreQueryContract struct {
	ID              string   `json:"id"`
	Path            string   `json:"path"`
	Function        string   `json:"function"`
	Method          string   `json:"method"`
	SQLSHA256       string   `json:"sql_sha256,omitempty"`
	BuilderSHA256   string   `json:"builder_sha256,omitempty"`
	Tables          []string `json:"tables,omitempty"`
	LookupKeys      []string `json:"lookup_keys,omitempty"`
	ReadColumns     []string `json:"read_columns,omitempty"`
	WriteColumns    []string `json:"write_columns,omitempty"`
	Action          string   `json:"action"`
	Consumer        string   `json:"consumer"`
	ConsumerKind    string   `json:"consumer_kind"`
	DynamicReview   string   `json:"dynamic_review,omitempty"`
	RenderedSQLExpr string   `json:"rendered_sql_expression,omitempty"`
}

func ScanThreadstoreSQL

func ScanThreadstoreSQL(root string) ([]ThreadstoreQueryContract, error)

type ThreadstoreTableContract

type ThreadstoreTableContract struct {
	Table                string                  `json:"table"`
	Columns              []string                `json:"columns"`
	Indexes              []string                `json:"indexes"`
	Triggers             []string                `json:"triggers"`
	IndexUses            []ThreadstoreIndexUse   `json:"index_uses"`
	TriggerUses          []ThreadstoreTriggerUse `json:"trigger_uses"`
	Owner                string                  `json:"owner"`
	Authority            string                  `json:"authority"`
	DataClass            string                  `json:"data_class"`
	AllowedPurpose       string                  `json:"allowed_purpose"`
	AllowedLookupKeys    []string                `json:"allowed_lookup_keys"`
	Consumers            []string                `json:"consumers"`
	RetentionOrDeletion  string                  `json:"retention_or_deletion"`
	CanonicalIdentity    string                  `json:"canonical_identity"`
	APIUIVisibility      string                  `json:"api_ui_visibility"`
	LifecycleProhibition string                  `json:"lifecycle_prohibition"`
	Phase1CDecision      string                  `json:"phase_1c_decision,omitempty"`
}

type ThreadstoreTriggerUse

type ThreadstoreTriggerUse struct {
	Name            string   `json:"name"`
	Purpose         string   `json:"purpose"`
	AllowedQueryIDs []string `json:"allowed_query_ids"`
}

Jump to

Keyboard shortcuts

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