Documentation
¶
Overview ¶
Package reporting exposes the safe, presentation-neutral report read model used by overview, report, desktop, and CLI adapters.
Index ¶
- Constants
- Variables
- func EntryFailed(entry domain.RunEntrySnapshot, results []domain.Result) bool
- type CaseDetail
- type Catalog
- type Comparison
- type ComparisonCell
- type ComparisonMetric
- type ComparisonRow
- type Detail
- type DimensionStatistic
- type DocumentCatalog
- type EntryDetail
- type ExportFormat
- type ExportedDocument
- type GenerationProgress
- type GenerationSnapshot
- type GenerationTiming
- type Generator
- type GeneratorClock
- type GeneratorDependencies
- type PerformanceOverview
- type PerformanceOverviewMetric
- type PerformanceRating
- type PerformanceSummary
- type QuickPerformanceCatalog
- type ReportIDFactory
- type ReportProjection
- type ReportRepository
- type ReportSource
- type Service
- func (service Service) Detail(ctx context.Context, reportID string) (Detail, error)
- func (service Service) Export(ctx context.Context, reportID string, format ExportFormat, watermark string) (ExportedDocument, error)
- func (service Service) ExportLocalized(ctx context.Context, reportID string, format ExportFormat, ...) (ExportedDocument, error)
- func (service Service) Snapshot(ctx context.Context) (Snapshot, error)
- type Snapshot
- type Summary
Constants ¶
const ( CurrentSchemaVersion = 1 CurrentDetailSchemaVersion = 1 // MaxSnapshotReports is the published latest-first report-list boundary. // Storage ports must never return more entries in one snapshot. MaxSnapshotReports = 100 )
const MaxComparisonReports = 8
MaxComparisonReports bounds detail and evidence reads for an interactive view.
Variables ¶
var ( ErrInconsistent = errors.New("reporting data is inconsistent") )
var ErrGenerationInvalid = errors.New("reporting: invalid generation request")
var ErrInvalidWatermark = errors.New("invalid report watermark")
var ErrReportWrite = errors.New("reporting: report write failed")
ErrReportWrite marks the only generation failure that may have committed. Loading and computation failures never require a second report read.
var ErrUnsupportedExport = errors.New("unsupported report export format")
var ErrUnsupportedExportLocale = errors.New("unsupported report export locale")
Functions ¶
func EntryFailed ¶
func EntryFailed(entry domain.RunEntrySnapshot, results []domain.Result) bool
EntryFailed applies the same measured verdict and SLA rules used by reports before the run host decides whether to start the next plan item.
Types ¶
type CaseDetail ¶
type CaseDetail struct {
CaseID string `json:"case_id"`
Revision uint64 `json:"revision"`
Key string `json:"key"`
Name string `json:"name"`
Dimension string `json:"dimension"`
Protocol domain.Protocol `json:"protocol"`
Severity domain.CaseSeverity `json:"severity"`
Verification domain.VerificationSummary `json:"verification"`
Metrics map[string]domain.MetricValue `json:"metrics"`
SummaryResult *domain.Result `json:"summary_result,omitempty"`
RequestResults []domain.Result `json:"request_results"`
}
type Catalog ¶
type Catalog interface {
ListReportProjections(context.Context) ([]ReportProjection, error)
}
Catalog supplies one bounded storage read. ReportProjection contains only scalar values that the reporting application service is allowed to expose.
type Comparison ¶ added in v0.2.0
type Comparison struct {
SchemaVersion int `json:"schema_version"`
BaselineID string `json:"baseline_id"`
Reports []Detail `json:"reports"`
Rows []ComparisonRow `json:"rows"`
}
type ComparisonCell ¶ added in v0.2.0
type ComparisonMetric ¶ added in v0.2.0
type ComparisonRow ¶ added in v0.2.0
type ComparisonRow struct {
Key string `json:"key"`
Name string `json:"name"`
EntryName string `json:"entry_name"`
Different bool `json:"different"`
Cells []ComparisonCell `json:"cells"`
}
type Detail ¶
type Detail struct {
SchemaVersion int `json:"schema_version"`
Source ReportSource `json:"source"`
Report domain.Report `json:"report"`
RequestResults []domain.Result `json:"request_results"`
Entries []EntryDetail `json:"entries"`
UnassignedRequestResults []domain.Result `json:"unassigned_request_results"`
Performance *quicktest.PerformanceReport `json:"performance,omitempty"`
PerformanceSummary *PerformanceSummary `json:"performance_summary,omitempty"`
DimensionStatistics []DimensionStatistic `json:"dimension_statistics,omitempty"`
PerformanceOverviews map[string]PerformanceOverview `json:"performance_overviews,omitempty"`
}
Detail is the complete machine-readable report view. Report contains the sealed conclusion and case-level results; RequestResults contains the load and protocol observations used to derive the aggregate metrics.
type DimensionStatistic ¶
type DimensionStatistic struct {
Dimension string `json:"dimension"`
CaseCount uint64 `json:"case_count"`
PassedCaseCount uint64 `json:"passed_case_count"`
FailedCaseCount uint64 `json:"failed_case_count"`
ObservedCaseCount uint64 `json:"observed_case_count"`
IndeterminateCaseCount uint64 `json:"indeterminate_case_count"`
NotRunCaseCount uint64 `json:"not_run_case_count"`
PassRatePercent *float64 `json:"pass_rate_percent"`
}
DimensionStatistic counts each frozen (entry, case) once, independently of load.
type DocumentCatalog ¶
type DocumentCatalog interface {
Catalog
GetReport(context.Context, string) (domain.Report, error)
ListResults(context.Context, string) ([]domain.Result, error)
}
DocumentCatalog exposes the sealed report and its request-level results. Large provider payloads remain behind the redacted evidence/artifact boundary.
type EntryDetail ¶
type EntryDetail struct {
Performance json.RawMessage `json:"performance,omitempty"`
WarmupCount uint32 `json:"warmup_count"`
Settings testspec.RunSettings `json:"settings"`
EntryID string `json:"entry_id"`
TargetKind domain.PlanTargetKind `json:"target_kind"`
TargetID string `json:"target_id"`
Name string `json:"name"`
Key string `json:"key"`
Protocol domain.Protocol `json:"protocol"`
Parameters map[string]json.RawMessage `json:"parameters"`
Load domain.LoadProfile `json:"load"`
Seed uint64 `json:"seed"`
Status domain.EntryReportStatus `json:"status"`
Conclusion domain.ReportConclusion `json:"conclusion"`
Verification domain.VerificationSummary `json:"verification"`
SLA map[string]domain.MetricValue `json:"sla"`
Metrics map[string]domain.MetricValue `json:"metrics"`
Timeline []json.RawMessage `json:"timeline"`
Distributions []json.RawMessage `json:"distributions"`
Cases []CaseDetail `json:"cases"`
}
type ExportFormat ¶
type ExportFormat string
const ( ExportJSON ExportFormat = "json" ExportHTML ExportFormat = "html" ExportPNG ExportFormat = "png" ExportPDF ExportFormat = "pdf" DefaultWatermark = "rhzs" MaxWatermarkLength = 64 )
type ExportedDocument ¶
type ExportedDocument struct {
Filename string `json:"filename"`
MediaType string `json:"media_type"`
DataBase64 string `json:"data_base64"`
}
ExportedDocument is safe for JSON/Wails transport. Encoding the bytes here keeps JavaScript bindings stable across platforms and Wails versions.
type GenerationProgress ¶
type GenerationProgress struct {
Sequence uint64 `json:"sequence"`
RunID string `json:"run_id"`
Phase string `json:"phase"`
Processed uint64 `json:"processed"`
Total uint64 `json:"total"`
ElapsedMS uint64 `json:"elapsed_ms"`
ReportID string `json:"report_id,omitempty"`
}
GenerationProgress describes real work; an unknown total is zero and must be presented as an indeterminate phase, never as an estimated percentage.
type GenerationSnapshot ¶
type GenerationSnapshot struct {
SchemaVersion int `json:"schema_version"`
Runs []GenerationProgress `json:"runs"`
}
type GenerationTiming ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func NewGenerator(dependencies GeneratorDependencies) (*Generator, error)
func (*Generator) GenerationSnapshot ¶
func (generator *Generator) GenerationSnapshot() GenerationSnapshot
func (*Generator) SubscribeProgress ¶
func (generator *Generator) SubscribeProgress(observer func(GenerationProgress)) func()
type GeneratorClock ¶
type GeneratorDependencies ¶
type GeneratorDependencies struct {
Repository ReportRepository
Clock GeneratorClock
IDFactory ReportIDFactory
Timing func(GenerationTiming)
}
type PerformanceOverview ¶ added in v0.1.5
type PerformanceOverview struct {
Status string `json:"status"`
SampleCount uint64 `json:"sample_count"`
PassedCount uint64 `json:"passed_count"`
EvaluatedCount uint64 `json:"evaluated_count"`
ObservedCount uint64 `json:"observed_count"`
UnevaluatedCount uint64 `json:"unevaluated_count"`
Rating *PerformanceRating `json:"rating"`
Metrics []PerformanceOverviewMetric `json:"metrics"`
}
PerformanceOverview is a read-time presentation projection, never a replacement for the archived transport, per-request SLO, or capacity conclusion. The current reference standard applies success ≥99%, TTFT P95 <15 s, TPOT P95 <40 ms, E2E P95 <30 s and successful throughput ≥2 req/s. Saved E2E limits take precedence.
type PerformanceOverviewMetric ¶ added in v0.1.5
type PerformanceRating ¶ added in v0.1.5
type PerformanceRating struct {
Method string `json:"method"`
Score float64 `json:"score"`
MaxScore uint64 `json:"max_score"`
MetricCount uint64 `json:"metric_count"`
}
PerformanceRating describes this report's configured targets, not an absolute ranking across channels with different workloads or targets.
type PerformanceSummary ¶
type PerformanceSummary struct {
ItemCount uint64 `json:"item_count"`
MeasuredItemCount uint64 `json:"measured_item_count"`
CompletedItemCount uint64 `json:"completed_item_count"`
Completed uint64 `json:"completed"`
Succeeded uint64 `json:"succeeded"`
Failed uint64 `json:"failed"`
TimedOut uint64 `json:"timed_out"`
PromptTokens uint64 `json:"prompt_tokens"`
CompletionTokens uint64 `json:"completion_tokens"`
CachedTokens uint64 `json:"cached_tokens"`
SuccessRatePercent *float64 `json:"success_rate_percent"`
CacheRatePercent *float64 `json:"cache_rate_percent"`
TotalDurationMS float64 `json:"total_duration_ms"`
SuccessfulRequestQPS *float64 `json:"successful_request_qps"`
SamplesComplete bool `json:"samples_complete"`
TTFT *quicktest.PerformanceLatencySlice `json:"ttft"`
E2E *quicktest.PerformanceLatencySlice `json:"e2e"`
}
PerformanceSummary is a read-time view of sealed steady-state observations. It does not replace an item's historical metrics, SLO or capacity verdict.
type QuickPerformanceCatalog ¶
type ReportProjection ¶
type ReportProjection struct {
PassedCaseCount int64
VerifiedCaseCount int64
ObservedCaseCount int64
IndeterminateCaseCount int64
ID string
RunID string
GeneratedAt time.Time
RunStatus domain.RunStatus
PlanName string
ModelName string
ChannelName string
Passed bool
Verdict string
IssueCount int64
CaseCount int64
FailedCaseCount int64
AttachmentCount int64
}
type ReportRepository ¶
type ReportRepository interface {
GetRun(context.Context, string) (domain.Run, error)
RunExecutionOrigin(context.Context, string) (*domain.ExecutionOrigin, error)
ListResults(context.Context, string) ([]domain.Result, error)
ListEvidence(context.Context, string) ([]domain.Evidence, error)
CreateReport(context.Context, domain.Report) error
}
type ReportSource ¶
type ReportSource string
const ( SourceRun ReportSource = "run" SourceQuickPerformance ReportSource = "quick_performance" )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (Service) Export ¶
func (service Service) Export(ctx context.Context, reportID string, format ExportFormat, watermark string) (ExportedDocument, error)
func (Service) ExportLocalized ¶
func (service Service) ExportLocalized(ctx context.Context, reportID string, format ExportFormat, watermark, locale string) (ExportedDocument, error)
type Summary ¶
type Summary struct {
PassedCaseCount uint64 `json:"passed_case_count"`
VerifiedCaseCount uint64 `json:"verified_case_count"`
ObservedCaseCount uint64 `json:"observed_case_count"`
IndeterminateCaseCount uint64 `json:"indeterminate_case_count"`
Source ReportSource `json:"source"`
ID string `json:"id"`
RunID string `json:"run_id,omitempty"`
GeneratedAt time.Time `json:"generated_at"`
RunStatus domain.RunStatus `json:"run_status"`
PlanName string `json:"plan_name"`
ModelName string `json:"model_name"`
ChannelName string `json:"channel_name"`
Passed bool `json:"passed"`
Verdict string `json:"verdict"`
IssueCount uint64 `json:"issue_count"`
CaseCount uint64 `json:"case_count"`
FailedCaseCount uint64 `json:"failed_case_count"`
AttachmentCount uint64 `json:"attachment_count"`
}
func SummarizeQuickPerformance ¶
func SummarizeQuickPerformance(report quicktest.PerformanceArchiveSummary) (Summary, error)
SummarizeQuickPerformance preserves the archived conclusion in list projections.