diagnostics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package diagnostics provides non-serving inspect and explicit doctor checks for external backend plugins (manifest/catalog without launch; selected Activate).

Index

Constants

View Source
const DefaultHostProtocolMajor uint32 = 1

DefaultHostProtocolMajor is the host ABI major version used for inspect compatibility.

Variables

This section is empty.

Functions

func DiscoveryFromConfig

func DiscoveryFromConfig(bd config.BackendDiscoveryConfig) discovery.Config

DiscoveryFromConfig maps typed plugins.backend_discovery onto discovery.Config. When discovery is disabled, the returned config has no roots (Inspect skips Discover).

Types

type CatalogResolution

type CatalogResolution struct {
	Discovered  []discovery.Descriptor
	TrustBySafe map[string]trust.VerifyResult
	Snapshot    catalog.Snapshot
	CatalogErr  error
	HostMajor   uint32
	HostMinor   uint32
}

CatalogResolution is the immutable discover→trust→catalog snapshot shared by inspect reporting and serve install preparation.

func ResolveCatalog

func ResolveCatalog(in InspectInput) (CatalogResolution, error)

ResolveCatalog runs deterministic discovery, trust verification, and catalog resolve without launching processes. Inspect and serve must call this (or a thin wrapper) so conflict/reason policy cannot diverge.

type ConfiguredBackend

type ConfiguredBackend struct {
	InstanceID string
	Kind       string
	Enabled    bool
}

ConfiguredBackend is one enabled/disabled backend row from operator config.

type DoctorInput

type DoctorInput struct {
	InstanceIDs []string
	Targets     map[string]DoctorTarget
	Host        *processhost.Host
	// DialAndConfigure defaults to a no-op success after peer auth (channel check).
	DialAndConfigure func(ctx context.Context, conn net.Conn, peer processhost.PeerIdentity, generation uint64, secrets backendplugin.SecretBundle, configYAML []byte) error
}

DoctorInput runs Activate only for explicit InstanceIDs.

type DoctorReport

type DoctorReport struct {
	Results []DoctorResult `json:"results"`
}

DoctorReport aggregates selected-instance doctor results.

func Doctor

func Doctor(ctx context.Context, in DoctorInput) (DoctorReport, error)

Doctor launches only the selected configured instance IDs. It never walks discovered plugins and never delivers secrets when peer/channel auth fails (processhost.Activate withholds DialAndConfigure until peer success).

type DoctorResult

type DoctorResult struct {
	InstanceID string        `json:"instance_id"`
	Kind       string        `json:"kind,omitempty"`
	State      catalog.State `json:"state"`
	Reason     string        `json:"reason"`
	Guidance   string        `json:"guidance,omitempty"`
	Launched   bool          `json:"launched"`
}

DoctorResult is a bounded per-instance doctor outcome (no secrets/full paths).

type DoctorTarget

type DoctorTarget struct {
	InstanceID string
	Kind       string
	Artifact   *trust.VerifiedArtifact
	ConfigYAML []byte
	Secrets    backendplugin.SecretBundle
	Model      processhost.ProcessModel
}

DoctorTarget is one explicitly selected configured plugin instance.

type Entry

type Entry struct {
	Source             string         `json:"source"` // builtin | discovered | configured
	InstanceID         string         `json:"instance_id,omitempty"`
	SafeID             string         `json:"safe_id,omitempty"`
	PluginID           string         `json:"plugin_id,omitempty"`
	Kind               string         `json:"kind,omitempty"`
	State              catalog.State  `json:"state"`
	Reason             catalog.Reason `json:"reason,omitempty"`
	Owners             []string       `json:"owners,omitempty"`
	ActivationRequired bool           `json:"activation_required"`
}

Entry is one bounded inspect row (no secrets or full filesystem paths in Reason).

type InspectInput

type InspectInput struct {
	DiscoveryEnabled bool
	Discovery        discovery.Config
	BuiltinKinds     []string
	Configured       []ConfiguredBackend
	Strict           bool
	HostMajor        uint32
	HostMinor        uint32
	StagingDir       string
	// Trust is optional; defaults to trust.Verify.
	Trust TrustFunc
	// Discover is optional; defaults to discovery.Discover (tests may stub).
	Discover func(discovery.Config) (discovery.Result, error)
}

InspectInput configures a non-executing inspect pass.

type Report

type Report struct {
	Entries            []Entry                     `json:"entries"`
	CompatibleBackends []diag.CompatibleBackendRow `json:"compatible_backends,omitempty"`
}

Report is the inspect snapshot.

func FormatInspectReport

func FormatInspectReport(res CatalogResolution, builtinKinds []string, configured []ConfiguredBackend) Report

FormatInspectReport projects a CatalogResolution into operator-facing entries.

func FormatInspectReportWithCompatible

func FormatInspectReportWithCompatible(res CatalogResolution, builtinKinds, builtinCompatibleKinds []string, configured []ConfiguredBackend) Report

FormatInspectReportWithCompatible splits native built-ins from built-in-compatible factory kinds.

func Inspect

func Inspect(in InspectInput) (Report, error)

Inspect scans/parses/trusts/catalogs without process launch.

func (Report) WithCompatibleBackends

func (r Report) WithCompatibleBackends(rows []diag.CompatibleBackendRow) Report

WithCompatibleBackends attaches config-derived compatible rows to a report.

type TrustFunc

type TrustFunc func(root string, m sdkmanifest.Manifest, opt trust.VerifyOptions) trust.VerifyResult

TrustFunc verifies a discovered manifest executable without launching it.

Jump to

Keyboard shortcuts

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