manifest

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package manifest owns the stable contribution evidence export contract.

Index

Constants

View Source
const (
	// StatementType identifies the standard in-toto statement envelope.
	StatementType = "https://in-toto.io/Statement/v1"
	// PredicateType identifies the GitContribute evidence predicate.
	PredicateType = "https://github.com/morluto/gitcontribute/attestation/contribution-evidence/v1"
	// SchemaVersion identifies the predicate's product-owned schema.
	SchemaVersion = "contribution-evidence.v1"
	// ManifestIDPrefix identifies the digest algorithm used by manifest IDs.
	ManifestIDPrefix = "sha256:"
)

Variables

View Source
var (
	ErrNotFound         = errors.New("contribution manifest not found")
	ErrIdentityMismatch = errors.New("contribution manifest identity mismatch")
)

ErrNotFound means no persisted manifest matched the requested identity.

Functions

This section is empty.

Types

type CompletenessFacet

type CompletenessFacet struct {
	Facet  string `json:"facet"`
	Status string `json:"status"`
	Reason string `json:"reason"`
}

CompletenessFacet reports whether one evidence area is usable.

type DraftRecord

type DraftRecord struct {
	Kind       string    `json:"kind"`
	Title      string    `json:"title"`
	RenderedAt time.Time `json:"rendered_at"`
	ManifestID string    `json:"manifest_id,omitempty"`
}

DraftRecord identifies a locally prepared contribution draft.

type EvidenceRecord

type EvidenceRecord struct {
	ID               string                    `json:"id"`
	Type             string                    `json:"type"`
	Relation         string                    `json:"relation"`
	Description      string                    `json:"description"`
	ValidationRunID  string                    `json:"validation_run_id,omitempty"`
	SourceRefs       []domain.SourceRef        `json:"source_refs"`
	SourceProvenance []evidence.SourceRevision `json:"source_provenance"`
	Freshness        string                    `json:"freshness"`
	FreshnessReason  string                    `json:"freshness_reason"`
}

EvidenceRecord captures a stored evidence item and evaluated freshness.

type FacetStatus

