- Add JSON schema at schemas/state.json with full validation rules - Implement State, StateType, StateMetadata dataclasses in models/state.py - Support immutable state objects with versioning and TTL - Include serialization/deserialization (JSON and dict) - Add next_version() for state history chaining - Comprehensive test suite with 19 tests (100% pass) - Full documentation at docs/state-schema.md Features: - UUID validation for all ID fields - Optimistic locking via version numbers - Flexible payload structure - Metadata support (source, provenance, tags) - Expiration checking via TTL - Complete type hints Closes Issue #3
66 lines
1.6 KiB
Markdown
66 lines
1.6 KiB
Markdown
# Electra Archon
|
|
|
|
SEED Architecture Implementation for the Electra Archon wizard.
|
|
|
|
## SEED Architecture
|
|
|
|
SEED stands for **S**tate-**E**vent-**E**ntity-**D**omain - a modular architecture for building resilient, auditable systems.
|
|
|
|
### Components
|
|
|
|
1. **State** - Immutable snapshots of entity state with versioning
|
|
2. **Event** - Pub/sub system for inter-component communication
|
|
3. **Entity** - Core domain objects with identity
|
|
4. **Domain** - Business logic and rules
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
electra-archon/
|
|
├── schemas/ # JSON schemas for data validation
|
|
│ └── state.json # State schema definition
|
|
├── models/ # Python data models
|
|
│ └── state.py # State dataclass implementation
|
|
├── docs/ # Documentation
|
|
│ └── state-schema.md
|
|
├── tests/ # Test suite
|
|
│ └── test_state.py
|
|
└── pytest.ini # Test configuration
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```python
|
|
from models.state import State, StateType, StateMetadata
|
|
import uuid
|
|
|
|
# Create a state
|
|
state = State.create(
|
|
entity_id=str(uuid.uuid4()),
|
|
state_type=StateType.ACTIVE,
|
|
payload={"status": "running"},
|
|
metadata=StateMetadata(source="electra", tags=["seed"])
|
|
)
|
|
|
|
# Serialize
|
|
json_str = state.to_json()
|
|
```
|
|
|
|
## Running Tests
|
|
|
|
```bash
|
|
pytest tests/ -v
|
|
```
|
|
|
|
## Backlog
|
|
|
|
See [Issues](http://143.198.27.163:3000/allegro/electra-archon/issues) for current backlog:
|
|
|
|
- Issue #3: Design Electra State Schema for SEED Architecture ✅
|
|
- Issue #4: Implement Event Bus for Inter-Archon Communication
|
|
- Issue #5: Create Entity Resolution Service
|
|
|
|
## License
|
|
|
|
MIT
|