Skip to content

TAPI Backoff Implementation#1148

Closed
abueide wants to merge 5 commits intomasterfrom
tapi-core-clean
Closed

TAPI Backoff Implementation#1148
abueide wants to merge 5 commits intomasterfrom
tapi-core-clean

Conversation

@abueide
Copy link
Contributor

@abueide abueide commented Mar 6, 2026

No description provided.

abueide and others added 5 commits March 6, 2026 13:07
Implements a robust backoff and retry system for Segment API uploads:

- BatchUploadManager: Manages batched event uploads with retries
- UploadStateMachine: Handles upload states (pending, uploading, success, error)
- Flexible backoff configuration with exponential backoff
- Proper error handling for permanent vs temporary failures
- Config validation for backoff settings

This provides the core infrastructure for reliable event delivery
with configurable retry behavior.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes 14 issues identified in code review across critical bugs, spec
non-compliance, code smells, and simplification opportunities.

Critical fixes:
- Rename WAITING state to RATE_LIMITED per spec (with migration)
- Add metadata validation on app restart to handle corrupt timestamps
- Fix premature batch metadata creation (only create on first failure)
- Restore logger production default (disabled in production)

Code quality:
- Remove all console.log debug statements (21 total)
- Restore keepalive flag for fetch requests
- Add error logging to previously silent catch blocks
- Downgrade operational logs from warn to info level
- Add clarifying comment for rate limit double-negative logic

Minor improvements:
- Simplify upload gate logic and retry count logic
- Remove unnecessary type casting
- Clean up code structure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@abueide
Copy link
Contributor Author

abueide commented Mar 6, 2026

Closing this PR in favor of smaller, more reviewable PRs:

The split PRs contain the exact same changes as this PR, just organized for better reviewability. Research shows PRs under 400 lines get 70-90% defect detection, while PRs over 1000 lines get skimmed.

All 14 code review fixes have been applied across the new PRs.

@abueide abueide closed this Mar 6, 2026
@abueide abueide deleted the tapi-core-clean branch March 6, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant