Skip to content

feat: stop requesting deleted distributions after repeated 4xx - #389

Merged
andrii-bodnar merged 3 commits into
masterfrom
feat/manifest-check
Sep 21, 2026
Merged

andrii-bodnar merged 3 commits into
masterfrom
feat/manifest-check

Conversation

@MykhailoNester

Copy link
Copy Markdown
Collaborator

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.

@MykhailoNester MykhailoNester self-assigned this Sep 18, 2026
@MykhailoNester MykhailoNester added the enhancement New feature or request label Sep 18, 2026
@MykhailoNester MykhailoNester changed the title feat: stop requesting deleted distributions after repeated 4xx feat: stop requesting deleted distributions after repeated 4xx Sep 18, 2026
@andrii-bodnar
andrii-bodnar requested a balanced review from Copilot September 18, 2026 14:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
andrii-bodnar merged commit 6f7e2f0 into master Sep 21, 2026
3 checks passed
@andrii-bodnar
andrii-bodnar deleted the feat/manifest-check branch September 21, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants