
ekkoandClaude Sonnet 4.6
acf4e225e6
feat: rewrite database schema synchronization with automatic recovery (#379)
Complete rewrite of the Hermes SQLite database schema synchronization mechanism
with comprehensive error handling, automatic recovery, and full test coverage.
## Database Schema Synchronization
- **Unified sync mechanism**: Single `syncTable()` function handles all schema changes
- **Automatic column sync**: Adds missing columns and removes extra columns
- **Table rebuilding**: Automatically rebuilds tables when primary keys or types change
- **Data preservation**: Preserves data during schema changes when compatible
- **Index management**: Creates and removes indexes as needed
## Error Recovery & Reliability
- **Automatic backup**: Backs up corrupted database before recovery
- **Retry limiting**: Prevents infinite loops with retry limit
- **Duplicate prevention**: Avoids multiple backup files
- **Safe file operations**: Uses copy+delete instead of rename for safety
## Composite Primary Keys
- Fixed GC_ROOM_AGENTS and GC_ROOM_MEMBERS with proper composite primary keys
- Prevents duplicate entries while allowing same roomId with different agentId/userId
## Test Coverage
- **10 new integration tests** for schema synchronization (tests/server/schema-sync.test.ts)
- **3 updated tests** for Hermes schemas (tests/server/hermes-schemas.test.ts)
- All 327 tests passing (47 test files, 325 passed, 2 skipped)
## Bug Fixes
- Fixed module import issues (unified ES6 imports, removed mixed require())
- Fixed mock issues in sessions routes tests
- Fixed i18n coverage test to handle newly added keys
- Fixed profiles store test to match current implementation
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 19:48:46 +08:00
..
2026-04-22 08:09:58 +08:00
2026-04-29 08:26:24 +00:00
2026-04-26 10:29:17 +08:00
2026-04-22 08:09:58 +08:00
2026-04-26 22:51:35 +08:00
2026-04-26 22:51:35 +08:00
2026-04-26 22:51:35 +08:00
2026-04-22 16:14:50 +08:00
2026-04-26 10:55:08 +08:00
2026-05-01 19:48:46 +08:00
2026-05-01 08:12:53 +08:00
2026-04-26 10:10:01 +08:00
2026-04-29 20:31:24 +08:00
2026-04-17 16:48:24 +08:00
2026-04-29 08:26:24 +00:00
2026-05-01 19:48:46 +08:00
2026-04-25 22:23:33 +08:00
2026-04-29 08:26:24 +00:00
2026-04-30 19:46:31 +08:00
2026-04-29 08:26:24 +00:00
2026-04-26 10:44:51 +08:00
2026-05-01 19:48:46 +08:00
2026-04-22 10:33:38 +08:00
2026-04-30 19:46:31 +08:00
2026-05-01 08:24:57 +08:00