Add semantic configuration resume evidence

This commit is contained in:
2026-08-30 12:44:26 +00:00
parent b97b12da7f
commit 82cb53e107
13 changed files with 761 additions and 37 deletions

View File

@@ -0,0 +1,32 @@
package manifest
import (
"fmt"
"regexp"
)
var lowercaseSHA256Pattern = regexp.MustCompile(`^[0-9a-f]{64}$`)
// SemanticConfigFingerprint identifies the versioned, result-affecting
// configuration observed by one pipeline stage.
type SemanticConfigFingerprint struct {
Version int `json:"version"`
Digest string `json:"digest"`
}
// Validate checks the durable fingerprint contract.
func (f SemanticConfigFingerprint) Validate() error {
if f.Version <= 0 {
return fmt.Errorf("version must be positive")
}
if !lowercaseSHA256Pattern.MatchString(f.Digest) {
return fmt.Errorf("digest must be a lowercase SHA-256 value")
}
return nil
}
// Equal reports whether two valid fingerprint records identify the same
// semantic configuration contract and payload.
func (f SemanticConfigFingerprint) Equal(other SemanticConfigFingerprint) bool {
return f.Version == other.Version && f.Digest == other.Digest
}