Documentation
¶
Overview ¶
Package receipt projects privacy-safe, portable observations from Yield's authoritative append-only run journal.
Index ¶
- Constants
- func CanonicalBytes(value any) ([]byte, error)
- func Seal(receipt *RunReceipt) error
- func VerifyCanonical(receipt *RunReceipt, raw []byte) error
- type DivergenceOutcome
- type ExperimentContext
- type JournalBinding
- type LocalReport
- type NamedCount
- type OperationObservation
- type OperationSummary
- type OutcomeSummary
- type ProfileDigest
- type ReportOperationSummary
- type ReportOptions
- type RequirementOutcome
- type ResponseRejectionSummary
- type RunIdentity
- type RunReceipt
- type RuntimeIdentity
- type SkillIdentity
- type Snapshot
- type Store
- func (s *Store) ListRuns() ([]string, error)
- func (s *Store) LoadDigest(receiptDigest string) (*RunReceipt, []byte, error)
- func (s *Store) LoadRun(runID string) (*RunReceipt, []byte, error)
- func (s *Store) Materialize(snapshot Snapshot) (*RunReceipt, []byte, error)
- func (s *Store) Put(r *RunReceipt, raw []byte) error
- type TimingSummary
Constants ¶
const ( Schema = "yield.observation.v1" Kind = "run_receipt" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalBytes ¶
CanonicalBytes returns RFC 8785-compatible JSON for the receipt's closed, integer-only data model.
func VerifyCanonical ¶
func VerifyCanonical(receipt *RunReceipt, raw []byte) error
VerifyCanonical proves that bytes are the canonical encoding named by the receipt digest.
Types ¶
type DivergenceOutcome ¶
type ExperimentContext ¶
type ExperimentContext struct {
ExperimentID string `json:"experiment_id"`
CohortID string `json:"cohort_id,omitempty"`
VariantID string `json:"variant_id"`
Role string `json:"role"`
BaselineVariantID string `json:"baseline_variant_id,omitempty"`
ParentSkillVersion string `json:"parent_skill_version,omitempty"`
}
func DecodeExperiment ¶
func DecodeExperiment(raw []byte) (*ExperimentContext, error)
DecodeExperiment admits a closed, non-personal experiment context.
func (ExperimentContext) Validate ¶
func (context ExperimentContext) Validate() error
type JournalBinding ¶
type LocalReport ¶
type LocalReport struct {
ReceiptCount int `json:"receipt_count"`
Lifecycle []NamedCount `json:"lifecycle"`
Terminal []NamedCount `json:"terminal"`
Operations []ReportOperationSummary `json:"operations"`
ResponseRejections []NamedCount `json:"response_rejections"`
Requirements []NamedCount `json:"requirements"`
DivergenceCount int `json:"divergence_count"`
RuntimeGroups []NamedCount `json:"runtime_groups"`
SourceGroups []NamedCount `json:"source_groups"`
ExperimentGroups []NamedCount `json:"experiment_groups"`
OpenOlderThanThreshold int `json:"open_older_than_threshold,omitempty"`
}
func BuildReport ¶
func BuildReport(receipts []*RunReceipt, options ReportOptions) (LocalReport, error)
type NamedCount ¶
type OperationObservation ¶
type OperationObservation struct {
Sequence int `json:"sequence"`
Kind protocol.OpKind `json:"kind"`
OperationKeyDigest string `json:"operation_key_digest"`
RequestedAt string `json:"requested_at"`
CompletedAt string `json:"completed_at,omitempty"`
ElapsedMS *int64 `json:"elapsed_ms,omitempty"`
ResultDigest string `json:"result_digest,omitempty"`
ClockAnomaly bool `json:"clock_anomaly,omitempty"`
}
type OperationSummary ¶
type OutcomeSummary ¶
type ProfileDigest ¶
type ReportOperationSummary ¶
type ReportOptions ¶
type RequirementOutcome ¶
type RunIdentity ¶
type RunReceipt ¶
type RunReceipt struct {
Schema string `json:"schema"`
Kind string `json:"kind"`
ReceiptDigest string `json:"receipt_digest,omitempty"`
Journal JournalBinding `json:"journal"`
Run RunIdentity `json:"run"`
Skill SkillIdentity `json:"skill"`
Runtime *RuntimeIdentity `json:"runtime,omitempty"`
Timing TimingSummary `json:"timing"`
Operations []OperationObservation `json:"operations"`
OperationSummaries []OperationSummary `json:"operation_summaries"`
Outcome OutcomeSummary `json:"outcome"`
Requirements []RequirementOutcome `json:"requirements"`
ResponseRejections []ResponseRejectionSummary `json:"response_rejections"`
Divergences []DivergenceOutcome `json:"divergences"`
Experiment *ExperimentContext `json:"experiment,omitempty"`
}
func Project ¶
func Project(snapshot Snapshot) (*RunReceipt, error)
Project deterministically derives one receipt from one exact journal prefix.
func (*RunReceipt) Validate ¶
func (receipt *RunReceipt) Validate() error
Validate checks the closed Go representation against the public contract.
type RuntimeIdentity ¶
type SkillIdentity ¶
type SkillIdentity struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
BindingDigest string `json:"binding_digest,omitempty"`
SourceDigest *ProfileDigest `json:"source_digest,omitempty"`
}
type Store ¶
type Store struct {
Root string
}
Store materializes immutable receipt objects and mutable per-run references.
func StoreForRunsDir ¶
func (*Store) LoadDigest ¶
func (s *Store) LoadDigest(receiptDigest string) (*RunReceipt, []byte, error)
LoadDigest reads and verifies an immutable receipt object.
func (*Store) LoadRun ¶
func (s *Store) LoadRun(runID string) (*RunReceipt, []byte, error)
LoadRun reads the latest materialized receipt for a run.
func (*Store) Materialize ¶
func (s *Store) Materialize(snapshot Snapshot) (*RunReceipt, []byte, error)
Materialize projects and durably stores the receipt for one exact prefix.