fsdelta

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Overview

Package fsdelta computes the content-based difference of a directory tree between two points in time: which regular files were created, modified, or deleted. It backs the `changes:` assertion target (#70), which pins exactly what a run/pty step touched in the scenario workdir.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

type Delta struct {
	Created  []string
	Modified []string
	Deleted  []string
}

Delta is the content-based difference between a pre and post Snapshot. Each list is sorted for deterministic reporting.

func Diff

func Diff(pre, post Snapshot) Delta

Diff compares pre against post: a path in post but not pre is Created, a path in both whose hash changed is Modified, and a path in pre but not post is Deleted. Paths whose hash is unchanged are untouched and reported nowhere.

type Snapshot

type Snapshot map[string]string

Snapshot maps a regular file's forward-slash path (relative to the scanned root) to a hex-encoded SHA-256 of its content. Directories and symlinks are not tracked: a rename is delete+create in v1, and an empty directory is not a "file" the assertion reasons about.

func Scan

func Scan(root string) (Snapshot, error)

Scan walks root and hashes every regular file, keyed by its forward-slash path relative to root. It is best-effort about individual files: one that cannot be opened or read is skipped rather than failing the whole scan, so a transient permission quirk never turns a delta assertion into an engine error. A nil root scan (root missing) returns an empty snapshot.

Jump to

Keyboard shortcuts

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