Test
9ed6c2638d
feat(T2.7): implement workflow history pruning
- Add internal/history package for pruning workflow history
- Implement HistoryPruner with configurable pruning policies
- Automatic pruning on size/age/count thresholds
- Archive old entries to disk for compliance
- Memory-efficient history management
- Continue-as-new compatible design
- 17 history tests, all passing
Features:
- AddEntry() for adding task history
- Automatic pruning by:
- Maximum history size (default 100MB)
- Maximum entry age (default 24 hours)
- Maximum entry count (default 1000)
- Manual Prune() trigger
- GetEntries() with filters (status, time range, recent)
- UpdateEntry() for status changes
- Archive old entries to configurable directory
- Clear() to reset history
Pruning Strategy:
- Entries sorted by end time (oldest first)
- Remove entries exceeding any threshold
- Archive to disk for historical analysis
- Keep recent entries for debugging
- 90% threshold triggers auto-pruning
Memory Management:
- Constant memory growth even with 1000s of tasks
- Estimated size calculated per entry
- Size ratio tracked (current vs max)
- Memory info reporting
Statistics:
- Total size and entry count
- Average entry size
- Prune and archive counts
- Last prune timestamp
- Usage ratio (%)
- Memory growth rate
Archival:
- Optional archive directory
- Entries saved as JSON for analysis
- Timestamp included in filename
- Non-blocking archive operations
Test Coverage:
- 17 history tests (add, query, prune, archive)
- Constant memory growth verified (1000 tasks)
- Age-based pruning verified
- Archive directory creation tested
- Status filtering tested
- Recent entries retrieval tested
- Update operations tested
- Policy defaults verified
Verification:
- Memory stays within bounds ✓
- Old entries pruned correctly ✓
- Recent entries preserved ✓
- Archive functionality working ✓
- Concurrent safe (RWMutex) ✓
Next: T2.8 (Distributed lock optimization)
2026-08-23 17:24:46 -07:00
..
2026-08-23 17:14:23 -07:00
2026-08-23 17:23:35 -07:00
2026-08-23 16:49:25 -07:00
2026-08-23 17:15:10 -07:00
2026-08-21 21:57:01 -07:00
2026-08-23 17:17:51 -07:00
2026-08-23 16:33:49 -07:00
2026-08-23 17:24:46 -07:00
2026-08-23 17:21:23 -07:00
2026-08-21 15:58:46 -07:00
2026-08-23 16:33:49 -07:00
2026-08-23 16:33:49 -07:00
2026-08-23 17:11:56 -07:00
2026-08-23 16:43:30 -07:00
2026-08-23 17:18:30 -07:00
2026-08-23 16:47:31 -07:00