Documentation
¶
Overview ¶
Package ingestion defines snapshot contracts, pure identity rules and HTTP clients. It contains no collector filesystem or server persistence behavior.
Index ¶
- Constants
- func BranchIdentity(metadata Metadata) string
- func ComparisonPolicy(metadata Metadata) string
- func ContentIdentity(request Request) (string, error)
- func LegacyComparisonKind(mode review.DiffMode, source string, metadata Metadata, ...) review.ComparisonKind
- func Payload(request Request) ([]byte, string, error)
- func StreamID(sourceID, repositoryKey, checkoutKey, branch, comparisonPolicy string) string
- func StreamKey(contextID string, metadata Metadata) string
- func Validate(input Request) error
- type AgentSession
- type Checkout
- type Client
- type Commit
- type Comparison
- type Filter
- type Health
- type Job
- type Metadata
- type Problem
- type PullRequest
- type PullRequestAuthor
- type Receipt
- type Request
- type Scope
- type Selection
Constants ¶
const ( GitHubSourceID = "github" GitHubTrigger = "github" )
Server-authored producer markers; public ingestion rejects both.
const MaxRequestBytes = 64 << 20
const ProtocolVersion = 4
Variables ¶
This section is empty.
Functions ¶
func BranchIdentity ¶ added in v0.2.2
BranchIdentity is the stable branch of a stream: a producer's branch ID survives renames; otherwise the branch label identifies it.
func ComparisonPolicy ¶
ComparisonPolicy identifies a stream independently of resolved commit tips.
func ContentIdentity ¶
ContentIdentity preserves the established observation identity algorithm. Unknown full content identities remain independent unless all scopes are empty.
func LegacyComparisonKind ¶ added in v0.2.1
func LegacyComparisonKind(mode review.DiffMode, source string, metadata Metadata, scopes []review.DiffMode) review.ComparisonKind
LegacyComparisonKind interprets captured scopes without modifying their stored manifests or request identities. Explicit manifest kinds take precedence at reads.
func Payload ¶ added in v0.2.2
Payload is a request's stored representation and its replay hash. A replay under the same submission identity must hash identically.
func StreamID ¶ added in v0.2.2
StreamID names one stream head without exposing its keys or depending on row identity.
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 (*Client) ObservationCurrent ¶
ObservationCurrent checks the durable stream head before suppressing a sync. Another collector can supersede an acknowledged observation in this checkout.
type Commit ¶ added in v0.2.2
type Commit struct {
review.Commit
Snapshot *review.RepositoryDiff `json:"snapshot,omitempty"`
Patches map[string]review.FilePatch `json:"patches,omitempty"`
}
Commit is one captured branch commit with its diff against its first parent. Merge commits carry no snapshot or patches.
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
// Latest omits stale snapshots: each stream's head plus stream-less
// observations such as piped diffs.
Latest bool
// Selection is composition policy, never parsed from requests.
Selection Selection
}
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 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"`
ActivityAt int64 `json:"activityAt,omitempty"`
CollectorVersion string `json:"collectorVersion"`
Comparison *Comparison `json:"comparison,omitempty"`
AgentSession *AgentSession `json:"agentSession,omitempty"`
TriggerRoot string `json:"triggerRoot,omitempty"`
PullRequest *PullRequest `json:"pullRequest,omitempty"`
}
Metadata records facts at collection time. Paths and hostnames are labels, not globally unique identities. Account identity comes from the server.
type PullRequest ¶ added in v0.2.1
type PullRequest struct {
Provider string `json:"provider"`
RepositoryID int64 `json:"repositoryId"`
FullName string `json:"fullName"`
Number int `json:"number"`
URL string `json:"url"`
Title string `json:"title"`
Body string `json:"body"`
State string `json:"state"`
Draft bool `json:"draft"`
Author PullRequestAuthor `json:"author"`
BaseRef string `json:"baseRef"`
HeadRef string `json:"headRef"`
HeadRepository string `json:"headRepository"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
PullRequest describes the hosted pull request a capture reviews. Only the server's GitHub integration authors it; public ingestion rejects it.
type PullRequestAuthor ¶ added in v0.2.1
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"`
Commits []Commit `json:"commits,omitempty"`
CommitsTotal int `json:"commitsTotal,omitempty"`
}
Request is one immutable observation. Replays retain the submission ID; fresh observations may reuse an existing review when ContentHash matches. Commits are optional protocol 4 metadata of branch comparisons, oldest first; CommitsTotal also counts commits beyond review.MaxCommits.
type Scope ¶
type Scope struct {
Snapshot review.RepositoryDiff `json:"snapshot"`
Patches map[string]review.FilePatch `json:"patches"`
}
type Selection ¶ added in v0.2.1
type Selection struct {
Scoped bool
SourceID string
Checkouts []Checkout
SubmissionID string
ContextID string
}
Selection restricts the catalog to the composition's selected checkouts or capture submission, optionally one context. An unscoped selection restricts only by ContextID; a scoped one without checkouts or submission matches nothing.