dag_impl

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadOutput

func ReadOutput[T executiondag.Persistable](ctx context.Context, input Input) (T, error)

func ReadYAML

func ReadYAML(path string, target any) error

ReadYAML reads and unmarshals YAML data from a file at the specified path.

func ValidateFetchFlags

func ValidateFetchFlags(noFetch, writeFetchOnly bool) error

ValidateFetchFlags rejects combinations of --no-fetch and --write-fetch-only that don't make sense together.

Types

type BaseOutput

type BaseOutput struct {
	executiondag.BaseOutput `json:",inline"`

	Input  Input  `json:"-"`
	Output *Input `json:"output,omitempty"`
}

BaseOutput provides common fields and methods for all dag-impl outputs. It embeds executiondag.BaseOutput for status management and implements MergeableOutput for Input.Merge() operations.

All dag-impl outputs should embed this type.

func NewBaseOutput

func NewBaseOutput(status executiondag.Status, statusReason string, input Input) BaseOutput

func (*BaseOutput) GetInput

func (b *BaseOutput) GetInput() *Input

func (*BaseOutput) GetOutput

func (b *BaseOutput) GetOutput() *Input

type Input

type Input struct {
	AnalysisIdentifier string               `json:"analysis_identifier"`
	SourceURL          *string              `json:"source_url,omitempty"`
	Commit             *string              `json:"commit,omitempty"`
	Version            *string              `json:"version,omitempty"`
	Packages           []models.PackageInfo `json:"packages,omitempty"`
	Trusted            bool                 `json:"trusted,omitempty"`
	OverridesHash      string               `json:"overrides_hash,omitempty"`

	// Per-run runtime flags. Kept out of JSON so they don't pollute the
	// analysis identity / cache key.
	NoFetch        bool `json:"-"`
	WriteFetchOnly bool `json:"-"`
}

func NewPackageInputWithVersion

func NewPackageInputWithVersion(ecosystem, name string, version *string, overridesHash string) Input

func NewSourceInputWithCommit

func NewSourceInputWithCommit(sourceURL string, commit *string, trusted bool) Input

NewSourceInputWithCommit creates a source input with optional commit and trust flag. The trusted flag affects AnalysisIdentifier (cache key) because trusted analyses apply .riskguardignore patterns which delete files, producing different results.

func NewSourceInputWithOverrides

func NewSourceInputWithOverrides(sourceURL string, commit *string, trusted bool, overridesHash string) Input

func (*Input) BasePath

func (i *Input) BasePath() string

BasePath returns a filesystem-safe path derived from AnalysisIdentifier. The query-string portion (?version=..., &overrides=..., &trusted=...) is preserved as part of the path so distinct work items get distinct dirs; otherwise concurrent audits of the same package at different versions race on a single destDir and corrupt each other's clones.

func (Input) GetNoFetch

func (i Input) GetNoFetch() bool

GetNoFetch satisfies executiondag.NoFetchProvider so the generic executor can honor --no-fetch without depending on this package.

func (*Input) HasSourceKey

func (i *Input) HasSourceKey() bool

func (*Input) HasSourceURL

func (i *Input) HasSourceURL() bool

func (*Input) Merge

func (i *Input) Merge(output executiondag.StatusProvider)

Merge implements the Mergeable interface. This merges node outputs back into the input for downstream nodes. Only merges if the node set an Output field (indicating it wants to modify input for downstream). - AnalysisIdentifier: Immutable, never merged - SourceURL: Can be set from nil/empty, but cannot be changed once set to a non-empty value - Packages: Accumulated from all nodes

func (*Input) MustHaveSourceURL

func (i *Input) MustHaveSourceURL() string

MustHaveSourceURL returns the SourceURL or panics if it's nil/empty. This should only be called from nodes that have a hard dependency on nodes that provide SourceURL (like git_clone). If this panics, it indicates a bug in the DAG framework's dependency resolution.

type MergeableOutput

type MergeableOutput interface {
	GetInput() *Input
	GetOutput() *Input
}

MergeableOutput is an interface that dag-impl outputs can implement to provide data that should be merged back into the Input.

Jump to

Keyboard shortcuts

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