gate

package
v0.12.0 Latest Latest
Warning

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

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

Documentation

Overview

Package gate decides whether a skill version may be published, held for review, or refused outright. It is pure: no database, no HTTP, no clock.

Index

Constants

View Source
const (
	// Unappealable: no evaluation overrides credential theft.
	ClassExfiltration = scan.ClassExfiltration
	ClassSecret       = scan.ClassSecret

	// Appealable: shape-based guesses a sandbox can verify.
	ClassExecution = scan.ClassExecution
	ClassInjection = scan.ClassInjection
	ClassHeuristic = scan.ClassHeuristic
)
View Source
const (
	ReasonScan      = "scan"
	ReasonOwnership = "ownership"
)

Hold reason kinds. Persisted wire names: renaming one makes every in-flight hold unclearable.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class = scan.Class

Class groups a scan finding by what kind of claim it makes. Severity says how confident the scanner is; class says whether an empirical measurement could ever overturn it. Type alias so gate.Class and scan.Class stay interchangeable.

func ClassOf

func ClassOf(category string) (Class, bool)

ClassOf maps a scan rule category onto a Class. The bool is false for an unmapped category; Decide treats unmapped as Block.

type Decision

type Decision struct {
	Outcome     Outcome          `json:"outcome"`
	Reasons     []Reason         `json:"reasons"`
	HoldReasons []string         `json:"hold_reasons"`
	Ownership   *OwnershipDetail `json:"ownership,omitempty"`
}

Decision is the whole verdict.

func Decide

func Decide(rep scan.Report, q *QualityState, o OwnerState, p Policy) Decision

Decide maps a scan report, quality state, and ownership onto an outcome. Pure: no database, HTTP, or clock.

func (Decision) Held

func (d Decision) Held() bool

Held reports whether this decision keeps the version out of circulation.

type Outcome

type Outcome string

Outcome is what the gate decided.

const (
	Allow            Outcome = "allow"
	AllowWithWarning Outcome = "allow_with_warning"
	NeedsReview      Outcome = "needs_review"
	Block            Outcome = "block"
)

type OwnerRef

type OwnerRef struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

OwnerRef identifies one owner for display in the CLI and review UI.

type OwnerState

type OwnerState struct {
	Evaluated   bool
	IsOwner     bool
	Unowned     bool
	RulePattern string
	Owners      []OwnerRef
}

OwnerState is the publisher's ownership standing. Evaluated is false when ownership was not determined (the CLI's local pre-scan). IsOwner folds in instance privilege, resolved at the HTTP boundary.

type OwnershipDetail

type OwnershipDetail struct {
	RulePattern string     `json:"rule_pattern,omitempty"`
	Owners      []OwnerRef `json:"owners"`
	Clears      string     `json:"clears"`
}

OwnershipDetail is the ownership half of a decision.

type Policy

type Policy struct {
	Floor         float64 // minimum headline score to clear a hold; 0 accepts any verified report
	AdminOverride bool    // resolved at the HTTP boundary
}

Policy is the deployment's configuration.

type QualityState

type QualityState struct {
	Verified                 bool
	PanelComplete            bool
	Headline                 float64
	CriticalForbidViolations int
}

QualityState is what is known about the version's measured behaviour. Nil means no measurement exists — not a zero score.

type Reason

type Reason struct {
	Rule     string `json:"rule"`
	Class    string `json:"class"`
	Severity string `json:"severity"`
	File     string `json:"file"`
	Line     int    `json:"line"`
	Message  string `json:"message"`
	// Clears states in one sentence what would resolve this finding.
	Clears string `json:"clears"`
}

Reason is one finding that drove the decision, rendered by the CLI and consumed by the review UI.

Jump to

Keyboard shortcuts

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