activity

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package activity is the observational record of user-facing mutations for the `jira tui` dashboard: it feeds the footer's status slot (the most-recent operation and an in-flight count) and the scrollable operation-log overlay (every recorded mutation, newest-first). It is deliberately observational — it records what a mutation is doing and how it resolved, but it never gates a write. Callers keep their own re-entrancy guards; the registry only watches. Every method runs on the single Bubble Tea Update goroutine, so the registry needs no locking (mirroring internal/tui/components/task); it owns no goroutines of its own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID       uint64 // registry-assigned, monotonic from 1
	Pending  string // in-flight text, e.g. "creating issue in PROJ…"
	Done     string // resolved text, e.g. "PROJ-88 created" (set by Finish)
	IssueKey string // the affected issue key when known, for a hyperlink (may be "")
	Status   Status
	Err      error // set by Fail
}

Entry is one recorded operation. It is a value type: Recent and Log hand out copies, so a caller reading the footer or the log can never reach back in and mutate the registry's own state.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry records mutations for the footer and the operation log. It is purely observational: Start/Finish/Fail note what a mutation is doing and how it ended, but nothing here ever blocks or de-duplicates a write — the caller's own re-entrancy guard stays authoritative, and the registry just watches from the side.

All methods are called from the single Bubble Tea Update goroutine (the async work runs off-loop in a task command and reports back as a message that is applied on that same goroutine), so the entry slice needs no locking, exactly as internal/tui/components/task's Manager avoids locking its generation map. The registry owns no goroutines.

func New

func New() *Registry

New returns an empty registry. The first Start will hand out id 1.

func (*Registry) Fail

func (r *Registry) Fail(id uint64, err error)

Fail resolves op id as failed with err. Like Finish it updates in place and is a no-op for an unknown id.

func (*Registry) Finish

func (r *Registry) Finish(id uint64, done, issueKey string)

Finish resolves op id as done: done is the resolved text, issueKey the affected key (or ""). The matching pending entry is updated in place at the same id. A no-op if id is unknown — it may have aged out of the bounded log, and a purely observational record must never panic on a stale handle.

func (*Registry) InFlight

func (r *Registry) InFlight() int

InFlight returns how many recorded operations are still pending.

func (*Registry) Log

func (r *Registry) Log() []Entry

Log returns the recorded entries newest-first, capped at the most recent maxLog. Retention is already bounded to maxLog, so this walks the retained slice in reverse into a fresh copy — the caller gets its own snapshot and cannot mutate registry state through it.

func (*Registry) Recent

func (r *Registry) Recent() (Entry, bool)

Recent returns the most-recently-started entry (the highest id, whether still pending or already resolved) and true, or a zero Entry and false when nothing has been recorded. Entries are kept in start order, so the last one is the newest.

func (*Registry) Start

func (r *Registry) Start(pending string) uint64

Start records a pending operation and returns its id (monotonic from 1). The returned id is the caller's handle for the later Finish or Fail; a zero-value handle is never a valid id, so "not recorded" is unambiguous. When the log is already at capacity the oldest entry is dropped, which never affects ids because lastID keeps climbing.

type Status

type Status int

Status is a recorded operation's lifecycle state.

const (
	StatusPending Status = iota // in flight
	StatusDone                  // resolved successfully
	StatusFailed                // resolved with an error
)

Jump to

Keyboard shortcuts

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