bugreport

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bugreport owns the instance-wide, private defect report store.

Index

Constants

View Source
const MaxBytes = 32 * 1024
View Source
const MaxRecordBytes = 64 * 1024
View Source
const MaxReports = 2000
View Source
const PageSize = 50
View Source
const Retention = 180 * 24 * time.Hour

Variables

View Source
var ErrConflict = errors.New("bug report version conflict")
View Source
var ErrDeleteIncomplete = errors.New("report deleted, but its deletion record was not saved as complete")
View Source
var ErrForbidden = errors.New("bug report access denied")
View Source
var ErrInvalid = errors.New("invalid bug report")
View Source
var ErrNotFound = errors.New("bug report not found")
View Source
var ErrRateLimited = errors.New("rate-limited")
View Source
var ErrUnavailable = errors.New("bug report storage is unavailable")

Functions

func ActorName

func ActorName(ctx context.Context, id string) string

func Redact

func Redact(s string) string

func Validate

func Validate(in Input) error

func WithActorName

func WithActorName(ctx context.Context, resolve func(string) string) context.Context

func WithStore

func WithStore(ctx context.Context, store *Store) context.Context

Types

type Actor

type Actor struct {
	UserID                       string
	Source                       string
	Session                      *ChangeSession
	Project, ProjectGenerationID string
}

Actor is server-owned authentication evidence, never caller input.

type ChangeSession

type ChangeSession struct {
	Name           string `json:"name"`
	RegistrationID string `json:"registrationId"`
}

type ClientDiagnostics

type ClientDiagnostics = clientdiag.ClientDiagnostics

type Deletion

type Deletion struct {
	Version             int       `json:"v"`
	ReportID            string    `json:"reportId"`
	Phase               string    `json:"phase"`
	DeletedAt           time.Time `json:"deletedAt"`
	Actor               string    `json:"actor"`
	Source              string    `json:"source"`
	ProjectGenerationID string    `json:"projectGenerationId"`
	ReceivedAt          time.Time `json:"receivedAt"`
	Severity            string    `json:"severity"`
	State               string    `json:"state"`
}

type DiagnosticEvent

type DiagnosticEvent = clientdiag.DiagnosticEvent

type Filter

type Filter struct{ Status, State, Severity, Bucket string }

type Input

type Input struct {
	Title    string             `json:"title"`
	Summary  string             `json:"summary"`
	Steps    string             `json:"steps,omitempty"`
	Expected string             `json:"expected,omitempty"`
	Actual   string             `json:"actual,omitempty"`
	Severity string             `json:"severity,omitempty"`
	Tool     string             `json:"tool,omitempty"`
	Client   *ClientDiagnostics `json:"client,omitempty"`
}

type ProjectPolicy

type ProjectPolicy func(actor string) (map[string]string, func(), error)

ProjectPolicy acquires the control read lock BEFORE the report lock, returning a stable current-generation snapshot and its release. Empty actor is only for internal current-only operations. A non-empty actor must be an active admin.

type RateLimitError

type RateLimitError struct{ RetryAt time.Time }

func (*RateLimitError) Error

func (e *RateLimitError) Error() string

func (*RateLimitError) Unwrap

func (e *RateLimitError) Unwrap() error

type Report

type Report struct {
	Input
	ID               string         `json:"id"`
	Reporter         Reporter       `json:"reporter"`
	ReceivedAt       time.Time      `json:"receivedAt"`
	ServerVersion    string         `json:"serverVersion"`
	Status           string         `json:"status"`
	Resolution       string         `json:"resolution,omitempty"`
	Note             string         `json:"note,omitempty"`
	StatusChanges    []StatusChange `json:"statusChanges,omitempty"`
	HistoryTruncated bool           `json:"historyTruncated,omitempty"`
	ExpectedVersion  string         `json:"-"`
	StatusChangedAt  time.Time      `json:"statusChangedAt,omitempty"`
	StatusChangedBy  string         `json:"statusChangedBy,omitempty"`
}

func (Report) State

func (r Report) State() string

type Reporter

type Reporter struct {
	ProjectGenerationID string `json:"projectGenerationId,omitempty"`
	Project             string `json:"project"`
	SessionName         string `json:"sessionName"`
	RegistrationID      string `json:"registrationId"`
	Harness             string `json:"harness"`
	OwnerID             string `json:"ownerId"`
}

type StatusChange

type StatusChange struct {
	At      time.Time      `json:"at"`
	From    string         `json:"from"`
	To      string         `json:"to"`
	Actor   string         `json:"actor"`
	Source  string         `json:"source"`
	Session *ChangeSession `json:"session,omitempty"`
	Note    string         `json:"note,omitempty"`
}

type Store

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

func FromContext

func FromContext(ctx context.Context) *Store

func Open

func Open(memoryDir string) (*Store, error)

Open receives the instance memory directory, never a project directory.

func Unavailable

func Unavailable() *Store

Unavailable keeps the fixed API error without opening or mutating the corrupt database. A fresh Open on a later process start is the only recovery attempt.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Create

func (s *Store) Create(in Input, reporter Reporter, version string) (Report, error)

func (*Store) Delete

func (s *Store) Delete(actor, id, expectedVersion string) (Deletion, error)

Delete holds the admin policy lease and report mutation lock through both journals. A requested record never proves that an administrator actually deleted a report.

func (*Store) DeleteProject

func (s *Store) DeleteProject(project, generation string) error

func (*Store) DeletionFor

func (s *Store) DeletionFor(actor, id string) (Deletion, error)

func (*Store) Get

func (s *Store) Get(id string) (Report, error)

func (*Store) GetFor

func (s *Store) GetFor(actor, id, bucket string) (Report, error)

func (*Store) GetProject

func (s *Store) GetProject(actor, project, generation, id string) (Report, error)

Project reads hold the same admin/current-generation policy lease as writes.

func (*Store) IsUnavailable

func (s *Store) IsUnavailable() bool

func (*Store) List

func (s *Store) List(filter Filter, page int) ([]Report, int, error)

func (*Store) ListFor

func (s *Store) ListFor(actor string, filter Filter, page int) ([]Report, int, error)

func (*Store) ListProject

func (s *Store) ListProject(actor, project, generation, state, severity string, page int) ([]Report, int, error)

func (*Store) SetProjectFilter

func (s *Store) SetProjectFilter(exists func(string) bool)

SetProjectFilter is an additional display-name filter for standalone stores. Managed runtimes use SetProjectPolicy instead. This callback must not acquire control-store locks or call back into the report store.

func (*Store) SetProjectPolicy

func (s *Store) SetProjectPolicy(policy ProjectPolicy)

SetProjectPolicy is configured before serving. It may not call this store.

func (*Store) SetResolution

func (s *Store) SetResolution(id, state, note string, actor Actor, expectedVersion string) (Report, bool, error)

func (*Store) SetStatus

func (s *Store) SetStatus(id, status, actorUserID string) error

SetStatus is retained for internal legacy callers. HTTP and MCP require a version.

func (*Store) SetStatusVersion

func (s *Store) SetStatusVersion(id, status, actor, expectedVersion string) (Report, bool, error)

SetStatusVersion keeps the old panel toggle while sharing history and CAS.

Directories

Path Synopsis
Package clientdiag defines the wire diagnostics shared by clients and the server.
Package clientdiag defines the wire diagnostics shared by clients and the server.

Jump to

Keyboard shortcuts

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