Documentation
¶
Overview ¶
Package config parses and validates xray TOML configuration with line-numbered diagnostics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BugsnagConn ¶
type CircleCIConn ¶
type CircleCIConn struct {
Token string
Projects map[string]string // circleci project slug -> repo slug
BuildInflection *time.Time // nil = no sparse mode
BuildBracketWindow *DurationSpec // nil = no sparse mode
BuildHistorySample *HistorySampleSpec // nil = skip pre-bracket sampling
}
type Config ¶
type Config struct {
Window Window
Teams map[string][]string
CaptureHarnessContent bool
Connectors Connectors
}
Config is the parsed TOML configuration.
func Load ¶
Load reads a TOML config file from path and returns the populated Config plus the toml.MetaData that produced it. The MetaData is needed by Validate for line-numbered diagnostics.
A malformed window string is reported as an error here rather than as a validation diagnostic: a window we cannot parse cannot be validated.
func (*Config) GitHubToken ¶ added in v0.4.3
GitHubToken returns the configured GitHub token, or "" when no GitHub connector is configured. Used by gitcli to authenticate clone and ls-remote against github.com without requiring ambient git auth.
func (*Config) RepoToTeam ¶
RepoToTeam returns the team a given repo slug belongs to. Empty string if the repo is not present in any team.
type Connectors ¶
type Connectors struct {
GitHub *GitHubConn
GitHubActions *GitHubActionsConn
CircleCI *CircleCIConn
Sentry *SentryConn
Bugsnag *BugsnagConn
Honeycomb *HoneycombConn
}
Connectors holds the optional per-source config. A nil pointer means the connector is not configured and is skipped at extract time.
type Diagnostic ¶
Diagnostic is a single validation problem with a source location.
func Validate ¶
func Validate(cfg *Config, meta *toml.MetaData, file string) []Diagnostic
Validate enforces the schema rules from docs/spec.md and returns one diagnostic per problem found. file is the source path used in diagnostic output.
Diagnostics are returned in source-line order so that the cli output is stable. An empty slice means the config is valid.
func (Diagnostic) Error ¶
func (d Diagnostic) Error() string
Error renders the diagnostic in the spec format:
<file>:<line>: <path>: <msg>
type DurationSpec ¶ added in v0.4.9
type DurationSpec struct {
Years int
Months int
Days int
Raw string // verbatim from TOML, e.g. "12m"
}
DurationSpec is a parsed duration string of the form Nu where u ∈ {y,m,w,d}. Calendar-accurate arithmetic is applied via time.AddDate, so "12m" is exactly 12 calendar months rather than 365 days.
type GitHubActionsConn ¶
type GitHubActionsConn struct {
Token string // optional; falls back to GitHub.Token
}
type GitHubConn ¶
type GitHubConn struct {
Token string
PROrder string // "updated_desc" (default) or "created_asc"
PRWindow *Window // nil → use global window for PR cluster extraction
PRInflection *time.Time // operator-supplied inflection date (UTC midnight); nil = no sparse mode
PRBracketWindow *DurationSpec // ±N months/weeks/days full fidelity; nil = no sparse mode
PRHistorySample *HistorySampleSpec // nil = skip pre-bracket extraction
// Issue label-set classification for the Issues → incidents/defects
// stream (#184). Empty slices/map fall back to connector defaults in
// New(); matching is case-insensitive.
IssueBugLabels []string // bug-population labels; empty → bug,type:bug,kind/bug
IssueRegressionLabels []string // regression-population labels; empty → regression
IssueSeverityLabels map[string]string // label → severity verdict; empty → no severity
}
type HistorySampleSpec ¶ added in v0.4.9
type HistorySampleSpec struct {
Strategy string // always "monthly"
N int // PRs per bucket (1–100)
Random bool // true when ":random" suffix present
Raw string // verbatim from TOML
}
HistorySampleSpec is a parsed pr_history_sample string "monthly:N" or "monthly:N:random".