ingestion

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package ingestion defines snapshot contracts, pure identity rules and HTTP clients. It contains no collector filesystem or server persistence behavior.

Index

Constants

View Source
const MaxRequestBytes = 64 << 20
View Source
const ProtocolVersion = 4

Variables

This section is empty.

Functions

func ComparisonPolicy

func ComparisonPolicy(metadata Metadata) string

ComparisonPolicy identifies a stream independently of resolved commit tips.

func ContentIdentity

func ContentIdentity(request Request) (string, error)

ContentIdentity preserves the established observation identity algorithm. Unknown full content identities remain independent unless all scopes are empty.

func Validate

func Validate(input Request) error

Types

type AgentSession

type AgentSession struct {
	Harness string `json:"harness"`
	ID      string `json:"id"`
	Name    string `json:"name,omitempty"`
}

AgentSession identifies the session observing a capture, never its authorship.

type Client

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

func NewClient

func NewClient(endpoint, token string) *Client

func (*Client) Health

func (client *Client) Health(ctx context.Context) (Health, error)

Health probes authentication, database reads and ingestion compatibility.

func (*Client) ObservationCurrent

func (client *Client) ObservationCurrent(ctx context.Context, id string) (bool, error)

ObservationCurrent checks the durable stream head before suppressing a sync. Another collector can supersede an acknowledged observation in this checkout.

func (*Client) SyncTo

func (client *Client) SyncTo(ctx context.Context, input Request, stateID string, progress func(Job)) (Receipt, error)

SyncTo distinguishes durable acceptance from committed publication. Cancelling this wait does not cancel a job already accepted by the server.

type Comparison

type Comparison struct {
	Kind       string `json:"kind"`
	BaseRef    string `json:"baseRef"`
	BaseCommit string `json:"baseCommit,omitempty"`
	MergeBase  string `json:"mergeBase,omitempty"`
}

Comparison records the interpretation and resolved Git baseline of a capture. Kind is working-tree or branch; absent comparisons retain legacy HEAD semantics.

type Filter

type Filter struct {
	Query       string
	Repository  string
	Branch      string
	Worktree    string
	Hostname    string
	SourceID    string
	RunID       string
	Harness     string
	SessionID   string
	SessionName string
}

type Health

type Health struct {
	IngestionEnabled bool   `json:"ingestionEnabled"`
	QueuedIngestion  bool   `json:"queuedIngestion"`
	StateID          string `json:"stateId"`
	ProtocolVersion  int    `json:"protocolVersion"`
}

Health identifies the durable destination, including replacement databases.

type Job

type Job struct {
	ID           string `json:"id"`
	SubmissionID string `json:"submissionId"`
	State        string `json:"state"`
	Attempt      int    `json:"attempt"`
	ContextID    string `json:"contextId,omitempty"`
	Detail       string `json:"detail,omitempty"`
}

type Metadata

type Metadata struct {
	SourceID         string        `json:"sourceId"`
	Hostname         string        `json:"hostname"`
	RunID            string        `json:"runId"`
	Agent            string        `json:"agent"`
	Trigger          string        `json:"trigger"`
	RepositoryKey    string        `json:"repositoryKey"`
	RepositoryName   string        `json:"repositoryName"`
	RemoteURL        string        `json:"remoteUrl"`
	CheckoutKey      string        `json:"checkoutKey"`
	Root             string        `json:"root"`
	WorktreeName     string        `json:"worktreeName"`
	LinkedWorktree   *bool         `json:"linkedWorktree,omitempty"`
	Branch           string        `json:"branch"`
	BranchID         string        `json:"branchId,omitempty"`
	Head             *string       `json:"head"`
	CollectedAt      int64         `json:"collectedAt"`
	CollectorVersion string        `json:"collectorVersion"`
	Comparison       *Comparison   `json:"comparison,omitempty"`
	AgentSession     *AgentSession `json:"agentSession,omitempty"`
	TriggerRoot      string        `json:"triggerRoot,omitempty"`
}

Metadata records facts at collection time. Paths and hostnames are labels, not globally unique identities. Account identity comes from the server.

type Problem

type Problem struct {
	Status int    `json:"status"`
	Detail string `json:"detail"`
}

func (*Problem) Error

func (problem *Problem) Error() string

type Receipt

type Receipt struct {
	ContextID string `json:"contextId"`
	ReviewURL string `json:"reviewUrl"`
	MCPURL    string `json:"mcpUrl"`
}

type Request

type Request struct {
	ProtocolVersion int      `json:"protocolVersion"`
	SubmissionID    string   `json:"submissionId"`
	ContentHash     string   `json:"contentHash,omitempty"`
	Metadata        Metadata `json:"metadata"`
	Scopes          []Scope  `json:"scopes"`
}

Request is one immutable observation. Replays retain the submission ID; fresh observations may reuse an existing review when ContentHash matches.

type Scope

type Scope struct {
	Snapshot review.RepositoryDiff       `json:"snapshot"`
	Patches  map[string]review.FilePatch `json:"patches"`
}

Jump to

Keyboard shortcuts

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