feat(assessment): assign the demonstration category and keep result history

This commit is contained in:
shira committed 2026-10-09 00:35:13 +03:00
1 parent b3c6dc870b
commit 8277133712
61 files changed
+4338 -268

No files matched your search

@@ -3,6 +3,7 @@ package identity
import (
"bytes"
"crypto/sha256"
"strings"
"testing"
"github.com/google/uuid"
@@ -123,3 +124,22 @@ func TestAssessmentSessionAndNetworkDigestsAreBoundToTheAttempt(t *testing.T) {
t.Fatal("session and network digests share a key")
}
}
func TestResultHistoryCursorKeyIsSeparateFromIdempotencyAndBoundToTheCandidate(t *testing.T) {
keyring, err := NewKeyring([]byte(strings.Repeat("k", MinKeySecretBytes)))
if err != nil {
t.Fatalf("NewKeyring() error = %v", err)
}
signature := keyring.ResultHistoryCursorSignature("position", "candidate-a")
if signature != keyring.ResultHistoryCursorSignature("position", "candidate-a") {
t.Fatal("the cursor signature is not deterministic")
}
if signature == keyring.ResultHistoryCursorSignature("position", "candidate-b") ||
signature == keyring.ResultHistoryCursorSignature("other", "candidate-a") {
t.Fatal("the cursor signature does not depend on the position and the candidate")
}
if signature == keyring.IdempotencyScope("position", "", "candidate-a") ||
signature == keyring.IdempotencyScope("assessment.result-history.cursor.v1", "position", "candidate-a") {
t.Fatal("the cursor signature shares a key with the idempotency scope")
}
}