feat: add --seed flag for deterministic manifest UUID
Adds a --seed CLI flag to 'generate' that derives a deterministic UUID from the seed value by hashing it 1,000,000,000 times with SHA-256. This makes manifest generation fully reproducible when the same seed and input files are provided. - Builder.SetSeed(seed) method for programmatic use - deriveSeedUUID() extracted for testability - MFER_SEED env var also supported - Test with reduced iteration count for speed
This commit is contained in:
@@ -150,6 +150,17 @@ func TestBuilderDeterministicOutput(t *testing.T) {
|
||||
assert.Equal(t, out1, out2, "two builds with same input should produce byte-identical output")
|
||||
}
|
||||
|
||||
func TestDeriveSeedUUID(t *testing.T) {
|
||||
// Use a small iteration count for testing (production uses 1B)
|
||||
uuid1 := deriveSeedUUID("test-seed-value", 1000)
|
||||
uuid2 := deriveSeedUUID("test-seed-value", 1000)
|
||||
assert.Equal(t, uuid1, uuid2, "same seed should produce same UUID")
|
||||
assert.Len(t, uuid1, 16, "UUID should be 16 bytes")
|
||||
|
||||
uuid3 := deriveSeedUUID("different-seed", 1000)
|
||||
assert.NotEqual(t, uuid1, uuid3, "different seeds should produce different UUIDs")
|
||||
}
|
||||
|
||||
func TestBuilderBuildEmpty(t *testing.T) {
|
||||
b := NewBuilder()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user