Documentation
¶
Overview ¶
Package lock reads and writes .fullsend/lock.yaml files that pin all resolved remote dependencies (URLs and integrity hashes) for reproducible harness execution. A lock file is produced by `fullsend lock <harness>` and consumed by the resolver to skip re-resolution when dependencies have not changed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Save ¶
Save writes the lock file to path atomically (write to temp, then rename). Parent directories are created as needed. The file is written with 0o644 permissions (world-readable) because lock files are meant to be committed to version control, unlike cache files which use 0o600.
Save mutates lf.Version to currentVersion when it is zero.
Types ¶
type DependencyEntry ¶
type DependencyEntry struct {
Field string `yaml:"field"`
URL string `yaml:"url"`
SHA256 string `yaml:"sha256"`
Type string `yaml:"type,omitempty"` // "file" or "directory"; empty treated as "file"
Files []FileEntry `yaml:"files,omitempty"` // manifest of files (directory deps only)
FetchedAt time.Time `yaml:"fetched_at"`
TransitiveDeps []DependencyEntry `yaml:"transitive_deps,omitempty"`
}
DependencyEntry records a single resolved remote resource.
type HarnessLock ¶
type HarnessLock struct {
Source string `yaml:"source"`
SHA256 string `yaml:"sha256"`
ResolvedAt time.Time `yaml:"resolved_at"`
Dependencies []DependencyEntry `yaml:"dependencies"`
}
HarnessLock records resolved dependencies for one harness.
func (*HarnessLock) IsStale ¶
func (hl *HarnessLock) IsStale(sourceHash string) bool
IsStale returns true if the harness has changed since the lock entry was generated. It compares sourceHash against the stored hash. sourceHash is the SHA256 of the current harness file content, or, for an agent whose agents: entry carries harness: blocks, of that content followed by the blocks (ADR 0162). Returns true for a nil receiver.
func (*HarnessLock) LookupDep ¶
func (hl *HarnessLock) LookupDep(url string) *DependencyEntry
LookupDep searches the dependency list (including transitive deps, depth-first) for the given URL and returns the matching entry or nil. The returned pointer references the live slice — mutations update the underlying Dependencies. Returns nil for a nil receiver.
type LockFile ¶
type LockFile struct {
Version int `yaml:"version"`
GeneratedAt time.Time `yaml:"generated_at"`
Harnesses map[string]HarnessLock `yaml:"harnesses"`
}
LockFile is the top-level structure of .fullsend/lock.yaml.
func Load ¶
Load reads a lock file from path. Returns nil (no error) if the file does not exist. Parse failures return *ParseError. A version other than currentVersion returns *UnsupportedVersionError. Callers that would rewrite the file must abort on any error so an unreadable lock is not replaced.
func (*LockFile) HarnessNames ¶
HarnessNames returns the sorted list of harness names in the lock file.
func (*LockFile) Lookup ¶
func (lf *LockFile) Lookup(harnessName string) *HarnessLock
Lookup returns the HarnessLock entry for the named harness, or nil if not found. Returns nil for a nil receiver. The returned pointer is a snapshot — mutations do not update the LockFile map. Use SetHarness to modify entries.
func (*LockFile) SetHarness ¶
func (lf *LockFile) SetHarness(name string, hl HarnessLock)
SetHarness adds or replaces the lock entry for the named harness. Intended for use by the lock file generator (fullsend lock); callers should use Save to persist changes. No-op on a nil receiver.
type ParseError ¶ added in v0.53.0
type ParseError struct {
Err error
}
ParseError is returned by Load when path exists but is not valid YAML.
func (*ParseError) Error ¶ added in v0.53.0
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶ added in v0.53.0
func (e *ParseError) Unwrap() error
type UnsupportedVersionError ¶ added in v0.53.0
UnsupportedVersionError is returned by Load when path declares a lock format version this binary does not understand.
func (*UnsupportedVersionError) Error ¶ added in v0.53.0
func (e *UnsupportedVersionError) Error() string