test(core): guard Bedrock admission startup path#61
Merged
robinbraemer merged 2 commits intoJul 24, 2026
Conversation
robinbraemer
added a commit
that referenced
this pull request
Jul 24, 2026
* fix(core): use Guice-native inject annotations for Bedrock DI
Velocity 4.0.0 fails to load the Connect plugin ("Cant create plugin
connect") because Guice cannot provision BedrockIdentityKeyProvider, the
2nd parameter of CommonModule.bedrockIdentityReadiness on the
VelocityPlugin injector.
Root cause: the Velocity plugin does not shade Guice (it is `provided`)
and VelocityPlugin builds a child of Velocity's own injector, so it runs
on the platform's Guice. Velocity 4.0.0 provides Guice 7, which dropped
javax.inject support and recognizes only com.google.inject/jakarta.inject
annotations. BedrockIdentityKeyProvider and BedrockAdmissionCoordinator
were annotated with javax.inject.Inject/@singleton, so under Guice 7 they
have no discoverable @Inject constructor and no no-arg constructor and
cannot be provisioned — failing the whole injector. Spigot/Bungee shade
Guice 6 and Velocity 3.x ships Guice 5; both still accept javax, so only
Velocity 4.0.0 broke. The javax dependency was introduced in #59 (which
replaced an explicit @provides factory with a JIT javax.inject.Inject
constructor), not #61.
Switch the five DI classes that still used javax.inject (BedrockIdentity-
KeyProvider, BedrockAdmissionCoordinator, BedrockIdentityEnforcer,
VerifiedBedrockIdentityRegistry, Metrics) to their com.google.inject.*
equivalents — the codebase standard everywhere else. This is portable
across Guice 5/6/7 and changes no DI semantics.
Add BedrockVelocityGuice7ProvisioningTest, which replicates Guice 7's
injectable-constructor discovery rule and forbids javax.inject on these
graph classes (no Guice 7 / Velocity 4.0.0 harness is on the classpath;
Guice 6 masks the failure). It fails before this change and passes after.
* no-mistakes(document): Documentation and lint housekeeping complete
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.
Intent
Harden the regression guard for the connect-java 0.12.0 Paper/Spigot startup crash (moxy#470; code already fixed in 0.12.1 / PR #59). Root cause: BedrockIdentityEnforcer and BedrockIdentityKeyProvider injected ConnectConfig directly, and they are resolved by the config-agnostic parent/platform injector while SpigotPlatform is constructed (before ConnectPlatform.init() loads config), forcing a JIT ConnectConfig binding on the parent that then collided (JitBindingAlreadySet) with the child ConfigLoadedModule binding — so onLoad crashed and token.json was never generated. 0.12.1 fixed the code by resolving config lazily via ConfigHolder. I verified 0.12.1 fully fixes the crash by reproducing on the 0.12.0 release commit (the graph is unresolvable from a config-agnostic parent) and confirming main passes. This change is TEST-ONLY: the existing BedrockParentInjectorStartupTest guard only exercised the enforcer path, but the bug report and SpigotPlatform/ConnectPlatform inject BedrockAdmissionCoordinator directly. I added a second test method (and extracted shared parent-injector/assertion helpers) that resolves BedrockAdmissionCoordinator from the pre-config parent and asserts the parent stays ConnectConfig-agnostic, closing the coverage gap for the exact injection point named in the report. No production code changed.
What Changed
BedrockAdmissionCoordinatorfrom the pre-configuration parent injector and verifies it remainsConnectConfig-agnostic.The full validation pipeline passed.
Risk Assessment
✅ Low: The change is narrowly scoped to test-only injector coverage, preserves the existing guard, and adds the requested direct BedrockAdmissionCoordinator startup-path check.
Testing
The focused regression test passed for both enforcer and coordinator paths; the independent runtime check confirmed coordinator resolution, no parent
ConnectConfigbinding, and successful child config binding. Evidence was preserved and generated build/cache directories were removed; no UI surface exists for this backend injector change.Evidence: Runtime startup smoke check
PRE_CONFIG_PARENT coordinator resolution: OK PRE_CONFIG_PARENT ConnectConfig binding: null POST_INIT_CHILD ConnectConfig is loaded instance: trueEvidence: Gradle test report
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
./gradlew :core:test --tests com.minekube.connect.module.BedrockParentInjectorStartupTest --rerun-tasks --console=plainDirect runtime smoke check resolvingBedrockAdmissionCoordinatorbefore config load, then bindingConnectConfigin a child injector./gradlew :core:clean :api:clean :build-logic:clean --console=plainFinalgit statusand transient-output checks✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.