fix: allow setResetting() from LOADING_INITIAL and RESETTING#99
Merged
Conversation
The FORCE_RESYNC startup path in MainVerticle calls setResetting() whenever the persisted state isn't LAUNCHING, but setResetting() only accepted READY or LOADING_UPDATES. A service that crashed mid-initial-load persists state as LOADING_INITIAL; restarting with FORCE_RESYNC=true then loops on IllegalStateException → "Initial load failed, terminating..." → exit(1). A reset is "discard prior progress, restart from -1", which is semantically valid from any post-initialize state. Broaden the guard to only reject LAUNCHING (state machine uninitialized). This also makes a crashed prior reset retryable (RESETTING → RESETTING) and fixes the same latent hole in JellyNanopubLoader.performResync() under contrived state mixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 1.11.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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
FORCE_RESYNC=trueand persisted stateLOADING_INITIAL(typical after a previous crash mid-initial-load) is stuck in a restart loop. TheFORCE_RESYNCblock inMainVerticle.start()callsStatusController.setResetting(), which only acceptedREADYorLOADING_UPDATESas source states. The throw bubbles to the init thread's catch, which logs"Initial load failed, terminating..."and callsRuntime.exit(1).LAUNCHING(state machine not yet initialized).RESETTING → RESETTING(retry of a crashed prior reset) idempotent, and fixes the same latent hole inJellyNanopubLoader.performResync()for free.Test plan
StatusControllerTestupdated:setResettingFromInvalidStatesThrowssplit intosetResettingFromLaunchingThrows; addedsetResettingFromLoadingInitial(the live failure scenario) andsetResettingFromResetting. All 16 tests pass.FORCE_RESYNC=trueand persisted stateLOADING_INITIAL; confirm the resync proceeds instead of looping onIllegalStateException.🤖 Generated with Claude Code