Commit Graph
1 Commits
Author SHA1 Message Date
Test d8fe3f5a3c feat(T2.5): implement git operation batching
- Add internal/batching package for git operation batching
- Implement GitBatcher with configurable batch size and age
- Queue git operations (commit, push, merge)
- Auto-flush on max batch size
- Manual flush on demand
- Time-based flush (max batch age)
- Batch status tracking (pending, executing, completed, failed)
- Network savings calculation
- Statistics tracking per batch and aggregated
- 24 batching tests, all passing

Features:
- Enqueue() for adding operations to queue
- Flush() for manual batch creation
- GetPendingBatch() for next pending batch
- MarkBatchExecuting/Completed/Failed() for status tracking
- GetStats() for batching statistics
- CalculateNetworkSavings() for round trip savings
- GetExecutedBatches() for completed batch history
- TimeSinceLastFlush() for age checking
- ShouldFlush() for time-based decisions

Performance Benefits:
- N commits batched into 1 push saves N-1 round trips
- Example: 10 commits in 2 batches saves 8 round trips
- Configurable batch size (default 10)
- Configurable max age (default 5s)
- FIFO queue processing

Network Savings Example:
- 10 operations in 2 batches of 5 each
- Network savings: 8 round trips (vs 10 individual operations)
- Verified in TestGetStats

Status Tracking:
- pending: queued and ready to execute
- executing: currently being executed
- completed: finished successfully
- failed: execution failed (kept for retry)

Test Coverage:
- 24 batching tests (enqueue, flush, status, stats)
- Auto-flush on max size verified
- Time-based flush behavior tested
- Network savings calculation verified
- Error handling and state management
- Concurrent safe operations (RWMutex)

Next: T2.6 (LLM request batching)
2026-08-23 17:22:23 -07:00