Skip to content

2.3.2-SNAPSHOT#66

Merged
huangdihd merged 6 commits into
masterfrom
2.3.2-SNAPSHOT
Jun 11, 2026
Merged

2.3.2-SNAPSHOT#66
huangdihd merged 6 commits into
masterfrom
2.3.2-SNAPSHOT

Conversation

@huangdihd

Copy link
Copy Markdown
Owner

Changes

feat(plugin): MetaPlugin dependencies (#unload protection & enable order)

  • Plugins a MetaPlugin (transitively) depends on now share its lifecycle restriction: they cannot be unloaded via pm unload while the bot is running, since that would tear down the MetaPlugin's classloader chain.
  • enableAll() enables the MetaPlugin's dependencies (in dependency order) before the MetaPlugin itself.
  • New lang key xinbot.metaplugin.error.unload_dependency_runtime in all 7 languages.

fix(plugin): wire (soft)dependency classloader chain on runtime load

  • loadPlugin(File) (used by pm load/pm reload) now delegates to the shared instantiateAndLoad(), so runtime loads get the same effective-dependency classloader chain as startup batch loading.

fix(plugin): reject runtime load when a hard dependency is missing

  • The startup loader already refuses plugins with missing hard dependencies; the runtime path now refuses them too instead of silently loading with a broken classloader chain.

Tests

  • MetaPluginDependencyTest (4 tests): unload protection, transitive protection, enable order, non-dependency plugins unaffected
  • PluginRuntimeSoftDependTest (3 tests): runtime soft-dep wiring, absent soft-dep ignored, missing hard dep rejected
  • Full suite: 78 tests, 0 failures

🤖 Generated with Claude Code

huangdihd and others added 4 commits June 10, 2026 14:59
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The single-JAR runtime load path (loadPlugin(File), used by pm load/reload)
built the plugin classloader with only the core classloader as parent and
never wired up its dependencies, so a plugin loaded at runtime could not see
its (soft)dependency classes. Only the startup batch loader handled this.

Delegate loadPlugin(File) to the shared instantiateAndLoad() so runtime loads
get the same effective-dependency classloader chain as startup loading.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…untime unload

Plugins a MetaPlugin (transitively) depends on now share its lifecycle
restriction: they cannot be unloaded during runtime, since that would
tear down the MetaPlugin's classloader chain. enableAll() also enables
the MetaPlugin's dependencies (in dependency order) before the
MetaPlugin itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The startup batch loader excludes plugins with missing hard dependencies
via the topological sort, but the runtime path (pm load/reload) silently
loaded them with the core classloader as parent, leaving a broken
classloader chain. Refuse the load with the same dependency.missing
message instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Jun 11, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 42 complexity · 1 duplication

Metric Results
Complexity 42
Duplication 1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

huangdihd and others added 2 commits June 11, 2026 20:17
Codacy (PMD AvoidAccessibilityAlteration) flags setAccessible() calls
scattered in test classes. Move the reflective access to Bot's private
running/session fields into a single suppressed helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
LoginFlowTest, LoginFlowRealWorldTest, ModpackTest and the two new
plugin-dependency test classes were not in the hand-maintained matrix,
so CI never ran them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@huangdihd
huangdihd merged commit a43ed6e into master Jun 11, 2026
18 checks passed
@github-actions
github-actions Bot deleted the 2.3.2-SNAPSHOT branch June 11, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant