feat: add command domain invariants

This commit is contained in:
2026-08-31 08:09:28 +00:00
parent e23737de0d
commit 49627a9f5a
14 changed files with 869 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
package domain
import "testing"
func TestImmutableRequestReplay_HP_IDEM_02(t *testing.T) {
t.Parallel()
first := HashImmutableRequest([]byte("method\x00target\x00payload"))
same := HashImmutableRequest([]byte("method\x00target\x00payload"))
other := HashImmutableRequest([]byte("method\x00other\x00payload"))
if got := ClassifyReplay(nil, first); got != ReplayNew {
t.Fatalf("new replay decision = %v", got)
}
if got := ClassifyReplay(&first, same); got != ReplayExact {
t.Fatalf("exact replay decision = %v", got)
}
if got := ClassifyReplay(&first, other); got != ReplayConflict {
t.Fatalf("conflicting replay decision = %v", got)
}
}