Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config loads and saves ~/.config/bentoo/config.yaml: the overlay, git identity, autoupdate, validation, UI, notice and tray settings.

Every default comes from a getter rather than a struct literal, so an absent, partial or nil block resolves the same way. Unknown keys never stop a load: a strict second decode reports them as warnings. Secrets are not read from this file; package secrets resolves them.

Index

Constants

View Source
const (
	DefaultDepthRevision = "options"
	DefaultDepthPatch    = "options"
	DefaultDepthSeries   = "configure"
	DefaultDepthMajor    = "configure"
)

The default depth for each bump class. revision and patch are the cheap, frequent bumps and stop at the static gate; series and major cross a boundary upstream chose to mark, so they earn a configure. No class defaults to compile — see ValidateConfig's doc comment.

THEY DID NOT MOVE WHEN THE INSTALL RUNG WAS ADDED, and that is a decision rather than an omission. Adding a rung is a capability; promoting a default is a cost decision belonging to whoever pays for the hours, and an operator who upgrades the binary without reading the changelog must find yesterday's sweep costing what it cost yesterday. `install` is reached by --depth=install or by an explicit key here, never by default.

View Source
const (
	// DefaultTrayInterval is how often bentoo-tray checks the feed when
	// tray.interval is absent.
	DefaultTrayInterval = 6 * time.Hour
	// MinTrayInterval is the floor tray.interval is clamped to.
	MinTrayInterval = time.Hour
	// DefaultTrayFeedURL is the notices feed bentoo-tray reads by default.
	DefaultTrayFeedURL = "https://obentoo.org/notices.json"
)
View Source
const DefaultCacheTTL = 3600

DefaultCacheTTL is the default cache TTL in seconds (1 hour)

View Source
const DefaultHTTPTimeout = 30

DefaultHTTPTimeout is the default per-request HTTP timeout in seconds.

View Source
const DefaultReviewTimeout = 300

DefaultReviewTimeout is the default budget for one `overlay compare` divergence review, in seconds.

This, not internal/autoupdate's DefaultClaudeCodeTimeout, governs the review: the client uses any positive caller budget and GetTimeout never returns anything else. Tune this constant, or the key that defaults to it.

300 is measured: `bentoo overlay compare --realign` over a 268-package overlay with the budget raised to 1800s gave 126 invocations, 122 successes, none reaching the deadline. The successes spread, in seconds:

min 7.4 · p50 14.3 · p90 64.8 · p95 76.6 · p99 112.0 · max 124.6

The old 120s cut off the 124.6s review. 300 is 2.4x the largest success, headroom for a skewed long tail; it stays finite so a hung review still ends. It is NOT established that 300 fixes the earlier case of undeclared- divergence reviews all dying at the deadline: the run was mostly cheap realignment reviews, and the duration log does not record the package.

View Source
const DefaultValidateTimeout = 3600

DefaultValidateTimeout is the default per-agent budget in seconds (1 hour), bounding the reviewer and the build fixer.

Variables

View Source
var (
	ErrOverlayPathNotSet       = errors.New("overlay path is not configured")
	ErrOverlayPathNotFound     = errors.New("overlay path does not exist")
	ErrOverlayInvalidStructure = errors.New("overlay structure is invalid")
	ErrGitUserNotConfigured    = errors.New("git user is not configured: set user.name and user.email in ~/.gitconfig or bentoo config")
	// ErrOverrideMissingReason marks a per-package validation override that
	// states a depth but not why. It is a sentinel so a caller can
	// match the class of problem; the wrapped message always names the package.
	ErrOverrideMissingReason = errors.New("per-package validate override has no reason")
)

Functions

func AutoupdateDir

func AutoupdateDir() (string, error)

AutoupdateDir is where `overlay autoupdate` and `overlay analyze` keep their state: the pending list, the version cache, retained logs and staged trees. It sits beside config.yaml and follows the same rule — $XDG_CONFIG_HOME, else ~/.config — so a temporary XDG_CONFIG_HOME that points a run at another overlay also keeps that run's state away from the real one. It used to be hard-coded under $HOME, and a scratch run's pending entries landed in the user's live pending.json.

func ConfigPaths

func ConfigPaths() ([]string, error)

ConfigPaths returns all possible config file paths in priority order 1. ~/.config/bentoo/config.yaml (XDG standard - priority) 2. ~/.bentoo/config.yaml (legacy fallback)

func DefaultConfigPath

func DefaultConfigPath() (string, error)