type FacetStatus struct {
	Facet     string `json:"facet"`
	Status    string `json:"status"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

FacetStatus reports freshness and completeness for one GitHub projection.

type Gap

type Gap struct {
	Code   string `json:"code"`
	Facet  string `json:"facet"`
	Reason string `json:"reason"`
}

Gap records evidence that is missing, stale, unknown, or incompatible.

type OpportunityRecord

type OpportunityRecord struct {
	ID               string             `json:"id"`
	InvestigationID  string             `json:"investigation_id"`
	HypothesisID     string             `json:"hypothesis_id,omitempty"`
	ProblemStatement string             `json:"problem_statement"`
	Scope            string             `json:"scope"`
	Impact           string             `json:"impact"`
	Status           string             `json:"status"`
	SourceRefs       []domain.SourceRef `json:"source_refs"`
}

OpportunityRecord captures the scoped contribution outcome.

type Predicate

type Predicate struct {
	SchemaVersion string              `json:"schema_version"`
	ManifestID    string              `json:"manifest_id"`
	ContentSHA256 string              `json:"content_sha256"`
	GeneratedAt   time.Time           `json:"generated_at"`
	Repository    RepositoryIdentity  `json:"repository"`
	Opportunity   OpportunityRecord   `json:"opportunity"`
	Workspace     *workspace.Snapshot `json:"workspace,omitempty"`
	Validations   []ValidationRecord  `json:"validations"`
	Evidence      []EvidenceRecord    `json:"evidence"`
	Readiness     ReadinessRecord     `json:"readiness"`
	PullRequest   *PullRequestRecord  `json:"pull_request,omitempty"`
	Drafts        []DraftRecord       `json:"drafts"`
	Status        string              `json:"status"`
	Completeness  []CompletenessFacet `json:"completeness"`
	Gaps          []Gap               `json:"gaps"`
}

Predicate is the self-contained contribution evidence manifest.

type PullRequestRecord

type PullRequestRecord struct {
	Owner                   string        `json:"owner"`
	Repo                    string        `json:"repo"`
	Number                  int           `json:"number"`
	State                   string        `json:"state"`
	HeadSHA                 string        `json:"head_sha,omitempty"`
	BaseSHA                 string        `json:"base_sha,omitempty"`
	ChecksStatus            string        `json:"checks_status,omitempty"`
	ReviewDecision          string        `json:"review_decision,omitempty"`
	UnresolvedReviewThreads *int          `json:"unresolved_review_threads,omitempty"`
	MergeStateStatus        string        `json:"merge_state_status,omitempty"`
	MergeQueueState         string        `json:"merge_queue_state,omitempty"`
	Attention               string        `json:"attention"`
	SourceUpdatedAt         string        `json:"source_updated_at"`
	Facets                  []FacetStatus `json:"facets"`
}

PullRequestRecord captures explicitly selected, locally stored PR health.

type ReadinessCheck

type ReadinessCheck struct {
	RuleID       string   `json:"rule_id"`
	RuleVersion  string   `json:"rule_version"`
	Status       string   `json:"status"`
	Summary      string   `json:"summary"`
	EvidenceRefs []string `json:"evidence_refs"`
}

ReadinessCheck captures one versioned readiness rule result.

type ReadinessRecord

type ReadinessRecord struct {
	RuleSetVersion string           `json:"rule_set_version"`
	Status         string           `json:"status"`
	EvaluatedAt    string           `json:"evaluated_at"`
	Checks         []ReadinessCheck `json:"checks"`
}

ReadinessRecord captures the deterministic readiness rule evaluation.

type RepositoryIdentity

type RepositoryIdentity struct {
	Owner     string `json:"owner"`
	Repo      string `json:"repo"`
	CommitSHA string `json:"investigation_commit_sha"`
}

RepositoryIdentity binds the manifest to the investigated source revision.

type ResourceDescriptor

type ResourceDescriptor struct {
	Name   string            `json:"name"`
	Digest map[string]string `json:"digest"`
}

ResourceDescriptor follows the in-toto v1 subject identity shape.

type Statement

type Statement struct {
	Type          string               `json:"_type"`
	Subject       []ResourceDescriptor `json:"subject"`
	PredicateType string               `json:"predicateType"`
	Predicate     Predicate            `json:"predicate"`
}

Statement wraps the product predicate in an in-toto Statement v1 envelope.

func Finalize

func Finalize(predicate Predicate) (Statement, error)

Finalize computes the deterministic content identity and in-toto subject.

func (Statement) Validate

func (s Statement) Validate() error

Validate checks the stable envelope and identity fields before persistence.

type ValidationRecord

type ValidationRecord struct {
	DefinitionID            string                        `json:"definition_id"`
	RunID                   string                        `json:"run_id"`
	Kind                    string                        `json:"kind"`
	Command                 []string                      `json:"command"`
	CommandSHA256           string                        `json:"command_sha256"`
	ExecutionContractSHA256 string                        `json:"execution_contract_sha256"`
	EnvironmentAllowlist    []string                      `json:"environment_allowlist"`
	Timeout                 string                        `json:"timeout"`
	MaxOutputBytes          int64                         `json:"max_output_bytes"`
	Observation             *evidence.ObservationContract `json:"observation,omitempty"`
	Classification          string                        `json:"classification"`
	ObservationStatus       string                        `json:"observation_status"`
	Observations            []evidence.ObservationResult  `json:"observations"`
	StartedAt               time.Time                     `json:"started_at"`
	CompletedAt             time.Time                     `json:"completed_at"`
	WorkspaceSnapshotBefore string                        `json:"workspace_snapshot_before,omitempty"`
	WorkspaceSnapshotAfter  string                        `json:"workspace_snapshot_after,omitempty"`
	WorkspaceBindingStatus  string                        `json:"workspace_binding_status"`
	WorkspaceCompatibility  string                        `json:"workspace_compatibility"`
	CompatibilityReason     string                        `json:"compatibility_reason"`
	Selected                bool                          `json:"selected_for_completeness"`
}

ValidationRecord binds a stored run to its command and candidate identity.

Jump to

Keyboard shortcuts

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