kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Remove Vue event bus from plugin mediator

Open rtibbles opened this issue 7 months ago • 1 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Complexity: Low Target branch: develop

Context

The plugin mediator (packages/kolibri/internal/pluginMediator.js) uses new Vue() as an event dispatcher. This was built in anticipation of the mediator enabling async inter-plugin communication, but that pattern never materialized. The event system is only used internally for two things:

  1. $once('ready', ...) — to defer kolibriModule.ready() until the mediator is ready
  2. $emit('kolibri_register', ...) / on('kolibri_register', ...) — to resolve lazily-loaded content viewers in retrieveContentViewer

No plugin defines events or once getters, and no plugin calls emit(), on(), once(), off(), or stopListening() via the facade. The entire event registration system (_registerMultipleEvents, _registerOneTimeEvents, _callbackRegistry) is dead code.

This blocks Vue 3 migration because $on, $off, and $once are removed from Vue instances in Vue 3.

The Change

Replace new Vue() event dispatcher with simple callbacks/promises for the two internal uses. Remove the dead event registration infrastructure and the unused public event API.

  • Replace the 'ready' event with a simple callback or promise pattern
  • Replace the 'kolibri_register' event in retrieveContentViewer with a direct callback
  • Remove _eventDispatcher, _callbackRegistry, _registerEvents, _registerMultipleEvents, _registerOneTimeEvents, _registerEventListener, _registerRepeatedEventListener, _registerOneTimeEventListener, stopListening
  • Remove emit, on, once, off from the public facade (publicMethods array)
  • Remove corresponding emit, stopListening convenience methods from KolibriModule (packages/kolibri-module/src/index.js)

Acceptance Criteria

  • [ ] new Vue() event dispatcher removed from pluginMediator
  • [ ] 'ready' and 'kolibri_register' internal uses replaced with simple callbacks/promises
  • [ ] Dead event registration infrastructure removed (_callbackRegistry, _registerEvents, _registerMultipleEvents, _registerOneTimeEvents, _registerEventListener, _registerRepeatedEventListener, _registerOneTimeEventListener, stopListening)
  • [ ] emit, on, once, off removed from public facade
  • [ ] emit, stopListening convenience methods removed from KolibriModule
  • [ ] Mediator tests covering removed event functionality deleted
  • [ ] All existing tests pass
  • [ ] Manual verification (with screenshots) that application boots and content viewers load correctly

AI usage

This issue was drafted with Claude Code (Opus) based on codebase analysis of Vue 3 migration blockers, identifying the pluginMediator event bus as dead code blocking the migration.

rtibbles avatar Apr 05 '26 16:04 rtibbles

Plan: Replace the new Vue() event dispatcher in pluginMediator.js with simple callbacks/promises, removing all dead event infrastructure and unblocking the Vue 3 migration.

  • [ ] Update the test file — remove dead tests, add behavior tests
  • [ ] Rewrite pluginMediator.js
  • [ ] Remove emit and stopListening from KolibriModule
  • [ ] /simplify pass

status


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Apr 05 '26 18:04 rtibblesbot