Documentation
¶
Overview ¶
Package application holds the diagnostics use cases — the doctor, the config list/validate CLI, and the smoke delivery — behind the domain's use-case interfaces.
Index ¶
- func CheckConfig(snapshot diagnosticsdomain.ConfigSnapshot) diagnosticsdomain.Section
- func CheckDatabase(snapshot diagnosticsdomain.ConfigSnapshot) diagnosticsdomain.Section
- func CheckMappings(snapshot diagnosticsdomain.ConfigSnapshot) diagnosticsdomain.Section
- func List(entries diagnosticsdomain.EntrySource, stdout io.Writer) int
- type Doctor
- type MappingsValidator
- type SmokeUseCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckConfig ¶
func CheckConfig(snapshot diagnosticsdomain.ConfigSnapshot) diagnosticsdomain.Section
CheckConfig inspects the snapshot and reports per-field results. Secret values are never written to Detail — the result reports only "set" or "missing".
func CheckDatabase ¶
func CheckDatabase(snapshot diagnosticsdomain.ConfigSnapshot) diagnosticsdomain.Section
CheckDatabase reports whether the database described in the snapshot is reachable. The actual open+ping is performed by the infrastructure layer when building the snapshot; this function reads the pre-computed result.
func CheckMappings ¶
func CheckMappings(snapshot diagnosticsdomain.ConfigSnapshot) diagnosticsdomain.Section
CheckMappings reports whether the mappings section parsed into any entries. An empty section is OK (the server boots but routes nothing). When any tier configures per-path routing, it adds a "path routing" check: OK when a GitHub token is present (paths are active), SKIP when it is absent (path rules are inert — PRs route to the repo tier — until a token is set).
func List ¶
func List(entries diagnosticsdomain.EntrySource, stdout io.Writer) int
List prints the current mapping entries as a tab-separated table to stdout and returns exit code 0. It satisfies the `notifycat-config list` command.
Types ¶
type Doctor ¶
type Doctor struct {
// contains filtered or unexported fields
}
Doctor implements diagnosticsdomain.Doctor. It validates a ConfigSnapshot and delegates per-repo checks to a RepoValidator. Construct via NewDoctor.
func NewDoctor ¶
func NewDoctor(snapshot diagnosticsdomain.ConfigSnapshot, validator validationdomain.RepoValidator) *Doctor
NewDoctor returns a Doctor wired to snapshot and validator. validator may be nil — Run then skips the per-repo Slack/GitHub checks even when a target repository is given.
type MappingsValidator ¶
type MappingsValidator struct {
// contains filtered or unexported fields
}
MappingsValidator is the validate use case. Callers (cmd/notifycat-config, tests) inject the ports; there is no production-wiring façade.
func NewMappingsValidator ¶
func NewMappingsValidator( entries diagnosticsdomain.EntrySource, checker validationdomain.RepoValidator, lister validationdomain.OrgRepoLister, gateway diagnosticsdomain.LockGateway, ) *MappingsValidator
NewMappingsValidator builds the validate use case from its dependencies. lister may be nil when no GitHub credentials exist.
type SmokeUseCase ¶
type SmokeUseCase struct {
// contains filtered or unexported fields
}
SmokeUseCase runs the delivery test. Construct via NewSmokeUseCase; Run is safe to call repeatedly (each call derives a unique PR number from the clock).
func NewSmokeUseCase ¶
func NewSmokeUseCase( mappings diagnosticsdomain.SmokeMappings, messages diagnosticsdomain.SmokeMessages, reactions diagnosticsdomain.SmokeReactions, cleanup diagnosticsdomain.SmokeCleanup, signer diagnosticsdomain.Signer, sender diagnosticsdomain.WebhookSender, cfg diagnosticsdomain.SmokeConfig, ) *SmokeUseCase
NewSmokeUseCase wires a SmokeUseCase.
func (*SmokeUseCase) Run ¶
func (s *SmokeUseCase) Run(ctx context.Context, target string, withReactions bool) (res diagnosticsdomain.SmokeResult, err error)
Run validates that target is mapped, posts a signed synthetic `pull_request: opened` to the live endpoint, and reports the channel and the Slack timestamp read back from the store. Mapping is checked first so an unmapped repo fails (ErrNoMapping) without any network traffic.
When withReactions is set and the server has reactions enabled, Run then replays a comment, an approval, and a merge for the same PR and verifies the configured emoji appeared on the message. A missing emoji is recorded in the SmokeResult (not returned as an error) so the CLI can report every step.