Remove retired runtime wrappers and persistent cache machinery
This commit is contained in:
@@ -38,8 +38,6 @@ var requiredCapabilities = []string{"merged"}
|
||||
var providedCapabilities = []string{"normalized"}
|
||||
|
||||
var _ contracts.Normalizer[dnd.CombatTurnList] = (*Normalizer)(nil)
|
||||
var _ contracts.ManifestMetadataProvider = (*Normalizer)(nil)
|
||||
var _ pipeline.CheckpointFingerprintProvider = (*Normalizer)(nil)
|
||||
|
||||
type Options struct{}
|
||||
|
||||
@@ -66,35 +64,6 @@ func (n *Normalizer) Key() string { return Key }
|
||||
|
||||
func (n *Normalizer) ReferenceSlots() []contracts.ReferenceSlot { return referenceSlots() }
|
||||
|
||||
func (n *Normalizer) ManifestMetadata() map[string]any {
|
||||
if n == nil {
|
||||
return nil
|
||||
}
|
||||
metadata := map[string]any{
|
||||
"normalization_policy": normalizationPolicy,
|
||||
"identity_policy": identity.Policy,
|
||||
}
|
||||
seeded := n.npcResolver.Seeded()
|
||||
if seeded.Bound() {
|
||||
metadata["npc_registry_digest"] = seeded.Digest()
|
||||
metadata["npc_count"] = seeded.Count()
|
||||
}
|
||||
return metadata
|
||||
}
|
||||
|
||||
func (n *Normalizer) CheckpointFingerprints() []pipeline.CheckpointFingerprint {
|
||||
if n == nil {
|
||||
return nil
|
||||
}
|
||||
fingerprints := []pipeline.CheckpointFingerprint{
|
||||
{Name: "normalization_policy", Value: normalizationPolicy},
|
||||
{Name: "identity_policy", Value: identity.Policy},
|
||||
}
|
||||
seeded := n.npcResolver.Seeded()
|
||||
fingerprints = append(fingerprints, pipeline.CheckpointFingerprint{Name: "npc_registry", Value: seeded.ProjectionDigest()})
|
||||
return fingerprints
|
||||
}
|
||||
|
||||
func (n *Normalizer) Normalize(ctx context.Context, req contracts.TypedNormalizeRequest[dnd.CombatTurnList]) (contracts.TypedNormalizeResult[dnd.CombatTurnList], error) {
|
||||
if n == nil {
|
||||
return contracts.TypedNormalizeResult[dnd.CombatTurnList]{}, normalizerErrorf("normalizer must not be nil")
|
||||
|
||||
@@ -109,9 +109,6 @@ func TestNormalizeResolvesOperationNPCOverrideWithoutSingletonMetadata(t *testin
|
||||
if turn.Actor != "Aria" {
|
||||
t.Fatalf("operation-normalized turn = %#v, want Aria", turn)
|
||||
}
|
||||
if metadata := normalizer.ManifestMetadata(); metadata["npc_registry_digest"] != nil || metadata["npc_count"] != nil {
|
||||
t.Fatalf("singleton metadata = %#v, want no operation-varying NPC identity", metadata)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeOrdersBySourcePositionAndCollapsesExactDuplicates(t *testing.T) {
|
||||
@@ -250,29 +247,16 @@ func TestNormalizePreservesNilAndPresentEmptyStorage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizerPreparationMetadataFingerprintsAndModuleContract(t *testing.T) {
|
||||
unbound, err := New(Options{})
|
||||
func TestNormalizerPreparationAndModuleContract(t *testing.T) {
|
||||
_, err := New(Options{})
|
||||
if err != nil {
|
||||
t.Fatalf("New() error = %v", err)
|
||||
}
|
||||
if metadata := unbound.ManifestMetadata(); metadata["npc_registry_digest"] != nil || metadata["npc_count"] != nil || metadata["normalization_policy"] != normalizationPolicy || metadata["identity_policy"] != identity.Policy {
|
||||
t.Fatalf("unbound metadata = %#v", metadata)
|
||||
}
|
||||
if got := unbound.CheckpointFingerprints(); len(got) != 3 || got[0].Name != "normalization_policy" || got[1].Name != "identity_policy" || got[2].Name != "npc_registry" || got[2].Value == "" {
|
||||
t.Fatalf("unbound fingerprints = %#v", got)
|
||||
}
|
||||
|
||||
bound, err := New(Options{}, npcReferences(t))
|
||||
_, err = New(Options{}, npcReferences(t))
|
||||
if err != nil {
|
||||
t.Fatalf("bound New() error = %v", err)
|
||||
}
|
||||
metadata := bound.ManifestMetadata()
|
||||
if metadata["npc_registry_digest"] == "" || metadata["npc_count"] != 2 {
|
||||
t.Fatalf("bound metadata = %#v", metadata)
|
||||
}
|
||||
if got := bound.CheckpointFingerprints(); len(got) != 3 || got[2].Name != "npc_registry" || got[2].Value == "" {
|
||||
t.Fatalf("bound fingerprints = %#v", got)
|
||||
}
|
||||
if spec := ModuleSpec(); spec.Key != Key || spec.Stage != pipeline.StageNormalize || spec.ArtifactKind != dnd.CombatTurnListKind || !reflect.DeepEqual(spec.Requires, []string{"merged"}) || !reflect.DeepEqual(spec.Provides, []string{"normalized"}) || len(spec.ReferenceSlots) != 1 || spec.ReferenceSlots[0].Name != NPCRegistryReferenceSlot {
|
||||
t.Fatalf("ModuleSpec() = %#v", spec)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user