managedentitlement

package
v0.42.0 Latest Latest
Warning

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

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

Documentation

Overview

Package managedentitlement is the fail-closed availability gate for publisher-tagged managed (S2/S3) StackKits surfaces.

Standalone OSS paths stay ungated. A missing source, a check error, an empty decision, or any non-allow is denied before the caller may perform HTTP or other cost-bearing side effects. HMAC service tokens are not a source.

Index

Constants

View Source
const (
	// FeatureManagedServerless is the commercial feature required for kombify
	// to provision or operate the managed-serverless half of a StackKit.
	FeatureManagedServerless = "stackkits.managed_serverless"

	CapabilityBackupEnroll = "stackkits.managed.backup.enroll"

	ErrorCode = "feature_entitlement_denied"

	ReasonSourceUnavailable = "entitlement_source_unavailable"
	ReasonCheckFailed       = "entitlement_check_failed"
	ReasonDenied            = "entitlement_denied"
)

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(ctx context.Context, capability string) error

Evaluate fails closed for capability. Nil context is accepted.

func OverrideSource

func OverrideSource(next Source) func()

OverrideSource installs source for the current process and returns a restore function. Tests use this to inject an allow; production leaves the source nil until the managed entitlement adapter is wired.

Types

type Decision

type Decision struct {
	Allowed          bool
	ReasonCode       string
	RequiredFeatures []string
	MissingFeatures  []string
}

Decision is the single allow/deny result consumed by CLI, MCP, and jobs.

type Denial

type Denial struct {
	ErrorCode        string
	ReasonCode       string
	Capability       string
	RequiredFeatures []string
	MissingFeatures  []string
	Retryable        bool
	UserGuidance     UserGuidance
	Remediation      string
	SupportContext   SupportContext
}

Denial is returned for every failed Evaluate. It is the FEATURE-ENTITLEMENT envelope plus the CLI actionable-error contract.

func (*Denial) Envelope

func (d *Denial) Envelope() map[string]any

Envelope is the FEATURE-ENTITLEMENT-UX-STANDARD §1.4 object, with CLI actionable-error aliases so `--json` consumers keep a parseable contract.

func (*Denial) Error

func (d *Denial) Error() string

type Source

type Source interface {
	Decide(ctx context.Context, capability string) (Decision, error)
}

Source returns one availability decision for a managed capability.

func AllowAll

func AllowAll() Source

AllowAll is an explicit positive decision used by tests that exercise the allowed managed path. It is not a production adapter.

func CurrentSource

func CurrentSource() Source

CurrentSource is the process-wide entitlement source. Nil is deny.

type SupportContext

type SupportContext struct {
	FeatureSource string `json:"feature_source"`
	CostBearing   bool   `json:"cost_bearing"`
}

SupportContext is operator/agent handoff for a managed entitlement denial.

type UserGuidance

type UserGuidance struct {
	Title     string   `json:"title"`
	Body      string   `json:"body"`
	NextSteps []string `json:"next_steps"`
}

UserGuidance is the human-readable half of FEATURE-ENTITLEMENT-UX-STANDARD §1.4.

Jump to

Keyboard shortcuts

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