Skip to content

fix(spi): bind syntax plugins to defining classloader - #2773

Merged
openai0229 merged 1 commit into
mainfrom
fix/sql-syntax-service-loader-classloader
Aug 26, 2026
Merged

openai0229 merged 1 commit into
mainfrom
fix/sql-syntax-service-loader-classloader

Conversation

@openai0229

Copy link
Copy Markdown
Contributor

Related issue

Closes #2772

Summary

Load ISqlSyntaxPlugin providers with the ClassLoader that defined the service interface instead of the calling thread context ClassLoader. This prevents JCEF worker threads and layered desktop launchers from loading providers as incompatible duplicate types.

Add a regression test that installs an unrelated thread context ClassLoader and verifies service discovery still finds the registered probe plugin.

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results: mvn -f chat2db-community-server/pom.xml -pl chat2db-community-spi -am -DskipTests=false -Dmaven.test.skip=false test - 237 tests passed across tools, domain API, and SPI; 0 failures.
  • Manual verification: Reproduced the original desktop exception from runtime logs and verified the regression test uses a deliberately unrelated context ClassLoader.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: No change.
  • Database or driver compatibility: Bundled syntax providers are unchanged; only their discovery ClassLoader is made deterministic.
  • Network, privacy, or security: No change.
  • Community / Local / Pro boundary: Shared Community SPI fix applies consistently to all products.
  • Backward compatibility: Existing ServiceLoader provider descriptors remain unchanged.

Reviewer map

  • Start here: SqlSyntaxPluginRegistry.load().
  • Failure condition: A desktop worker context ClassLoader loads a provider against a different copy of ISqlSyntaxPlugin.
  • Rollback or disable path: Revert this PR to restore context-ClassLoader discovery.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: Codex assisted with root-cause analysis, implementation, and regression testing.

@openai0229
openai0229 requested a review from Aias00 as a code owner August 26, 2026 12:19
@openai0229 openai0229 moved this to In Review in Chat2DB Community Aug 26, 2026
@openai0229
openai0229 merged commit 5805d80 into main Aug 26, 2026
13 checks passed
@openai0229
openai0229 deleted the fix/sql-syntax-service-loader-classloader branch August 26, 2026 12:20
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Desktop SQL syntax plugins can fail under a foreign context ClassLoader

1 participant