feat: add comprehensive zero-config validation system

- Implement self-configuring validation that adapts to system resources
- Add validation for all CRUD operations (add, update, delete, find, relate)
- Auto-configure limits based on available memory (1GB = 10K limit, 8GB = 80K)
- Monitor and auto-tune performance based on query response times
- Fix multiple type filtering with proper anyOf structure
- Enhance type safety by requiring NounType/VerbType enums
- Fix tests to validate correct behavior (no fake implementations)
- Add comprehensive VALIDATION.md documentation
- Update API_REFERENCE.md with validation rules and examples
- Clarify metadata update behavior (null keeps existing, {} clears)

BREAKING CHANGE: getFieldsForType() now requires NounType enum instead of string

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-09-12 14:37:39 -07:00
parent e9a2c41b0a
commit 7eaf5a9252
12 changed files with 979 additions and 76 deletions

View file

@ -385,7 +385,7 @@ export class NaturalLanguageProcessor {
reason?: string
}> {
// Get fields that actually appear with this type
const typeFields = await this.brain.getFieldsForType(nounType)
const typeFields = await this.brain.getFieldsForType(nounType as NounType)
// Check if this field appears with this type
const fieldInfo = typeFields.find(tf => tf.field === field)
@ -554,7 +554,7 @@ export class NaturalLanguageProcessor {
// Step 4: Get type-specific fields if we detected a type
let typeSpecificFields: Array<{field: string; affinity: number}> = []
if (detectedNounType && typeConfidence > 0.75) {
const fieldsForType = await this.brain.getFieldsForType(detectedNounType)
const fieldsForType = await this.brain.getFieldsForType(detectedNounType as NounType)
typeSpecificFields = fieldsForType.map(f => ({field: f.field, affinity: f.affinity}))
}