Documentation
¶
Overview ¶
Package infrastructure holds the diagnostics adapters: the config snapshot and database probe, the routing lock gateway, the request signer, the webhook sender, the report writer, and the smoke store/Slack adapters.
Index ¶
- func NewConfigSnapshot(cfg config.Config, entries []routingdomain.Entry, hasPathRules bool) diagnosticsdomain.ConfigSnapshot
- func WriteLockWarning(stderr io.Writer, err error)
- func WriteReport(w io.Writer, sections []diagnosticsdomain.Section) bool
- type GitHubSigner
- type HTTPWebhookSender
- type LockGateway
- type MappingsSmokeMappings
- type SlackSmokeReactions
- type StoreSmokeCleanup
- type StoreSmokeMessages
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConfigSnapshot ¶
func NewConfigSnapshot(cfg config.Config, entries []routingdomain.Entry, hasPathRules bool) diagnosticsdomain.ConfigSnapshot
NewConfigSnapshot builds a ConfigSnapshot from a parsed Config plus the already-resolved routing facts. It probes the database with the same open+ping logic as the old doctor.CheckDatabase so the application layer never needs to import config or persistence.
func WriteLockWarning ¶
WriteLockWarning formats the warning message emitted when Plan returns a non-nil error (malformed lock). It writes to stderr and returns the formatted string so callers do not need to know the exact phrasing.
func WriteReport ¶
func WriteReport(w io.Writer, sections []diagnosticsdomain.Section) bool
WriteReport renders sections to w in a human-readable, greppable form, and returns true iff no check failed (skipped checks do not fail the report). The format is intentionally plain text: one section header per group, then one indented line per check.
Types ¶
type GitHubSigner ¶
type GitHubSigner struct{}
GitHubSigner implements diagnosticsdomain.Signer using the GitHub HMAC-SHA256 scheme from the platform security package.
type HTTPWebhookSender ¶
type HTTPWebhookSender struct {
// contains filtered or unexported fields
}
HTTPWebhookSender implements diagnosticsdomain.WebhookSender over *http.Client.
func NewHTTPWebhookSender ¶
func NewHTTPWebhookSender(client *http.Client) *HTTPWebhookSender
NewHTTPWebhookSender returns a sender that uses the given HTTP client.
type LockGateway ¶
type LockGateway struct {
// contains filtered or unexported fields
}
LockGateway implements diagnosticsdomain.LockGateway over the routing infrastructure lock-store functions. lockPath is the path to the .lock file that lives next to mappings.yaml; clock is used to stamp ValidatedAt on each entry that passes validation.
func NewLockGateway ¶
func NewLockGateway(lockPath string, clock func() time.Time) *LockGateway
NewLockGateway returns a LockGateway for the given lock file path and clock.
func (*LockGateway) Commit ¶
func (g *LockGateway) Commit(successes []validationdomain.EntryResult, stale []string) error
Commit writes the merged lock: the existing lock is read, successful validation results are merged in (keyed by entry hash + current time), and stale keys are dropped.
func (*LockGateway) CommitTargeted ¶
func (g *LockGateway) CommitTargeted(entry routingdomain.Entry) error
CommitTargeted reads the current lock, sets the single entry's LockEntry (SHA256 + ValidatedAt), and writes it back. Used after a targeted validation pass on an explicit (non-wildcard) entry.
func (*LockGateway) Plan ¶
func (g *LockGateway) Plan(entries []routingdomain.Entry, force bool) (diagnosticsdomain.LockPlan, error)
Plan reads the on-disk lock and diffs it against entries. When force is true the on-disk lock is ignored and every entry is returned for (re)validation. A missing lock file is not an error — it returns all entries for validation. A malformed lock file is also non-fatal; the caller should log the warning (Plan surfaces the error so the caller can do so) but all entries still validate.
type MappingsSmokeMappings ¶
type MappingsSmokeMappings struct {
// contains filtered or unexported fields
}
MappingsSmokeMappings implements diagnosticsdomain.SmokeMappings over a mappings provider that satisfies the routing domain's MappingProvider port.
func NewMappingsSmokeMappings ¶
func NewMappingsSmokeMappings(provider smokeRoutingProvider) *MappingsSmokeMappings
NewMappingsSmokeMappings returns a SmokeMappings adapter for any provider that can resolve a repository to a RepoMapping.
func (*MappingsSmokeMappings) Get ¶
func (m *MappingsSmokeMappings) Get(ctx context.Context, repository string) (routingdomain.RepoMapping, error)
Get resolves target to its RepoMapping. Returns routingdomain.ErrNotFound (which is identical to persistence.ErrNotFound) when the repository is absent.
type SlackSmokeReactions ¶
type SlackSmokeReactions struct {
// contains filtered or unexported fields
}
SlackSmokeReactions implements diagnosticsdomain.SmokeReactions over *slack.Client, returning only the emoji name strings.
func NewSlackSmokeReactions ¶
func NewSlackSmokeReactions(client *slack.Client) *SlackSmokeReactions
NewSlackSmokeReactions returns a SmokeReactions backed by the given Slack client.
type StoreSmokeCleanup ¶
type StoreSmokeCleanup struct {
// contains filtered or unexported fields
}
StoreSmokeCleanup implements diagnosticsdomain.SmokeCleanup over *persistence.PullRequests.
func NewStoreSmokeCleanup ¶
func NewStoreSmokeCleanup(pullRequests *persistence.PullRequests) *StoreSmokeCleanup
NewStoreSmokeCleanup returns a StoreSmokeCleanup backed by the given persistence.
type StoreSmokeMessages ¶
type StoreSmokeMessages struct {
// contains filtered or unexported fields
}
StoreSmokeMessages implements diagnosticsdomain.SmokeMessages over *persistence.PullRequests, converting persistence.Message to domain.SmokeMessage.
func NewStoreSmokeMessages ¶
func NewStoreSmokeMessages(pullRequests *persistence.PullRequests) *StoreSmokeMessages
NewStoreSmokeMessages returns a StoreSmokeMessages backed by the given persistence.
func (*StoreSmokeMessages) Messages ¶
func (s *StoreSmokeMessages) Messages(ctx context.Context, repository string, prNumber int) ([]diagnosticsdomain.SmokeMessage, error)
Messages returns the PR's stored messages as domain SmokeMessages. A persistence.ErrNotFound is propagated as-is so the application layer can detect the "no row" case.