capability

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package capability owns FlowBaton's executable support classifications and graph-wide fail-closed analysis.

Index

Constants

View Source
const RegistryVersionV0 = "flowbaton.support/v0"

RegistryVersionV0 identifies the first frozen support registry contract.

Variables

View Source
var ErrFlowDirectory = errors.New("flow link is a directory")

ErrFlowDirectory identifies a path that resolves to a directory rather than a file resource.

View Source
var ErrFlowNonRegular = errors.New("flow link is not a regular file")

ErrFlowNonRegular identifies a path that resolves to a FIFO, socket, device, or another non-regular resource that must never be opened during preflight.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Kind          FeatureKind   `json:"kind"`
	Name          string        `json:"name"`
	ParseStatus   ParseStatus   `json:"parseStatus"`
	RuntimeStatus RuntimeStatus `json:"runtimeStatus"`
	Platforms     []string      `json:"platforms,omitempty"`
	Reason        string        `json:"reason"`
}

Entry is the stable generic support-registry schema.

type FeatureKind

type FeatureKind string

FeatureKind identifies the catalog containing an entry.

const (
	FeatureCommand         FeatureKind = "command"
	FeatureSelector        FeatureKind = "selector-feature"
	FeatureConfigExtension FeatureKind = "config-extension"
	FeatureCLISubcommand   FeatureKind = "cli-subcommand"
	FeatureCLIFlag         FeatureKind = "cli-flag"
	FeatureHostTarget      FeatureKind = "host-target"
	FeatureDevicePlatform  FeatureKind = "device-platform"
)

type FileLoader

type FileLoader struct{}

FileLoader is the default read-only filesystem/parser adapter.

func (FileLoader) Canonical

func (FileLoader) Canonical(ctx context.Context, path string) (string, error)

Canonical returns an absolute, symlink-resolved file identity.

func (FileLoader) Load

func (FileLoader) Load(ctx context.Context, canonicalPath string) (model.Flow, error)

Load parses one already canonicalized flow file.

type FlowLoader

type FlowLoader interface {
	Canonical(context.Context, string) (string, error)
	Load(context.Context, string) (model.Flow, error)
}

FlowLoader separates canonical identity from parsing so the checker can cache each canonical flow while retaining every call-site edge.

type GraphEdge

type GraphEdge struct {
	From   string             `json:"from"`
	To     string             `json:"to"`
	Kind   model.FileLinkKind `json:"kind"`
	Source model.SourceInfo   `json:"-"`
}

GraphEdge retains every flow, script, and media call site. Source carries local diagnostics and is excluded from contract snapshots.

type GraphNode

type GraphNode struct {
	Path string `json:"path"`
}

GraphNode is one canonical flow loaded and analyzed exactly once.

type Option

type Option func(*checkConfig)

Option configures Check without introducing device, asset, JS, or session dependencies.

func WithLoader

func WithLoader(loader FlowLoader) Option

WithLoader supplies a pure flow/resource loader, primarily for deterministic tests and alternate read-only filesystems.

func WithRegistry

func WithRegistry(registry Registry) Option

WithRegistry supplies the frozen registry used by capability analysis.

type ParseStatus

type ParseStatus string

ParseStatus records whether the syntax is recognized by the v0 contract.

const (
	ParseStatusParseable ParseStatus = "parseable"
	ParseStatusOmitted   ParseStatus = "omitted"
)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is an immutable-by-convention versioned entry set.

func DefaultRegistry

func DefaultRegistry() Registry

DefaultRegistry returns the exhaustive v0 support registry.

func NewRegistry

func NewRegistry(version string, entries []Entry) Registry

NewRegistry constructs a registry from defensively copied entries.

func (Registry) Entries

func (r Registry) Entries() []Entry

Entries returns a deep defensive copy in stable catalog order.

func (Registry) Lookup

func (r Registry) Lookup(kind FeatureKind, name string) (Entry, bool)

Lookup returns one exact catalog entry.

func (Registry) Validate

func (r Registry) Validate() error

Validate fails closed on missing, duplicate, contradictory, invalid, or undeclared entries.

func (Registry) Version

func (r Registry) Version() string

Version returns the registry contract version.

type Report

type Report struct {
	Roots []string    `json:"roots"`
	Nodes []GraphNode `json:"nodes"`
	Edges []GraphEdge `json:"edges"`
}

Report is the deterministic selected-root graph proven by preflight.

func Check

func Check(ctx context.Context, plan model.ExecutionPlan, options ...Option) (Report, error)

Check validates the registry and selected execution roots, constructs the canonical graph iteratively, and rejects every reachable unsupported capability or invalid resource before any mutating subsystem can be opened.

type RuntimeStatus

type RuntimeStatus string

RuntimeStatus records the declared v1 execution posture.

const (
	RuntimeStatusPlannedV1       RuntimeStatus = "planned-v1"
	RuntimeStatusPlatformLimited RuntimeStatus = "platform-limited"
	RuntimeStatusDeferred        RuntimeStatus = "deferred"
	RuntimeStatusExcluded        RuntimeStatus = "excluded"
)

type Violation

type Violation struct {
	Code        string           `json:"code"`
	Message     string           `json:"message"`
	FeatureKind FeatureKind      `json:"featureKind,omitempty"`
	FeatureName string           `json:"featureName,omitempty"`
	Source      model.SourceInfo `json:"-"`
	Chain       []GraphEdge      `json:"chain,omitempty"`
	Cause       error            `json:"-"`
}

Violation is a fail-closed, location-aware preflight error.

func (Violation) Error

func (v Violation) Error() string

Error renders a deterministic local diagnostic including its edge chain.

func (Violation) Unwrap

func (v Violation) Unwrap() error

Unwrap exposes the underlying filesystem or parse error.

Jump to

Keyboard shortcuts

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