analysisartifact

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package analysisartifact defines the bounded, analyzer-neutral envelope used to attach post-run evidence to an immutable isutools snapshot.

Index

Constants

View Source
const (
	SchemaV1             = "isutools.external-analysis/v1"
	MaxManifestBytes     = int64(2 << 20)
	MaxFiles             = 32
	MaxDiagnostics       = 64
	MaxExtensions        = 8
	MaxExtensionBytes    = 64 << 10
	MaxMemoryBytes       = uint64(4 << 30)
	MaxFileBytes         = uint64(1 << 30)
	MaxTimeoutMS         = uint64((10 * time.Minute) / time.Millisecond)
	SHA256HexLength      = 64
	StatusReady          = "ready"
	StatusPartial        = "partial"
	StatusUnsupported    = "unsupported"
	StatusFailed         = "failed"
	StatusInvalid        = "invalid"
	KindAccessLog        = "accesslog"
	KindMySQLSlowLog     = "mysql-slowlog"
	KindRuntimeProfile   = "runtime-profile"
	KindTrace            = "trace"
	KindProfileHandoff   = "profile-handoff"
	KindPGO              = "pgo"
	VisibilityPortable   = "portable"
	VisibilityRestricted = "restricted"
	DiagnosticInfo       = "info"
	DiagnosticWarn       = "warn"
	DiagnosticError      = "error"
)
View Source
const (
	CurrentSchemaV1   = "isutools.external-analysis-current/v1"
	CommitSchemaV1    = "isutools.external-analysis-commit/v1"
	NoCurrentArtifact = "none"
)

Variables

This section is empty.

Functions

func CanonicalJSON

func CanonicalJSON(in Manifest) ([]byte, error)

func Validate

func Validate(in Manifest) error

func VerifyRunBinding

func VerifyRunBinding(root *safefs.Root, binding RunBinding) error

VerifyRunBinding proves that the immutable snapshot named by a run-bound artifact still has the exact ledger hash, schema, and run identity.

Types

type Analyzer

type Analyzer struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Revision string `json:"revision,omitempty"`
}

type ConflictError

type ConflictError struct {
	CurrentArtifactID string
	Sequence          uint64
}

func (*ConflictError) Error

func (e *ConflictError) Error() string

type Content

type Content struct {
	Role       string
	Extension  string
	MediaType  string
	Visibility string
	Body       []byte
	MaxBytes   int64
}

Content is one already-redacted analyzer output. Body is never accepted as an input reference: raw evidence must stay restricted and be described by a separately calculated FileRef in the manifest.

type Coverage

type Coverage struct {
	Complete        bool      `json:"complete"`
	Clock           string    `json:"clock,omitempty"`
	StartedAt       time.Time `json:"started_at,omitzero"`
	EndedAt         time.Time `json:"ended_at,omitzero"`
	StartDevice     uint64    `json:"start_device,omitempty"`
	StartInode      uint64    `json:"start_inode,omitempty"`
	StartOffset     uint64    `json:"start_offset,omitempty"`
	EndDevice       uint64    `json:"end_device,omitempty"`
	EndInode        uint64    `json:"end_inode,omitempty"`
	EndOffset       uint64    `json:"end_offset,omitempty"`
	ApproximationNS uint64    `json:"approximation_ns,omitempty"`
	Reason          string    `json:"reason,omitempty"`
}

type Current

type Current struct {
	Schema             string `json:"schema"`
	Namespace          string `json:"namespace"`
	Kind               string `json:"kind"`
	ArtifactID         string `json:"artifact_id"`
	ManifestFile       string `json:"manifest_file"`
	ManifestSHA256     string `json:"manifest_sha256"`
	Sequence           uint64 `json:"sequence"`
	PreviousArtifactID string `json:"previous_artifact_id,omitempty"`
	CommitFile         string `json:"commit_file"`
}

type Diagnostic

