Repository navigation
feat: stop requesting deleted distributions after repeated 4xx - #389
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
In-flight failures can consume multiple pauses immediately and permanently disable requests without waiting through the intended daily intervals.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a persistent circuit breaker to reduce billed requests to deleted distributions.
Changes:
- Tracks CloudFront-signed 4xx responses and applies escalating pauses.
- Gates manifest and language requests and exposes a public reset API.
- Adds tracker tests and updates repository construction.
File summaries
| File | Description |
|---|---|
Crowdin.kt |
Initializes and resets the shared tracker. |
DistributionFailureState.kt |
Defines persisted breaker state. |
DistributionFailureTracker.kt |
Implements failure tracking and request suspension. |
CrowdingRepository.kt |
Gates requests and records responses. |
TranslationDataRepository.kt |
Accepts the shared tracker. |
StringDataRemoteRepository.kt |
Accepts the shared tracker. |
MappingRepository.kt |
Accepts the shared tracker. |
DistributionFailureTrackerTest.kt |
Tests breaker behavior. |
CrowdingRepositoryTest.kt |
Updates repository test setup. |
TranslationDataRepositoryTest.kt |
Supplies a tracker fixture. |
StringDataRemoteRepositoryTest.kt |
Supplies a tracker fixture. |
MappingRepositoryTest.kt |
Supplies a tracker fixture. |
TestCommon.kt |
Adds in-memory tracker test utilities. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
andrii-bodnar
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A deleted distribution keeps answering 4xx forever while old app builds stay in use for months, and every one of those requests is billed. Pause manifest and languages requests for a day after 10 failures, arm the next pause on a single failure after that, and stop requesting the distribution altogether after 3 pauses.
Only 4xx responses carrying a CloudFront signature count, so a captive portal or a corporate proxy answering 403 cannot trip the breaker. The state is bound to the distribution hash and the app build, and Crowdin.resetDistributionFailureState() clears it once the distribution is restored.