application

package
v0.22.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 11 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfig

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

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

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

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.

func (*Doctor) Run

func (d *Doctor) Run(ctx context.Context, target string) []diagnosticsdomain.Section

Run produces the report. The first three sections (config, database, mappings) always run, in that order. When target is non-empty and a validator is configured, a fourth section named after target is appended with the per-mapping check results.

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

NewMappingsValidator builds the validate use case from its dependencies. lister may be nil when no provider credentials exist.

func (*MappingsValidator) Validate

func (v *MappingsValidator) Validate(ctx context.Context, target string, force bool, stdout, stderr io.Writer) int

Validate dispatches on target / force. Exit codes: 0 OK, 1 failure.

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 (*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.

Jump to

Keyboard shortcuts

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