type Diagnostic struct {
	Level   string `json:"level"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Executable

type Executable struct {
	CapturedSHA256 string `json:"captured_sha256,omitempty"`
	AnalyzedSHA256 string `json:"analyzed_sha256,omitempty"`
	Match          string `json:"match"`
	GoVersion      string `json:"go_version,omitempty"`
	VCSRevision    string `json:"vcs_revision,omitempty"`
	VCSModified    bool   `json:"vcs_modified,omitempty"`
}

type FileRef

type FileRef struct {
	Role       string `json:"role"`
	Name       string `json:"name"`
	SHA256     string `json:"sha256"`
	Bytes      uint64 `json:"bytes"`
	MediaType  string `json:"media_type"`
	Visibility string `json:"visibility"`
	Truncated  bool   `json:"truncated,omitempty"`
}

type Inspection

type Inspection struct {
	Schema     string `json:"schema"`
	Kind       string `json:"kind,omitempty"`
	ArtifactID string `json:"artifact_id,omitempty"`
	Status     string `json:"status"`
	Code       string `json:"code,omitempty"`
}

func Inspect

func Inspect(reader io.Reader) (Inspection, error)

Inspect is the forward-compatible display path. Decode remains strict for trusted use; an unknown schema is visible as unsupported, never as corrupt.

type Manifest

type Manifest struct {
	Schema      string                     `json:"schema"`
	ArtifactID  string                     `json:"artifact_id"`
	Kind        string                     `json:"kind"`
	GeneratedAt time.Time                  `json:"generated_at"`
	Analyzer    Analyzer                   `json:"analyzer"`
	Status      string                     `json:"status"`
	Run         *RunBinding                `json:"run,omitempty"`
	Inputs      []FileRef                  `json:"inputs,omitempty"`
	Outputs     []FileRef                  `json:"outputs,omitempty"`
	Executable  *Executable                `json:"executable,omitempty"`
	Coverage    Coverage                   `json:"coverage"`
	Budget      ResourceBudget             `json:"budget"`
	Diagnostics []Diagnostic               `json:"diagnostics,omitempty"`
	Extensions  map[string]json.RawMessage `json:"extensions,omitempty"`
}

func Decode

func Decode(r io.Reader) (Manifest, error)

func SetArtifactID

func SetArtifactID(in Manifest) (Manifest, error)

type PublishResult

type PublishResult struct {
	Current
	Durability string `json:"durability"`
}

type ResourceBudget

type ResourceBudget struct {
	TimeoutMS      uint64 `json:"timeout_ms,omitempty"`
	MaxInputBytes  uint64 `json:"max_input_bytes,omitempty"`
	MaxOutputBytes uint64 `json:"max_output_bytes,omitempty"`
	MaxMemoryBytes uint64 `json:"max_memory_bytes,omitempty"`
}

type RunBinding

type RunBinding struct {
	RunID                 string `json:"run_id"`
	SnapshotBase          string `json:"snapshot_base"`
	SnapshotSHA256        string `json:"snapshot_sha256"`
	SnapshotSchemaVersion int    `json:"snapshot_schema_version"`
}

type Store

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

func NewStore

func NewStore(root *safefs.Root) *Store

func (*Store) ListCurrent

func (s *Store) ListCurrent(limit int) []Summary

ListCurrent returns only verified, regular current markers. Restricted outputs remain represented by metadata but are omitted from the portable link list used by dashboards and exported reports.

func (*Store) LoadCurrent

func (s *Store) LoadCurrent(namespace, kind string) (Current, error)

func (*Store) Publish

func (s *Store) Publish(namespace string, manifest Manifest, expectedCurrent string) (PublishResult, error)

func (*Store) PublishContent

func (s *Store) PublishContent(namespace, kind string, content Content) (FileRef, error)

PublishContent writes an immutable content-addressed output with mode 0600. Names are derived from the digest, not from an operator supplied path.

type Summary

type Summary struct {
	Namespace    string      `json:"namespace"`
	Kind         string      `json:"kind"`
	ArtifactID   string      `json:"artifact_id,omitempty"`
	Status       string      `json:"status"`
	Code         string      `json:"code,omitempty"`
	ManifestFile string      `json:"manifest_file"`
	Analyzer     Analyzer    `json:"analyzer,omitempty"`
	Run          *RunBinding `json:"run,omitempty"`
	Outputs      []FileRef   `json:"outputs,omitempty"`
}

Jump to

Keyboard shortcuts

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