Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Defer HEADLESS plugin activation until Game initialization is complete.
Pull request overview
Fixes global plugin mappings in HEADLESS mode so configured plugins are available before scenes boot.
Changes:
- Installs configured global plugins during HEADLESS startup.
- Adds regression coverage for mapped plugin injection.
File summaries
| File | Summary |
|---|---|
tests/plugins/PluginManager.test.js |
Adds HEADLESS mapping regression coverage. |
src/plugins/PluginManager.js |
Adjusts HEADLESS plugin installation timing; activation may occur before Game state is initialized. |
Review details
Suppressed comments (1)
src/plugins/PluginManager.js:455
- HEADLESS
PluginManagerinstances are constructed beforeGameassignsthis.plugins(src/core/Game.js:280), and the constructor callsboot()immediately (src/plugins/PluginManager.js:117-120). With this condition, a mapped config plugin is instantiated and itsinit/startrun inside that constructor, sothis.game.plugins(and later Game fields such asnoReturn) are still unset. This makes HEADLESS plugin startup observably earlier than Canvas/WebGL and can break valid plugins that access public Game state; defer HEADLESS activation until after Game construction, or separate cache registration from activation while still making mappings available before Scene Systems boot.
if (!this.game.isBooted && this.game.config.renderType !== CONST.HEADLESS)
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
This PR
Install global plugins immediately during HEADLESS startup so configured mappings are available when scenes boot. Add regression coverage for scene injection.
Tests:
npx vitest run tests/plugins/PluginManager.test.jsnpx vitest run tests/pluginsFixes #7348