Adopt location registry durable contract
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
const (
|
||||
// IdentityPolicy identifies the durable location ID derivation policy.
|
||||
IdentityPolicy = "dnd.locations.identity.v1"
|
||||
IdentityPolicy = "dnd.location_registry.identity.v1"
|
||||
// Policy is an alias for IdentityPolicy.
|
||||
Policy = IdentityPolicy
|
||||
|
||||
@@ -109,7 +109,7 @@ func IsValidID(value string) bool {
|
||||
func ValidID(value string) bool { return IsValidID(value) }
|
||||
|
||||
// ValidateList validates the identity members of list.
|
||||
func ValidateList(list dnd.LocationList) []Issue { return ValidateRegistry(list.Locations) }
|
||||
func ValidateList(list dnd.LocationRegistry) []Issue { return ValidateRegistry(list.Locations) }
|
||||
|
||||
// ValidateRegistry validates location IDs without modifying records or their
|
||||
// source references. Equal comparison names are allowed because their evidence
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestDeriveIDUsesDocumentedCompactJSONInput(t *testing.T) {
|
||||
{SourceID: "session-alpha", StartUnitID: 3, EndUnitID: 9},
|
||||
{SourceID: "session-alpha", StartUnitID: 3, EndUnitID: 9},
|
||||
}
|
||||
const want = "location:sha256:379bd996e754e143b47e6b613a95166e58c111c7451750df7066ca816bb1866c"
|
||||
const want = "location:sha256:c099f7780a3cfd8c4094441d3a3e906f4f1e79c27589f95dfad573f86f308845"
|
||||
|
||||
if got := DeriveID(" The\u2003Tavern ", refs); got != want {
|
||||
t.Fatalf("DeriveID() = %q, want %q", got, want)
|
||||
@@ -120,7 +120,7 @@ func TestValidateRegistryReportsIdentityProblemsDeterministicallyWithoutMutation
|
||||
}
|
||||
wantLocations := cloneLocations(locations)
|
||||
|
||||
issues := ValidateList(dnd.LocationList{Locations: locations})
|
||||
issues := ValidateList(dnd.LocationRegistry{Locations: locations})
|
||||
want := []Issue{
|
||||
{Code: IssueIDMismatch, RecordIndex: 1, Value: validID},
|
||||
{Code: IssueEmptyCanonicalName, RecordIndex: 2, Value: ""},
|
||||
|
||||
Reference in New Issue
Block a user