store

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package store discovers report manifests on disk and keeps an in-memory index of them. Reports are found in two places: the central reports directory and the .harness/ directory of each project root Scan is given.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Project     string    `json:"project"`
	Run         string    `json:"run"`
	Harness     string    `json:"harness"`
	Agent       string    `json:"agent"`
	Title       string    `json:"title"`
	Kind        string    `json:"kind"`
	Scope       string    `json:"scope,omitempty"`
	Status      string    `json:"status"`
	Created     string    `json:"created"`
	Verdict     string    `json:"verdict"`
	Tags        []string  `json:"tags,omitempty"`
	Source      string    `json:"source"` // "central" or "project"
	Blocks      int       `json:"blocks"`
	OpenAsks    int       `json:"open_asks"`
	Archived    bool      `json:"archived"` // soft-deleted; hidden from default views
	Dir         string    `json:"-"`        // run directory
	Path        string    `json:"-"`        // report.json path
	ModTime     time.Time `json:"-"`        // report.json modification time
	RespModTime time.Time `json:"-"`        // responses.json modification time, zero if absent
	// SearchText is the precomputed BlockText body for full-text search;
	// kept out of the API payload and held in memory as a deliberate cache.
	SearchText string `json:"-"`
	// Live carries in-flight telemetry from the manifest's optional
	// `live` field. The index keeps it shallow so inbox-rendering decisions
	// (pulse vs. static, "X in flight" counts) don't need to re-read the
	// full manifest. nil means the report has no live block.
	Live *manifest.LiveStatus `json:"live,omitempty"`
}

Entry is the indexed summary of one report. The full manifest is loaded on demand via Get.

func (Entry) Sig added in v0.1.10

func (e Entry) Sig() string

Sig returns a stable per-entry fingerprint. Changes whenever the report.json or its sibling responses.json is rewritten — which is the trigger for the report page's live-reload behavior.

type Store

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

Store holds the discovered report index. It is safe for concurrent use.

func New

func New(cfg config.Config) *Store

New returns an empty Store; call Scan to populate it.

func (*Store) Entries

func (s *Store) Entries() []Entry

Entries returns a snapshot of the indexed reports, newest first.

func (*Store) Errors

func (s *Store) Errors() []string

Errors returns the list of report files that failed to parse during the last scan.

func (*Store) Get

func (s *Store) Get(project, run string) (*manifest.Report, Entry, error)

Get loads and parses the full manifest for one indexed report.

func (*Store) Scan

func (s *Store) Scan(projectRoots []string)

Scan rebuilds the index from disk: the central directory plus the .harness/ directory of each project root it is given. The caller decides which projects count — typically the enabled set from the projects package.

func (*Store) Signature

func (s *Store) Signature() string

Signature is a fingerprint of the indexed report files. It changes whenever a report is added, removed, or modified — the live-update watcher polls it.

Jump to

Keyboard shortcuts

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