DefaultConfigPath returns the default config file path (XDG standard)

func DefaultPackageOverrides

func DefaultPackageOverrides() map[string]ValidatePackageOverride

DefaultPackageOverrides returns the per-package overrides bentoolkit ships with, as a fresh map the caller may keep and edit.

These are the packages whose from-source build costs hours that an unattended sweep would otherwise spend without being asked. They are ORDINARY overrides carrying ordinary reasons — not a hardcoded tier list — so the reason is reported beside the outcome and is required, exactly as for anything an operator writes, and so an operator overrides one by writing the same package key with a depth and a reason of their own.

func FindConfigPath

func FindConfigPath() (string, error)

FindConfigPath returns the first existing config file path Returns the default path if no config file exists yet

func ParseGitconfigContent

func ParseGitconfigContent(r interface{ Read([]byte) (int, error) }) (user, email string, err error)

ParseGitconfigContent parses gitconfig content from an io.Reader. Exported for testing purposes.

Types

type AutoupdateConfig

type AutoupdateConfig struct {
	CacheTTL    int          `yaml:"cache_ttl"`    // Cache TTL in seconds (default: 3600)
	HTTPTimeout int          `yaml:"http_timeout"` // Per-request HTTP timeout in seconds (default: 30)
	LLM         LLMConfig    `yaml:"llm"`          // LLM provider configuration
	Search      SearchConfig `yaml:"search"`       // Search provider configuration
	// Distdir is the directory `pkgdev manifest` is given as --distdir on the
	// autoupdate path — the same name and the same meaning the `overlay
	// manifest` command's --distdir already has. Unset (the
	// default) means the host's own DISTDIR is used, which is what
	// `portageq distdir` reports.
	Distdir string `yaml:"distdir,omitempty"`
	// DistfilesCache is the read-only distfiles cache consulted before a
	// download, again under the name `overlay manifest` already uses.
	// Unset means the built-in default (/var/cache/distfiles).
	// The cache is only ever read from: files are symlinked into the working
	// distdir, never written back.
	DistfilesCache string `yaml:"distfiles_cache,omitempty"`
	// Validate is the staged-bump validation policy. It is nested
	// here rather than at the top level because everything it governs happens
	// during an autoupdate.
	Validate ValidateConfig `yaml:"validate,omitempty"`
	// Review is the budget one `overlay compare` divergence review runs
	// under. It is nested here rather than in a top-level `compare:`
	// block — where the name would fit better — because a top-level block has
	// to be mirrored into probeConfig by hand and a nested one inherits that
	// mirror for free. ReviewConfig carries the whole of that reasoning.
	Review ReviewConfig `yaml:"review,omitempty"`
}

AutoupdateConfig holds autoupdate-specific settings

func (*AutoupdateConfig) GetCacheTTL

func (c *AutoupdateConfig) GetCacheTTL() int

GetCacheTTL returns the cache TTL in seconds, using the default if not configured.

func (*AutoupdateConfig) GetDistdir

func (c *AutoupdateConfig) GetDistdir() string

GetDistdir returns autoupdate.distdir with surrounding whitespace removed, or "" when the key is unset.

Whitespace is stripped rather than preserved because this value becomes a DIRECTORY that distfiles are downloaded into: " /var/cache/distfiles" is a typo in a hand-edited YAML file, not a request for a directory whose name begins with a space. "" is returned unchanged and means "not configured" — the caller then falls through to the next rung of the precedence, never to a path this function invented.

func (*AutoupdateConfig) GetDistfilesCache

func (c *AutoupdateConfig) GetDistfilesCache() string

GetDistfilesCache returns autoupdate.distfiles_cache with surrounding whitespace removed, or "" when the key is unset.

