Forge.Manifest.Hash (Forge v0.1.1)

View Source

Deterministic hashing for pipeline configurations.

Provides stable hashing for drift detection and reproducibility. Uses sorted keys and deterministic serialization to ensure identical configs always produce identical hashes.

Summary

Functions

Compute deterministic hash of config (sorted keys, stable JSON).

Hash secrets by name only (never values).

Functions

config_hash(config)

Compute deterministic hash of config (sorted keys, stable JSON).

Examples

iex> config = %{model: "gpt-4", temperature: 0.7}
iex> hash1 = Forge.Manifest.Hash.config_hash(config)
iex> hash2 = Forge.Manifest.Hash.config_hash(config)
iex> hash1 == hash2
true

iex> config1 = %{a: 1, b: 2}
iex> config2 = %{b: 2, a: 1}  # Different key order
iex> Forge.Manifest.Hash.config_hash(config1) == Forge.Manifest.Hash.config_hash(config2)
true

secrets_hash(secret_names)

Hash secrets by name only (never values).

Examples

iex> Forge.Manifest.Hash.secrets_hash(["api_key", "db_password"])
"abc123..."

iex> Forge.Manifest.Hash.secrets_hash([])
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"  # empty hash