refactor: add registerSync() to PluginRegistry, eliminate registryInternals hack (#77)#102
Merged
MarcosBrendonDePaula merged 1 commit intomainfrom Mar 14, 2026
Merged
Conversation
…ernals hack (#77) Add typed public methods (registerSync, refreshLoadOrder, getPluginsMap) to PluginRegistry so the framework no longer needs to bypass private fields via `as unknown as PluginRegistryInternals`. Remove the PluginRegistryInternals interface and all 12 encapsulation violations from server.ts. Add 20 unit tests covering sync registration, dependency chains, diamond deps, priority ordering, circular detection, and mixed priority+dependency scenarios. Closes #77 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
registerSync(),refreshLoadOrder(), andgetPluginsMap()public methods toPluginRegistryPluginRegistryInternalsinterface and all 12as unknown asencapsulation violations fromserver.tsCloses #77
What was the problem?
Breakable silently if private fields are renamed, contradicts the framework's type safety goals.
What changed?
core/plugins/registry.ts: Added 3 typed public methods (registerSync,refreshLoadOrder,getPluginsMap)core/framework/server.ts: Replaced 12 private-field accesses with public API calls; removedPluginRegistryInternalsinterface and getter (-54 lines, +5 lines)tests/unit/core/plugins/registry-sync-api.test.ts: 20 tests covering dependency chains, diamond deps, priority ordering, circular detection, mixed scenariosTest plan
bun run devstarts without regressions🤖 Generated with Claude Code