Unlike GetCacheTTL and GetHTTPTimeout this deliberately does NOT substitute a default: the flag layer owns that decision, because there the difference between "unset" and "set to the empty string" is observable (pflag's Changed) and the empty string is the documented way to DISABLE the cache. Answering with a default here would make a config file unable to express anything the flag can.

func (*AutoupdateConfig) GetHTTPTimeout

func (c *AutoupdateConfig) GetHTTPTimeout() int

GetHTTPTimeout returns the per-request HTTP timeout in seconds, using the default when unset or non-positive. This is the cap on a single outbound attempt; the autoupdate checker derives the overall per-operation budget from it so the retry attempts fit within the deadline.

type Config

type Config struct {
	Overlay      OverlayConfig          `yaml:"overlay"`
	Git          GitConfig              `yaml:"git"`
	Autoupdate   AutoupdateConfig       `yaml:"autoupdate,omitempty"`
	Repositories map[string]*RepoConfig `yaml:"repositories,omitempty"`
	// UI is the global rendering policy. It sits at the top level
	// rather than under `autoupdate` because it governs every command that
	// reports progress — `autoupdate` and `overlay manifest` today — and a key
	// that has to be repeated per command is a key that ends up set in one
	// place and forgotten in the other.
	UI UIConfig `yaml:"ui,omitempty"`
	// Notice configures `bentoo notice`.
	Notice NoticeConfig `yaml:"notice,omitempty"`
	// Tray configures bentoo-tray.
	Tray TrayConfig `yaml:"tray,omitempty"`
}

Config represents the application configuration

func Load

func Load() (*Config, error)

Load reads configuration from the first available config file Priority: ~/.config/bentoo/config.yaml > ~/.bentoo/config.yaml

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom reads configuration from a specific file path

func (*Config) GetGitUser

func (c *Config) GetGitUser() (user, email string, err error)

GetGitUser returns the git user name and email. It first tries to read from ~/.gitconfig, then falls back to bentoo config.

func (*Config) GetNoticeSitePath

func (c *Config) GetNoticeSitePath() (string, error)

GetNoticeSitePath returns notice.site_path with a leading `~/` expanded to the home directory, or "" when the key is unset. Only a leading `~/` is expanded: `~other/` names another user's home and a tilde anywhere else is an ordinary character, so both are returned unchanged.

func (*Config) GetOverlayPath

func (c *Config) GetOverlayPath() (string, error)

GetOverlayPath returns the validated overlay path

func (*Config) GetOverlayPathNoValidation

func (c *Config) GetOverlayPathNoValidation() (string, error)

GetOverlayPathNoValidation returns the overlay path without structure validation. Use this when you need the path but don't require a valid overlay structure (e.g., for overlay init command).

func (*Config) Save

func (c *Config) Save() error

Save writes configuration to the default config file

func (*Config) SaveTo

func (c *Config) SaveTo(path string) error

SaveTo writes configuration to a specific file path

type GitConfig

type GitConfig struct {
	User  string `yaml:"user"`
	Email string `yaml:"email"`
}

GitConfig holds git user settings

type LLMConfig

type LLMConfig struct {
	Provider     string  `yaml:"provider"`                 // LLM provider name (e.g., "claude")
	APIKeyEnv    string  `yaml:"api_key_env"`              // Environment variable name for API key
	Model        string  `yaml:"model"`                    // Model name to use
	Bare         string  `yaml:"bare,omitempty"`           // CLI bare-mode selector: "auto" (default), "true", or "false"
	MaxBudgetUSD float64 `yaml:"max_budget_usd,omitempty"` // Optional spend cap passed to the CLI provider via --max-budget-usd
}

LLMConfig holds LLM provider configuration for autoupdate

type NoticeConfig

type NoticeConfig struct {
	// SitePath is the site repository's root; the notice YAML goes under
	// <site_path>/src/content/notices/. Empty means "print the YAML instead".
	// A leading `~/` is expanded by GetNoticeSitePath.
	SitePath string `yaml:"site_path,omitempty"`
}

NoticeConfig is the `notice:` block: where `bentoo notice` writes the site half of a notice.

type OverlayConfig

type OverlayConfig struct {
	Path   string `yaml:"path"`
	Remote string `yaml:"remote"`
}

OverlayConfig holds overlay-specific settings

type OverlayValidationError

type OverlayValidationError struct {
	Path   string
	Errors []string
}

OverlayValidationError represents an overlay validation failure

func (*OverlayValidationError) Error

func (e *OverlayValidationError) Error() string

type OverlayValidationResult

type OverlayValidationResult struct {
	Valid    bool     // True if overlay structure is valid
	Errors   []string // Critical issues that prevent operation
	Warnings []string // Non-critical issues
}

OverlayValidationResult contains overlay validation results

func ValidateOverlayStructure

func ValidateOverlayStructure(path string) *OverlayValidationResult

ValidateOverlayStructure checks if a path is a valid Gentoo overlay. A valid overlay must have: - profiles/ directory - metadata/ directory

type RepoConfig

type RepoConfig struct {
	Provider string `yaml:"provider"` // "github", "gitlab", "git", or "local"
	URL      string `yaml:"url"`      // Full URL or org/repo for GitHub/GitLab/git (remote)
	Path     string `yaml:"path"`     // On-disk tree for provider "local" (read in place, no clone)
	Branch   string `yaml:"branch"`   // Branch to use (default: master/main)
}

RepoConfig holds configuration for a custom repository.

A per-repository auth token is no longer a field here: it now resolves from BENTOO_REPO_<NAME>_TOKEN via the secrets chain (see internal/common/secrets and cmd/bentoo's repoTokenName). A legacy `token:` key left in config.yaml is surfaced by the migration diagnostic in LoadFrom and otherwise ignored.

type ReviewConfig

type ReviewConfig struct {
	// Timeout bounds one review invocation, in SECONDS — the same unit and
	// shape as cache_ttl, http_timeout and autoupdate.validate.timeout, because
	// YAML has no duration literal and an int of seconds is what this file
	// already speaks. Unset, zero or negative means the default: a budget of
	// zero seconds would kill every review the instant it started, which is
	// the failure this key exists to bound and not a way to configure it.
	Timeout int `yaml:"timeout,omitempty"`
}

ReviewConfig is the `autoupdate.review` block: the budget one `overlay compare` divergence review runs under.

It is not autoupdate.validate.review, the tri-state bool deciding WHETHER staged-bump validation asks a model at all; this block decides HOW LONG one review may take before it is cut off. Neither reads the other.

It is not a top-level `compare:` block because probeConfig lists Config's top-level keys by hand, and a block missing there makes every command print "field <key> not found in type config.probeConfig" on stderr; probeConfig reuses AutoupdateConfig verbatim, so a nested key inherits the mirror. It is not under autoupdate.llm because the compare path deliberately ignores that block (cmd/bentoo's reviewLLMConfig), so a budget there would go unread.

The default comes from a getter, never a struct literal, so an absent block, a half-written block and a nil pointer all resolve to:

timeout    DefaultReviewTimeout (seconds)

func (*ReviewConfig) GetTimeout

func (c *ReviewConfig) GetTimeout() time.Duration

GetTimeout returns the review budget as a duration, defaulting to DefaultReviewTimeout when unset or non-positive. The stored key is an int of seconds and the duration is what the caller needs; this getter is the one place the conversion happens.

A nil receiver answers the default exactly as an absent block does: the config is threaded through call sites that predate this block, and a getter that panicked there would turn an unwritten key into a crash.

type SearchConfig

type SearchConfig struct {
	Provider  string `yaml:"provider"`    // Search provider name (e.g., "perplexity")
	APIKeyEnv string `yaml:"api_key_env"` // Environment variable name for API key
}

SearchConfig holds search provider configuration for autoupdate

type TrayConfig

type TrayConfig struct {
	// Interval is a time.ParseDuration string; empty means DefaultTrayInterval.
	Interval string `yaml:"interval,omitempty"`
	// FeedURL is the notices feed; empty means DefaultTrayFeedURL.
	FeedURL string `yaml:"feed_url,omitempty"`
	// Mute lists notice types that are recorded unread but never notified.
	Mute []string `yaml:"mute,omitempty"`
	// DowngradeCritical sends critical notices at normal urgency.
	DowngradeCritical bool `yaml:"downgrade_critical,omitempty"`
	// SkipMetered is a pointer so an explicit false stays distinct from an
	// absent key, whose default is true.
	SkipMetered *bool `yaml:"skip_metered,omitempty"`
}

TrayConfig is the `tray:` block read by bentoo-tray. The getters apply the defaults and return their warnings as strings: this package does not log, the caller does.

func (TrayConfig) GetFeedURL

func (t TrayConfig) GetFeedURL() string

GetFeedURL returns the configured feed URL or DefaultTrayFeedURL.

func (TrayConfig) GetInterval

func (t TrayConfig) GetInterval() (time.Duration, []string)

GetInterval returns the check interval: DefaultTrayInterval when unset or unparsable, and never below MinTrayInterval. Each correction comes back as a warning naming the configured value.

func (TrayConfig) GetMute

func (t TrayConfig) GetMute() (types []string, warnings []string)

GetMute returns the mutable notice types listed in tray.mute, in their configured order. "security" and unknown types (matched case-sensitively) are dropped, one warning each.

func (TrayConfig) GetSkipMetered

func (t TrayConfig) GetSkipMetered() bool

GetSkipMetered reports whether checks are skipped on a metered connection; true unless tray.skip_metered is explicitly false.

type UIConfig

type UIConfig struct {
	// Mode is the renderer to use: auto, plain, inline or fullscreen — the
	// same four words the --ui flag and the BENTOO_UI environment variable
	// accept, so a value that works in one works in the others.
	//
	// It is neither validated nor defaulted here, by design:
	//   - No validation: internal/common/report.ResolveMode owns the legal set
	//     and names it in its rejection message; a second list here would
	//     drift. The value is stored verbatim, and this package does not
	//     depend on report.
	//   - No default: the empty string means the operator said nothing, which
	//     must stay distinguishable from an explicit `mode: auto` so an
	//     unconfigured run behaves exactly as before this key existed.
	Mode string `yaml:"mode,omitempty"`
}

UIConfig is the `ui:` block: how a long-running command renders itself.

type ValidateConfig

type ValidateConfig struct {
	// Depths is the per-class depth table, keyed by the bump classes
	// internal/autoupdate/validate.Classify produces. A class left unset
	// answers its documented default, never the empty string.
	Depths ValidateDepths `yaml:"depths,omitempty"`
	// RequireIsolation makes a compile gate SKIP rather than run unisolated,
	// so a pass never claims a fidelity it did not have. It defaults to false
	// because `unshare --net` is denied on ordinary hosts, and a default of
	// true would turn every build gate into a SKIPPED (the --require-isolation
	// default, unchanged now that it has a key).
	RequireIsolation bool `yaml:"require_isolation,omitempty"`
	// RequireProof refuses to publish a bump whose validation could not reach
	// the depth policy asked for. It defaults to false: an ordinary
	// workstation rarely holds every build dependency, so a default of true
	// would refuse most bumps for a reason that says nothing about them.
	// The unreached depth is reported either way.
	RequireProof bool `yaml:"require_proof,omitempty"`
	// Review and FixOnFailure are the two LLM capabilities, and they are
	// TRI-STATE on purpose. The capabilities are enabled by --llm; this
	// configuration can only SUBTRACT from that flag, never add to it.
	// A plain bool cannot express "leave it to the flag" and
	// "switch this one back off" as different things, so an unset key stays
	// nil and only an explicit `review: false` disables. GetReview reports the
	// configured value alone (false unless the file says true); the flag layer
	// combines the two through ReviewDisabled.
	Review *bool `yaml:"review,omitempty"`
	// FixOnFailure is the build fixer, tri-state for the same reason as
	// Review above.
	FixOnFailure *bool `yaml:"fix_on_failure,omitempty"`
	// Timeout bounds a single agent run, in SECONDS — the same unit and shape
	// as cache_ttl and http_timeout above, because YAML has no duration
	// literal and an int of seconds is what this file already speaks. It is
	// read by the reviewer and by the build fixer: an agent with no deadline
	// hangs an unattended sweep. Unset or non-positive means the default.
	Timeout int `yaml:"timeout,omitempty"`
	// Packages holds per-package overrides, keyed by category/name. An
	// override supplies the depth to use and the reason it is used; an
	// override with no reason is reported invalid, naming the package,
	// because an override is the one input that can quietly reduce how much a
	// bump is checked.
	//
	// The packages nobody wants to build from source ship AS ORDINARY ENTRIES
	// in this map (see DefaultPackageOverrides), not as a hardcoded tier list,
	// so the reason rules reach them exactly as they reach anything an
	// operator writes — and so the report that says why a bump was not
	// validated can quote their reason like any other.
	Packages map[string]ValidatePackageOverride `yaml:"packages,omitempty"`
}

ValidateConfig is the staged-bump validation policy: how much of a bump is checked before publishing, and on whose stated authority a package gets less.

It lives here, not in the overlay's packages.toml, where a key ahead of the installed binary silently disables its record; here a typo is a stderr line from the strict re-decode in LoadFrom and the run continues.

Every default comes from a getter, never a struct literal, so an absent block, a half-written block and a nil pointer all resolve to:

depths.revision    options     depths.series     configure
depths.patch       options     depths.major      configure
require_isolation  false       require_proof     false
review             false       fix_on_failure    false
timeout            3600 (seconds)

`compile` is never a default (only --depth/--compile or a reasoned override): validating everything at compile depth does not become expensive, it becomes ignored.

func (*ValidateConfig) FixOnFailureDisabled

func (c *ValidateConfig) FixOnFailureDisabled() bool

FixOnFailureDisabled reports an explicit `fix_on_failure: false`. See ReviewDisabled.

func (*ValidateConfig) GetDepthForClass

func (c *ValidateConfig) GetDepthForClass(class string) string

GetDepthForClass returns the configured depth for a bump class, falling back to that class's documented default.

It NEVER returns the empty string, for any input: the resolver downstream always has a depth to work with, and an unrecognized class is answered as the riskiest known one (major) rather than as "no validation", because failing to classify a bump is not evidence that the bump is small.

The class name is matched case-insensitively and trimmed — it is a lookup key this package chooses, not a value it reports. The configured VALUE is returned verbatim, so a typo in a depth name reaches validate.ParseDepth and is rejected there by name instead of being silently repaired here.

func (*ValidateConfig) GetFixOnFailure

func (c *ValidateConfig) GetFixOnFailure() bool

GetFixOnFailure reports the CONFIGURED value of the build-fixer capability. See GetReview for why this is not the effective value.

func (*ValidateConfig) GetRequireIsolation

func (c *ValidateConfig) GetRequireIsolation() bool

GetRequireIsolation reports whether a compile gate must SKIP rather than run unisolated. False by default, and false through a nil receiver: this is the --require-isolation default, unchanged now that it also has a key.

func (*ValidateConfig) GetRequireProof

func (c *ValidateConfig) GetRequireProof() bool

GetRequireProof reports whether a bump whose validation could not reach the policy depth must be refused rather than published with the unreached depth named. False by default.

func (*ValidateConfig) GetReview

func (c *ValidateConfig) GetReview() bool

GetReview reports the CONFIGURED value of the reviewer capability, which is false unless the file says otherwise. It is not the effective value: the capabilities are switched on by --llm and configuration only subtracts, so the flag layer combines this with ReviewDisabled.

func (*ValidateConfig) GetTimeout

func (c *ValidateConfig) GetTimeout() time.Duration

GetTimeout returns the per-agent budget as a duration, defaulting to DefaultValidateTimeout when unset or non-positive. The stored key is an int of seconds; the duration is what the callers (the reviewer and the build fixer) actually need.

func (*ValidateConfig) OverrideErrors

func (c *ValidateConfig) OverrideErrors() []error

OverrideErrors reports every per-package override that is invalid, one error per package, in a stable (sorted) order so a diagnostic does not reshuffle between runs.

The rule enforced here: an override must state its reason. It is reported, never fatal — the same treatment an unknown key gets — so one bad entry cannot cost the operator the rest of the file.

The depth STRING is deliberately not validated here. validate.ParseDepth owns that vocabulary and rejects an unknown rung by name; duplicating the ladder in this package would put the same list in two places, and the copy would be the one that goes stale.

func (*ValidateConfig) ReviewDisabled

func (c *ValidateConfig) ReviewDisabled() bool

ReviewDisabled reports an explicit `review: false`, which is the only way a config file can switch the reviewer back off for a run started with --llm.

type ValidateDepths

type ValidateDepths struct {
	Revision string `yaml:"revision,omitempty"`
	Patch    string `yaml:"patch,omitempty"`
	Series   string `yaml:"series,omitempty"`
	Major    string `yaml:"major,omitempty"`
}

ValidateDepths is the per-class depth table under `autoupdate.validate.depths`.

Each value is a rung spelled exactly as internal/autoupdate/validate.ParseDepth accepts it: none, options, patches, configure, compile, install — shallowest first, each including every rung before it. This package does not validate them; ParseDepth is the validator, and the import runs the other way.

It is a struct and not a map[string]string so that a mistyped CLASS name ("revison:") is caught by the strict re-decode in LoadFrom and reported on stderr. A map would accept the typo silently and the class it was meant for would quietly keep its default — which is the packages.toml failure mode this block exists to avoid.

type ValidatePackageOverride

type ValidatePackageOverride struct {
	// Depth is a rung of the validation ladder, spelled exactly as
	// internal/autoupdate/validate.ParseDepth accepts it: none, options,
	// patches, configure, compile, install. It is stored and reported verbatim
	// — this package deliberately neither trims nor case-folds it, because
	// ParseDepth does not either, and a config layer that silently repaired
	// " Compile " would make the name in the file and the name in the report two
	// different strings.
	Depth string `yaml:"depth"`
	// Reason is why this package departs from its class depth. It is required:
	// see OverrideErrors.
	Reason string `yaml:"reason"`
}

ValidatePackageOverride is one entry of autoupdate.validate.packages: the depth to use for this package and the reason for using it.

Both fields are reported beside the outcome, so a bump validated at a shallower depth than its class calls for can always say on whose authority.

Jump to

Keyboard shortcuts

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