Improve D&D registry caching and retire the completed roadmap
This commit is contained in:
@@ -101,20 +101,8 @@ func TestNormalizerContractsRequiredRegistryAndWarningBounds(t *testing.T) {
|
||||
if spec.Key != Key || spec.Stage != pipeline.StageNormalize || spec.ExecutionClass != contracts.ExecutionClassDeterministic || spec.ArtifactKind != dnd.LocationOccurrenceListKind {
|
||||
t.Fatalf("ModuleSpec() = %#v", spec)
|
||||
}
|
||||
wantSlots := []contracts.ReferenceSlot{{
|
||||
Name: LocationRegistryReferenceSlot,
|
||||
Description: "Required normalized location registry used only for location identity grounding, never as occurrence evidence.",
|
||||
Required: true,
|
||||
AcceptedMediaTypes: []string{"application/json"},
|
||||
AcceptedArtifactKinds: []contracts.ArtifactKind{dnd.LocationListKind},
|
||||
MaxBytes: LocationRegistryMaxBytes,
|
||||
}}
|
||||
if !reflect.DeepEqual(spec.ReferenceSlots, wantSlots) {
|
||||
t.Fatalf("ModuleSpec().ReferenceSlots = %#v, want %#v", spec.ReferenceSlots, wantSlots)
|
||||
}
|
||||
if got := normalizer.ReferenceSlots(); !reflect.DeepEqual(got, wantSlots) {
|
||||
t.Fatalf("ReferenceSlots() = %#v, want %#v", got, wantSlots)
|
||||
}
|
||||
assertLocationRegistryReferenceSlots(t, "ModuleSpec", spec.ReferenceSlots)
|
||||
assertLocationRegistryReferenceSlots(t, "Normalizer", normalizer.ReferenceSlots())
|
||||
registry := pipeline.NewNormalizerRegistry()
|
||||
if err := Register(registry); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -123,9 +111,7 @@ func TestNormalizerContractsRequiredRegistryAndWarningBounds(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatalf("registry missing %q", Key)
|
||||
}
|
||||
if !reflect.DeepEqual(registeredSpec.ReferenceSlots, wantSlots) {
|
||||
t.Fatalf("registered reference slots = %#v, want %#v", registeredSpec.ReferenceSlots, wantSlots)
|
||||
}
|
||||
assertLocationRegistryReferenceSlots(t, "registered ModuleSpec", registeredSpec.ReferenceSlots)
|
||||
if _, err := DecodeOptions(map[string]any{"unexpected": true}); err == nil {
|
||||
t.Fatal("DecodeOptions() accepted unknown options")
|
||||
}
|
||||
@@ -153,6 +139,26 @@ func TestNormalizerContractsRequiredRegistryAndWarningBounds(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func assertLocationRegistryReferenceSlots(t *testing.T, owner string, slots []contracts.ReferenceSlot) {
|
||||
t.Helper()
|
||||
if len(slots) != 1 {
|
||||
t.Fatalf("%s reference slots = %#v, want one location registry", owner, slots)
|
||||
}
|
||||
got := slots[0]
|
||||
description := got.Description
|
||||
got.Description = ""
|
||||
want := contracts.ReferenceSlot{
|
||||
Name: LocationRegistryReferenceSlot,
|
||||
Required: true,
|
||||
AcceptedMediaTypes: []string{"application/json"},
|
||||
AcceptedArtifactKinds: []contracts.ArtifactKind{dnd.LocationListKind},
|
||||
MaxBytes: LocationRegistryMaxBytes,
|
||||
}
|
||||
if !reflect.DeepEqual(got, want) || strings.TrimSpace(description) == "" {
|
||||
t.Fatalf("%s location registry slot = %#v, want contract %#v with a nonempty description", owner, slots[0], want)
|
||||
}
|
||||
}
|
||||
|
||||
func newNormalizer(t *testing.T, references ...contracts.ReferenceSet) *Normalizer {
|
||||
t.Helper()
|
||||
normalizer, err := New(Options{}, references...)
|
||||
|
||||
Reference in New Issue
Block a user