···
# Repository Testing Summary
3
+
## Lexicon Schema Validation
5
+
We use Indigo's lexicon validator to ensure all AT Protocol schemas are valid and properly structured.
7
+
### Validation Components:
8
+
1. **Schema Validation** (`cmd/validate-lexicon/main.go`)
9
+
- Validates all 57 lexicon schema files are valid JSON
10
+
- Checks cross-references between schemas
11
+
- Validates test data files against their schemas
13
+
2. **Test Data** (`tests/lexicon-test-data/`)
14
+
- Contains example records for validation testing
15
+
- Files use naming convention:
16
+
- `*-valid*.json` - Should pass validation
17
+
- `*-invalid-*.json` - Should fail validation (tests error detection)
18
+
- Currently covers 5 record types:
19
+
- social.coves.actor.profile
20
+
- social.coves.community.profile
21
+
- social.coves.post.record
22
+
- social.coves.interaction.vote
23
+
- social.coves.moderation.ban
25
+
3. **Validation Library** (`internal/validation/lexicon.go`)
26
+
- Wrapper around Indigo's ValidateRecord
27
+
- Provides type-specific validation methods
28
+
- Supports multiple input formats
30
+
### Running Lexicon Validation
32
+
# Full validation (schemas + test data) - DEFAULT
33
+
go run cmd/validate-lexicon/main.go
35
+
# Schemas only (skip test data validation)
36
+
go run cmd/validate-lexicon/main.go --schemas-only
39
+
go run cmd/validate-lexicon/main.go -v
41
+
# Strict validation mode
42
+
go run cmd/validate-lexicon/main.go --strict
45
+
### Test Coverage Warning
46
+
The validator explicitly outputs which record types have test data and which don't. This prevents false confidence from passing tests when schemas lack test coverage.
50
+
๐ Validation Summary:
51
+
Valid test files: 5/5 passed
52
+
Invalid test files: 2/2 correctly rejected
54
+
โ
All test files behaved as expected!
56
+
๐ Test Data Coverage Summary:
57
+
- Records with test data: 5 types
58
+
- Valid test files: 5
59
+
- Invalid test files: 2 (for error validation)
61
+
Tested record types:
62
+
โ social.coves.actor.profile
63
+
โ social.coves.community.profile
64
+
โ social.coves.post.record
65
+
โ social.coves.interaction.vote
66
+
โ social.coves.moderation.ban
68
+
โ ๏ธ Record types without test data:
69
+
- social.coves.actor.membership
70
+
- social.coves.actor.subscription
71
+
- social.coves.community.rules
74
+
Coverage: 5/16 record types have test data (31.2%)
79
+
# Run lexicon validation tests
80
+
go test -v ./tests/lexicon_validation_test.go
82
+
# Run validation library tests
83
+
go test -v ./internal/validation/...
## Test Infrastructure Setup
- Created Docker Compose configuration for isolated test database on port 5434
- Test database is completely separate from development (5433) and production (5432)