Commit a0f8449
feat(core): integrate TAPI backoff v2 into upload flow
Integrates backoff infrastructure and error classification into the
SegmentDestination upload flow. This completes the TAPI backoff v2
implementation.
SegmentDestination changes:
- Upload gate: Check canUpload() before processing batches
- Batch lifecycle: Create metadata on first failure only
- Error handling:
- 429 rate limit: Call handle429() and halt upload loop
- Transient errors: Create/update batch metadata for retry
- Permanent errors: Drop batch immediately
- Network errors: Treat as transient
- Retry count header: Send X-Retry-Count (batch or global)
- Dynamic import: Lazy load backoff module to avoid circular deps
- Clean initialization: Info-level logs for normal operations
- Error logging: All catch blocks now log errors appropriately
API changes:
- Add keepalive: true to fetch for background completion
- Add retryCount parameter for X-Retry-Count header
Logger changes:
- Default to disabled in production (process.env.NODE_ENV check)
Key improvements from code review:
- No console.log statements
- Simplified upload gate logic
- Proper error logging throughout
- Appropriate log levels (info for normal, error for failures)
This PR depends on PRs #1 (infrastructure) and #2 (error classification).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 67bfcf5 commit a0f8449
4 files changed
Lines changed: 688 additions & 29 deletions
File tree
- packages/core/src
- plugins
- __tests__
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
18 | | - | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
0 commit comments