[ANCHOR-1261]: SEP-6/24/31-only deployments fail to start due to missing bean dependencies - #1985
Merged
Conversation
* refactor exchange amounts calculator bean activation * update condition to activate if any sep6, sep24, or sep31 is enabled
Contributor
There was a problem hiding this comment.
Pull request overview
Corrects conditional bean registration so SEP-6, SEP-24, or SEP-31 can run independently.
Changes:
- Registers
ExchangeAmountsCalculatorwhen any supported SEP is enabled. - Aligns the bean condition with its consumers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JiahuiWho
approved these changes
Jul 28, 2026
* add sep31 to the list of seps for clientfinder conditional enablement * add new test file `sepbeansconditionalregistrationtest.kt` * add scenarios to test clientfinder registration for sep6, sep10, sep24, or sep31 enablement * add scenarios to test no registration of exchangeamountscalculator and clientfinder when no seps are enabled
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.
Description
SepBeanshas two bean-gating bugs of the same shape: a bean is annotated with a@Conditionalnarrower than what its unconditionally-required consumers actually need, so a config enabling only one of SEP-6/24/31 fails to boot.1.
exchangeAmountsCalculatorwas gated with@OnAllSepsEnabled(seps = {"sep6", "sep24", "sep31"}), requiring all three SEPs to be enabled before the bean is registered. But each of the three consumers (sep6Service,sep24Service,sep31Service) is independently gated on only its own SEP being enabled, and each callsexchangeAmountsCalculator(...)unconditionally in its constructor arguments. SinceSepBeansis a plain@Configurationclass (defaultproxyBeanMethods = true), that in-class method call is intercepted by Spring's CGLIB proxy and resolved as a real bean lookup, not a plain Java call - so it's subject to the bean's own condition. Any deployment running SEP-24 without also running SEP-6 and SEP-31 hit this at startup:Sep24Service's own gate (sep24.enabled) passes, but theexchangeAmountsCalculatorbean it depends on didn't exist.2.
clientFinderwas gated with@OnAnySepsEnabled(seps = {"sep6", "sep10", "sep24"}), omitting"sep31"- butsep31ServicetakesClientFinder clientFinderdirectly as a constructor parameter. A SEP-31-only deployment (SEP-6/10/24 all disabled) hit the identical failure mode for this bean instead.ExchangeAmountsCalculatoritself has no SEP-6/24/31-specific logic - it's a generic(Sep38QuoteStore, Clock)quote-amount calculator shared across all three. Both fixes widen the respective bean's condition to match what its consumers actually require, following the same@OnAnySepsEnabledpattern already used elsewhere in this file for other shared beans.Also added a parameterized Spring-context test (
SepBeansConditionalRegistrationTest) that boots a realApplicationContextRunneragainst the actualSepBeansclass - the existingSepBeansTestonly calls bean methods directly as plain Java calls, which never exercises Spring's@Conditionalevaluation and would not have caught either of these regressions, or a future reintroduction of either.Changes
SepBeans.exchangeAmountsCalculator:@OnAllSepsEnabled(seps = {"sep6", "sep24", "sep31"})→@OnAnySepsEnabled(seps = {"sep6", "sep24", "sep31"}).SepBeans.clientFinder:@OnAnySepsEnabled(seps = {"sep6", "sep10", "sep24"})→@OnAnySepsEnabled(seps = {"sep6", "sep10", "sep24", "sep31"}).SepBeansConditionalRegistrationTest.kt(new): a real SpringApplicationContextRunnertest, parameterized across SEP-6-only / SEP-24-only / SEP-31-only, asserting the context starts successfully and exposes exactly oneExchangeAmountsCalculatorbean in each case; a fourth case asserts zeroExchangeAmountsCalculator/ClientFinder/SepRequestValidatorbeans when none of the three are enabled.Acceptance Criteria
sep24.enabled: true(SEP-6 and SEP-31 disabled) starts successfully and servesGET /sep24/info.exchangeAmountsCalculatorinstance, unchanged from today.ExchangeAmountsCalculator,ClientFinder, orSepRequestValidatorbeans, unchanged from today.Context
Reported by an operator upgrading to 4.6.1: their service failed to start with SEP-24 enabled unless SEP-6 and SEP-31 were also enabled (with inert settings, purely to satisfy the bean condition), despite having no business logic or ops process behind those two protocols. Tracked as ANCHOR-1261. The
clientFinder/SEP-31 gap was found while verifying the fix live across all three single-SEP configurations, ahead of writing the regression test.Testing
./gradlew :core:test :platform:test- BUILD SUCCESSFUL.service-runnerjar: booted the actual--sep-serverprocess independently withSEP24_ENABLED=true/SEP6_ENABLED=true/SEP31_ENABLED=true(each alone, other two disabled) - all three start cleanly and serve requests (GET /sep24/infoconfirmed for the SEP-24 case).... required a bean named 'exchangeAmountsCalculator' that could not be found/... required a bean of type 'org.stellar.anchor.client.ClientFinder' that could not be found); confirmed the new automated test fails in exactly the corresponding case and no other; restored both fixes and confirmed clean passes.Documentation
N/A
Known limitations
N/A