diff --git a/cmd/validate-lexicon/main.go b/cmd/validate-lexicon/main.go index 2fcb924..f8767de 100644 --- a/cmd/validate-lexicon/main.go +++ b/cmd/validate-lexicon/main.go @@ -435,9 +435,16 @@ func validateCrossReferences(catalog *lexicon.BaseCatalog, verbose bool) error { // Post record types (removed - no longer exists in new structure) // Actor definitions - "social.coves.actor.profile#geoLocation", + "social.coves.actor.defs#profileView", + "social.coves.actor.defs#profileViewDetailed", + "social.coves.actor.defs#profileStats", + "social.coves.actor.defs#viewerState", // Community definitions + "social.coves.community.defs#communityView", + "social.coves.community.defs#communityViewDetailed", + "social.coves.community.defs#communityStats", + "social.coves.community.defs#viewerState", "social.coves.community.rules#rule", } diff --git a/tests/lexicon-test-data/actor/block-invalid-did.json b/tests/lexicon-test-data/actor/block-invalid-did.json deleted file mode 100644 index 812b065..0000000 --- a/tests/lexicon-test-data/actor/block-invalid-did.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$type": "social.coves.actor.block", - "subject": "not-a-valid-did", - "createdAt": "2025-01-05T09:15:00Z" -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/block-valid.json b/tests/lexicon-test-data/actor/block-valid.json deleted file mode 100644 index 131517b..0000000 --- a/tests/lexicon-test-data/actor/block-valid.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$type": "social.coves.actor.block", - "subject": "did:plc:blockeduser123", - "createdAt": "2025-01-05T09:15:00Z", - "reason": "Repeated harassment and spam" -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/preferences-invalid-enum.json b/tests/lexicon-test-data/actor/preferences-invalid-enum.json deleted file mode 100644 index 69581c2..0000000 --- a/tests/lexicon-test-data/actor/preferences-invalid-enum.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$type": "social.coves.actor.preferences", - "feedPreferences": { - "defaultFeed": "invalid-feed-type", - "defaultSort": "hot" - } -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/preferences-valid.json b/tests/lexicon-test-data/actor/preferences-valid.json deleted file mode 100644 index d392c5d..0000000 --- a/tests/lexicon-test-data/actor/preferences-valid.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "$type": "social.coves.actor.preferences", - "feedPreferences": { - "defaultFeed": "home", - "defaultSort": "hot", - "showNSFW": false, - "blurNSFW": true, - "autoplayVideos": true, - "infiniteScroll": true - }, - "contentFiltering": { - "blockedTags": ["politics", "spoilers"], - "blockedCommunities": ["did:plc:controversialcommunity"], - "mutedWords": ["spam", "scam"], - "languageFilter": ["en", "es"] - }, - "notificationSettings": { - "postReplies": true, - "commentReplies": true, - "mentions": true, - "upvotes": false, - "newFollowers": true, - "communityInvites": true, - "moderatorNotifications": true - }, - "privacySettings": { - "profileVisibility": "public", - "showSubscriptions": true, - "showSavedPosts": false, - "showVoteHistory": false, - "allowDMs": "followers" - }, - "displayPreferences": { - "theme": "dark", - "compactView": false, - "showAvatars": true, - "showThumbnails": true, - "postsPerPage": 25 - } -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/profile-invalid-handle-format.json b/tests/lexicon-test-data/actor/profile-invalid-handle-format.json deleted file mode 100644 index 3e11b95..0000000 --- a/tests/lexicon-test-data/actor/profile-invalid-handle-format.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$type": "social.coves.actor.profile", - "handle": "invalid handle with spaces", - "displayName": "Test User", - "createdAt": "2024-01-01T00:00:00Z" -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/profile-invalid-missing-handle.json b/tests/lexicon-test-data/actor/profile-invalid-missing-handle.json deleted file mode 100644 index 56a0fc6..0000000 --- a/tests/lexicon-test-data/actor/profile-invalid-missing-handle.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$type": "social.coves.actor.profile", - "displayName": "Missing Required Fields" -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/profile-valid.json b/tests/lexicon-test-data/actor/profile-valid.json index 3d08e31..0f65fca 100644 --- a/tests/lexicon-test-data/actor/profile-valid.json +++ b/tests/lexicon-test-data/actor/profile-valid.json @@ -1,6 +1,5 @@ { "$type": "social.coves.actor.profile", - "handle": "alice.example.com", "displayName": "Alice Johnson", "bio": "Software developer passionate about open-source", "createdAt": "2024-01-15T10:30:00Z" diff --git a/tests/lexicon-test-data/actor/saved-invalid-type.json b/tests/lexicon-test-data/actor/saved-invalid-type.json deleted file mode 100644 index ec5b436..0000000 --- a/tests/lexicon-test-data/actor/saved-invalid-type.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$type": "social.coves.actor.saved", - "subject": "at://$1/social.coves.community.post/3k7a3dmb5bk2c", - "type": "article", - "createdAt": "2025-01-09T14:30:00Z" -} \ No newline at end of file diff --git a/tests/lexicon-test-data/actor/saved-valid.json b/tests/lexicon-test-data/actor/saved-valid.json deleted file mode 100644 index 92ea22a..0000000 --- a/tests/lexicon-test-data/actor/saved-valid.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$type": "social.coves.actor.saved", - "subject": "at://$1/social.coves.community.post/3k7a3dmb5bk2c", - "type": "post", - "createdAt": "2025-01-09T14:30:00Z", - "note": "Great tutorial on Go concurrency patterns" -} \ No newline at end of file diff --git a/tests/lexicon_validation_test.go b/tests/lexicon_validation_test.go index 885c455..ed0afbc 100644 --- a/tests/lexicon_validation_test.go +++ b/tests/lexicon_validation_test.go @@ -72,9 +72,13 @@ func TestLexiconCrossReferences(t *testing.T) { // Test specific cross-references that should work crossRefs := map[string]string{ - "social.coves.richtext.facet#byteSlice": "byteSlice definition in facet schema", - "social.coves.actor.profile#geoLocation": "geoLocation definition in actor profile", - "social.coves.community.rules#rule": "rule definition in community rules", + "social.coves.richtext.facet#byteSlice": "byteSlice definition in facet schema", + "social.coves.community.rules#rule": "rule definition in community rules", + "social.coves.actor.defs#profileView": "profileView definition in actor defs", + "social.coves.actor.defs#profileStats": "profileStats definition in actor defs", + "social.coves.actor.defs#viewerState": "viewerState definition in actor defs", + "social.coves.community.defs#communityView": "communityView definition in community defs", + "social.coves.community.defs#communityStats": "communityStats definition in community defs", } for ref, description := range crossRefs { @@ -108,7 +112,6 @@ func TestValidateRecord(t *testing.T) { recordType: "social.coves.actor.profile", recordData: map[string]interface{}{ "$type": "social.coves.actor.profile", - "handle": "alice.example.com", "displayName": "Alice Johnson", "createdAt": "2024-01-15T10:30:00Z", }, @@ -120,23 +123,22 @@ func TestValidateRecord(t *testing.T) { recordData: map[string]interface{}{ "$type": "social.coves.actor.profile", "displayName": "Alice Johnson", + // Missing required createdAt }, shouldFail: true, - errorContains: "required field missing: handle", + errorContains: "required field missing", }, { name: "Valid community profile", recordType: "social.coves.community.profile", recordData: map[string]interface{}{ "$type": "social.coves.community.profile", - "handle": "programming.community.coves.social", "name": "programming", "displayName": "Programming Community", "createdBy": "did:plc:creator123", "hostedBy": "did:plc:coves123", "visibility": "public", "moderationType": "moderator", - "federatedFrom": "coves", "createdAt": "2023-12-01T08:00:00Z", }, shouldFail: false, @@ -205,7 +207,6 @@ func TestValidateRecordWithStrictMode(t *testing.T) { // Test with strict validation flags recordData := map[string]interface{}{ "$type": "social.coves.actor.profile", - "handle": "alice.example.com", "displayName": "Alice Johnson", "createdAt": "2024-01-15T10:30:00", // Missing timezone }