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

report

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package report builds what every surface reports in the API's own shapes, internal/api's: the Summary of a period, the directories you work in, the review queue, and the words for a failure. The web server answers with them and the command line prints them for --json, so the two cannot come to say the same thing differently. It reads the seams' answers and does no I/O of its own.

Index

Constants

View Source
const TryAgain = "try again, and run workflow doctor if it keeps failing"

TryAgain is what to do about a failure nothing more is known of.

Variables

This section is empty.

Functions

func Activity

func Activity(
	summary activity.Summary, today activity.Date, loc *time.Location, describe func(error) string,
) api.Activity

Activity is the summary as the API answers it, today being the day it is in loc, so the command line prints the same shape the web reads. Each failure is worded by describe, which the web makes its own fault and the command line FaultDetail, so it never names a host.

func Comment added in v0.10.0

func Comment(comment jira.Comment) api.Comment

Comment is a comment on an issue in the API's shape.

func Date

func Date(day activity.Date) openapi_types.Date

Date is a day as the contract writes a date.

func FaultDetail

func FaultDetail(err error) string

FaultDetail is a failure's detail in the words the shared classes (SharedFaults) give it: the same sentence for the same class of failure, never naming a host or a path. A surface's own classes may come before them, as the web's do, and word a failure of that class differently.

func Issue added in v0.10.0

func Issue(issue jira.Issue) api.Issue

Issue is a tracker issue in the API's shape.

func IssueDetail added in v0.10.0

func IssueDetail(detail jira.IssueDetail, link string) api.IssueDetail

IssueDetail is an issue read in full in the API's shape, with its comments oldest first and link, the issue's page in the tracker ("" when there is none to give).

func IssuesPage added in v0.10.0

func IssuesPage(result jira.SearchResult, startAt int) api.IssuesPage

IssuesPage is a page of search results in the API's shape, keeping the caller's start index. Its issues and its unavailable trackers are empty lists, never null.

func PostLength

func PostLength(settings config.Messaging, text string) *api.PostLength

PostLength is how long text would be posted through settings, against the most its service takes, or nil where nothing is set up to post to or the service names no limit.

func ReviewFacets

func ReviewFacets(facets []forge.ReviewFacet) []api.ReviewFacet

ReviewFacets maps review facets onto the wire, each with its label, an empty list rather than null: a request's own, and the values the review queue's filter offers. A map, so exhaustive keeps the kinds complete.

func ReviewRequests

func ReviewRequests(requests []forge.ReviewRequest) []api.ReviewRequest

ReviewRequests maps the requests waiting on your review onto the wire, each with its facets, an empty list rather than null when none waits: the requests GET /api/reviews answers, and what `workflow reviews --json` prints.

func StatusCategory added in v0.10.0

func StatusCategory(category jira.StatusCategory) api.StatusCategory

StatusCategory is a status's category in the API's shape. The contract names Jira's three categories; any other — Jira's No Category, keyed "undefined", which a status no one sorted into a category is filed under, or a row read back from a store someone changed — is carried as not yet started, which is what such a status is to the loop: not done. Carried as it came, it would make the page refuse the whole frame it is in.

func TrackerOf added in v0.10.0

func TrackerOf(issueKey jira.Key) api.IssueTracker

TrackerOf is where the issue a key names lives, by the key's shape: a number is the forge's, anything else Jira's.

Types

type Class

type Class struct {
	Causes []error
	Code   api.ProblemCode
	Detail string
}

Class is one kind of failure: the sentinels that belong to it, and the problem code and the sentence it is told with — a sentence that says what to do, never the cause's own text, which can carry the tracker's or the forge's address.

func (Class) Matches

func (c Class) Matches(err error) bool

Matches reports whether err is one of the class's causes.

type Fault

type Fault struct {
	Code       api.ProblemCode
	Detail     string
	RetryAfter *int
}

Fault is a failure as it is told: the problem code the web answers with, the sentence every surface shows, and, for a rate limit that said, how many seconds it asked to wait.

func Classify

func Classify(err error, classes []Class) (Fault, bool)

Classify tells err as the first of classes it belongs to, reported true, or as an opaque internal failure, reported false. A token the forge turned down and a message Slack would not deliver are told in their own words before any class: neither carries an address.

type Faults

type Faults struct {
	Git, Transport, Jira, Forge, Messaging, Taskwarrior, Directory []Class
}

Faults are the failures every surface tells alike, by the system each belongs to, so a surface that tells failures of its own apart can place them among these where they belong: within a group, the more specific first — a Jira 404 that carries a reason is a missing resource before it is a refusal.

func SharedFaults

func SharedFaults() Faults

SharedFaults are the failures every surface tells alike.

func (Faults) All

func (f Faults) All() []Class

All is every group's classes, in the order they are told apart.

type RepositoriesView

type RepositoriesView struct {
	Repositories  seams.Repositories
	Favorites     func(ctx context.Context) ([]string, error)
	FavoritesKept bool
}

RepositoriesView is what a surface reads where it works from: the directories it can work in; your favorites, nil when the store keeps none; and whether a favorite can be marked or forgotten there.

func (RepositoriesView) Report

func (v RepositoriesView) Report(ctx context.Context, describe func(error) string) (api.Repositories, error)

Report is where a surface works, its repository's worktrees and your favorites, each looked at on disk now: what GET /api/repositories answers and `workflow repositories --json` prints. describe words why the worktrees could not be read. Favorites that cannot be read are listed as none, and why is returned beside the rest. Everything is read under ctx.

type TaskwarriorReason

type TaskwarriorReason struct {
	Cause error
	Code  api.TaskListReasonCode
	Text  string
}

TaskwarriorReason is why no Taskwarrior can be asked, as the code the task list gives it and in words safe to show: never the error's own, which name the task program's path.

func TaskwarriorReasons

func TaskwarriorReasons() []TaskwarriorReason

TaskwarriorReasons are the reasons the task list and a refused write share.

Jump to

Keyboard shortcuts

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