Repository navigation
COLDBOX-1469 A disabled nested module breaks its parent, removeChildInjector() throws, and a child injector shutdown stops the application's caches - #730
Open
homestar9 wants to merge 3 commits into
Conversation
…oveChildInjector() throws, and a child injector shutdown stops the application's caches - A disabled nested (inception) module broke its parent's activation. childModules was appended before registration was attempted, so a child with this.disabled = true produced IllegalModuleState in the activation cascade. Only children that actually registered are tracked now. - Injector.removeChildInjector() returned a typo'd variable name (falase) instead of false when the child was not found, raising an undefined variable error. - Injector.shutdown() shut down the application's CacheBox whenever a ColdBox-linked child injector was shut down, unregistering every cache for the whole application. The application owns that lifecycle via LoaderService.processShutdown(). shutdown() already guarded LogBox and the executors with !isColdBoxLinked(); CacheBox now has the same guard. Each fix has a spec that fails without it.
homestar9
marked this pull request as ready for review
October 27, 2026 22:25
…; prove a disabled dependency still fails Only a disabled nested module is now left off its parent's childModules list. A child whose name was already in the module registry (for example a top-level copy) stays on the list, so the parent's activation still reaches it as before. New specs: a parent that lists its disabled nested child in this.dependencies still throws IllegalModuleState, and a nested child whose name is already known stays on the parent's list.
…throws IllegalModuleState for an unregistered module
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
Three small bugs in the module and child injector code, fixed together because they sit next to each other.
A disabled nested module stops its parent from activating.
ModuleService.registerModule()added a nested module to the parent'schildModuleslist before registering it. A module withthis.disabled = trueis never registered but stayed on the list, so activating the parent failed withCannot activate module (disabledChild) as it has not been registered.A nested module is now added to the list only when it registered, or when another parent already registered a module with that name.Injector.removeChildInjector()throws when the child is not found. It returnedfalaseinstead offalse, which is an undefined variable.Shutting down a child injector shuts down every cache in the application.
Injector.shutdown()shut down CacheBox whenever CacheBox was linked. In a ColdBox application the application owns CacheBox and shuts it down inLoaderService.processShutdown().shutdown()already skips LogBox and the executors when ColdBox is linked; CacheBox now gets the same check. This applies to every ColdBox-linked injector, including the root. That is intended: in a ColdBox application no injector should shut down the application's caches.Jira Issues
https://ortussolutions.atlassian.net/browse/COLDBOX-1469
Part of https://ortussolutions.atlassian.net/browse/COLDBOX-1478
Type of change
Checklist
Tests
tests/specs/web/services/ModuleServiceInceptionTest.cfc(new): a parent with a disabled nested module activates and does not list it. Test modules intests/resources/inceptionfixtures/.tests/specs/ioc/InjectorTest.cfc:removeChildInjector()returnsfalsefor an unknown name, and shutting down a ColdBox-linked injector leaves CacheBox running.The 3 new specs fail on the 8.3.0 code. With the fix, every spec in the changed files passes on BoxLang (CFML compat), Lucee 5 and Adobe 2025.