workspace

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package workspace exposes the secret-free read model used by interactive adapters such as Wails. It deliberately returns presentation-neutral values instead of database rows or complete domain snapshots.

Index

Constants

View Source
const CurrentSchemaVersion = 1
View Source
const HistoryPageSize = 25
View Source
const MaxHistoryRefresh = 100

Variables

View Source
var (
	ErrUnavailable  = errors.New("workspace service unavailable")
	ErrInconsistent = errors.New("workspace data is inconsistent")
)

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	ListPlans(context.Context) ([]domain.Plan, error)
	ListSuites(context.Context) ([]domain.Suite, error)
	ListRunProjections(context.Context) ([]RunProjection, error)
}

Catalog supplies two bounded workspace reads. Implementations aggregate run list data in their storage layer; detail records are deliberately excluded.

type Conclusion

type Conclusion string

Conclusion is the authoritative, sealed report conclusion for a run. ConclusionNone means that no sealed report exists yet; it is not inferred from request counts or the run lifecycle status.

const (
	ConclusionNone   Conclusion = "none"
	ConclusionPassed Conclusion = "passed"
	ConclusionFailed Conclusion = "failed"
)

func (Conclusion) Validate

func (conclusion Conclusion) Validate() error

type EntryProgress

type EntryProgress struct {
	EntryID           string `json:"entry_id"`
	Name              string `json:"name"`
	CaseCount         uint64 `json:"case_count"`
	ObservedCaseCount uint64 `json:"observed_case_count"`
	Status            string `json:"status"`
}

type EntryResultProjection

type EntryResultProjection struct {
	EntryID       string
	ObservedCases uint64
	Status        domain.EntryExecutionStatus
}

EntryResultProjection counts distinct Cases with persisted results, not requests.

type History

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

func NewHistory

func NewHistory(repository HistoryRepository) History

func (History) AvailableReports

func (history History) AvailableReports(ctx context.Context, ids []string) ([]string, error)

func (History) Page

func (history History) Page(ctx context.Context, after string) (HistoryPage, error)

func (History) Refresh

func (history History) Refresh(ctx context.Context, ids []string) (HistoryPage, error)

type HistoryPage

type HistoryPage struct {
	SchemaVersion int          `json:"schema_version"`
	Runs          []RunSummary `json:"runs"`
	NextCursor    string       `json:"next_cursor"`
}

type HistoryRepository

type HistoryRepository interface {
	AvailableReports(context.Context, []string) ([]string, error)
	ListRunHistory(context.Context, string) ([]RunProjection, string, error)
	ReadRunSummaries(context.Context, []string) ([]RunProjection, error)
}

type PlanSummary

type PlanSummary struct {
	ID             string          `json:"id"`
	Revision       uint64          `json:"revision"`
	Name           string          `json:"name"`
	Protocol       domain.Protocol `json:"protocol"`
	CaseCount      int             `json:"case_count"`
	RunCount       int             `json:"run_count"`
	LoadMode       domain.LoadMode `json:"load_mode"`
	Concurrency    uint32          `json:"concurrency"`
	RequestCount   uint64          `json:"request_count"`
	RatePerSecond  float64         `json:"rate_per_second"`
	DurationMS     uint64          `json:"duration_ms"`
	RequestTimeout uint64          `json:"request_timeout_ms"`
}

type RunEntryProjection

type RunEntryProjection struct {
	Performance bool               `json:"performance,omitempty"`
	EntryID     string             `json:"entry_id"`
	Name        string             `json:"name"`
	CaseCount   uint64             `json:"case_count"`
	Load        domain.LoadProfile `json:"load"`
}

type RunProjection

type RunProjection struct {
	Meta          domain.EntityMeta
	JobID         string
	Plan          domain.EntityRevisionRef
	PlanName      string
	Model         TargetProjection
	Channel       TargetProjection
	Status        domain.RunStatus
	Source        string
	Failure       *domain.RunFailure
	Entries       []RunEntryProjection
	ReportID      string
	Completed     uint64
	Passed        uint64
	Failed        uint64
	Observed      uint64
	Indeterminate uint64
	ArtifactCount uint64
	Conclusion    Conclusion
	EntryResults  []EntryResultProjection
}

RunProjection contains only fields displayed by the workspace. Full Run snapshots and authored Case definitions belong to explicit detail reads.

func (RunProjection) Summary

func (projection RunProjection) Summary() (RunSummary, error)

Summary validates and projects a single bounded history record.

func (RunProjection) Validate

func (projection RunProjection) Validate() error

type RunSummary

type RunSummary struct {
	JobID             string           `json:"job_id,omitempty"`
	ReportID          string           `json:"report_id,omitempty"`
	CaseCount         uint64           `json:"case_count"`
	ObservedCaseCount uint64           `json:"observed_case_count"`
	EntryProgress     []EntryProgress  `json:"entry_progress"`
	Source            string           `json:"source,omitempty"`
	ID                string           `json:"id"`
	Revision          uint64           `json:"revision"`
	PlanID            string           `json:"plan_id"`
	PlanRevision      uint64           `json:"plan_revision"`
	PlanName          string           `json:"plan_name"`
	Status            domain.RunStatus `json:"status"`
	Conclusion        Conclusion       `json:"conclusion"`
	FailurePhase      domain.ErrorCode `json:"failure_phase,omitempty"`
	ErrorCode         domain.ErrorCode `json:"error_code,omitempty"`
	ModelID           string           `json:"model_id"`
	ModelRevision     uint64           `json:"model_revision"`
	ModelName         string           `json:"model_name"`
	ChannelID         string           `json:"channel_id"`
	ChannelRevision   uint64           `json:"channel_revision"`
	ChannelName       string           `json:"channel_name"`
	LoadMode          domain.LoadMode  `json:"load_mode"`
	Concurrency       uint32           `json:"concurrency"`
	RatePerSecond     float64          `json:"rate_per_second"`
	Planned           uint64           `json:"planned"`
	DurationMS        uint64           `json:"duration_ms"`
	Completed         uint64           `json:"completed"`
	Passed            uint64           `json:"passed"`
	Failed            uint64           `json:"failed"`
	Observed          uint64           `json:"observed"`
	Indeterminate     uint64           `json:"indeterminate"`
	ArtifactCount     uint64           `json:"artifact_count"`
	StartedAt         time.Time        `json:"started_at"`
	UpdatedAt         time.Time        `json:"updated_at"`
}

type Service

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

func New

func New(catalog Catalog) Service

func (Service) Snapshot

func (service Service) Snapshot(ctx context.Context) (Snapshot, error)

type Snapshot

type Snapshot struct {
	SchemaVersion int           `json:"schema_version"`
	Plans         []PlanSummary `json:"plans"`
	Runs          []RunSummary  `json:"runs"`
	ActiveRunID   string        `json:"active_run_id,omitempty"`
}

type TargetProjection

type TargetProjection struct {
	domain.EntityRevisionRef
	Name string
}

Jump to

Keyboard shortcuts

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