Make production registration asset-free and verify direct deterministic execution

This commit is contained in:
2026-11-22 01:35:23 +00:00
parent 433ed420f8
commit b47208bd57
18 changed files with 231 additions and 250 deletions

View File

@@ -0,0 +1,33 @@
package noop
import (
"context"
"errors"
"reflect"
"testing"
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
)
func TestTypedNormalizerReturnsIncomingValueForRunnerAssessment(t *testing.T) {
value := []string{"second", "first", "first"}
request := contracts.TypedNormalizeRequest[[]string]{
MergeOutput: contracts.MergeArtifact[[]string]{Value: value},
Operation: contracts.ProducerOperation[[]string]{
Controls: contracts.ProducerControls{Mode: contracts.ModePermissive, MaxAdditionalTurns: 3},
Assess: func(context.Context, []string) (contracts.CandidateAssessment, error) {
t.Fatal("deterministic normalizer invoked the runner's assessor")
return contracts.CandidateAssessment{}, nil
},
},
}
result, err := NewTyped[[]string]().Normalize(context.Background(), request)
if err != nil || !reflect.DeepEqual(result.Value, value) || result.Outcome.Disposition != "" || result.Fallback != nil {
t.Fatalf("Normalize() = %#v, %v; want unchanged value for direct runner assessment", result, err)
}
ctx, cancel := context.WithCancel(context.Background())
cancel()
if _, err := NewTyped[[]string]().Normalize(ctx, request); !errors.Is(err, context.Canceled) {
t.Fatalf("Normalize() after cancellation = %v", err)
}
}