feat: fail safe when configuring the optional recency replica#119
Closed
macdiesel wants to merge 1 commit into
Closed
feat: fail safe when configuring the optional recency replica#119macdiesel wants to merge 1 commit into
macdiesel wants to merge 1 commit into
Conversation
126d2bb to
140fa30
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## bbeggs/newest-courses-sort-replica #119 +/- ##
=====================================================================
Coverage ? 85.62%
=====================================================================
Files ? 109
Lines ? 6638
Branches ? 814
=====================================================================
Hits ? 5684
Misses ? 821
Partials ? 133 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cb896fb to
072ca47
Compare
Configuring a sort replica is additive and must never abort the reindex. Wrap each per-replica set_index_settings(index_name=...) call in the unified registry loop so an AlgoliaException is logged and skipped, leaving the primary index and the other replicas configured. The degraded state is always the safe base (relevance) sort; the failed replica catches up on the next successful run. Record the fail-safe in ADR 0014 and cover it with a test (base replica succeeds while recency fails). Stacked on the new-index PR (#118). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
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.
Summary
Stacked on top of #118 (the new recency-replica index). Splits the fail-safe behavior into its own PR so the index feature and the resilience change can be reviewed independently.
What & why
Configuring the recently-published replica is an optional, additive step. Before this change, if
set_replica_index_settingsraisedAlgoliaException(replica not yet declared, transient Algolia error), the exception propagated out ofconfigure_algolia_indexand aborted the entire reindex — taking down configuration of the primary relevance index that every learner's search depends on.This wraps only the recency-replica step so the exception is logged and skipped, leaving the primary index and its base replica configured. The degraded state is always the safe base (relevance) sort; the recency replica catches up on the next successful run.
set_replica_index_settingsre-raising (a faithful low-level client method); the "this replica is optional" policy lives at the orchestration layer inconfigure_algolia_index.test_configure_algolia_index_recency_replica_failure_is_safeforces the replica step to raise and asserts: no propagation, primary + base replica still configured, failure logged.Test
test_algolia_utils.pygreen except 3 pre-existing time-sensitivetest_get_course_run*failures (fail onmastertoo).isort+pylintclean on changed files.🤖 Generated with Claude Code