Adopt location registry durable contract

This commit is contained in:
2026-08-05 19:05:42 +00:00
parent 2f61118e78
commit c006b163d5
41 changed files with 196 additions and 196 deletions

View File

@@ -16,7 +16,7 @@ import (
func TestValidatorAllowsSameNameAtDistinctEvidence(t *testing.T) {
refs := []source.SourceRef{{SourceID: "session", StartUnitID: 1, EndUnitID: 1}}
otherRefs := []source.SourceRef{{SourceID: "session", StartUnitID: 2, EndUnitID: 2}}
value := dnd.LocationList{Locations: []dnd.Location{
value := dnd.LocationRegistry{Locations: []dnd.Location{
{ID: domainidentity.DeriveID("Watchtower", refs), Name: "Watchtower", SourceRefs: refs},
{ID: domainidentity.DeriveID("Watchtower", otherRefs), Name: "Watchtower", SourceRefs: otherRefs},
}}
@@ -28,12 +28,12 @@ func TestValidatorAllowsSameNameAtDistinctEvidence(t *testing.T) {
}
func TestValidatorDefersShapeAndRejectsDerivationAndDuplicateID(t *testing.T) {
result, err := New(Options{}).Validate(context.Background(), request(dnd.LocationList{Locations: []dnd.Location{{Name: "Missing"}}}))
result, err := New(Options{}).Validate(context.Background(), request(dnd.LocationRegistry{Locations: []dnd.Location{{Name: "Missing"}}}))
if err != nil || !result.Approved {
t.Fatalf("shape-invalid result = %#v, %v; want deferral", result, err)
}
refs := []source.SourceRef{{SourceID: "session", StartUnitID: 1, EndUnitID: 1}}
value := dnd.LocationList{Locations: []dnd.Location{
value := dnd.LocationRegistry{Locations: []dnd.Location{
{ID: "not-an-id", Name: "Gate", SourceRefs: refs},
{ID: domainidentity.DeriveID("Gate", refs), Name: "Other Gate", SourceRefs: refs},
{ID: domainidentity.DeriveID("Gate", refs), Name: "Gate", SourceRefs: refs},
@@ -65,6 +65,6 @@ func TestValidatorRegistersIdentityPolicy(t *testing.T) {
}
}
func request(value dnd.LocationList) contracts.TypedValidationRequest[dnd.LocationList] {
return contracts.TypedValidationRequest[dnd.LocationList]{Value: value}
func request(value dnd.LocationRegistry) contracts.TypedValidationRequest[dnd.LocationRegistry] {
return contracts.TypedValidationRequest[dnd.LocationRegistry]{Value: value}
}