Skip to content

Improve plugin install/init error handling #1239

@pggdev

Description

@pggdev

SUMMARY

Make plugin installation and event handling safer by isolating plugin failures and using one consistent plugin:error payload across the runtime.

SCOPE

  • Plugin registration/install failure isolation

  • Event listener failure isolation during dispatch

  • Standardized plugin:error payload (additive, non-breaking)

  • Replace index-based plugin event usage with explicit constants

  • Tests for all above runtime error paths

  • Integration-layer alignment to avoid inconsistent/duplicate error emission

TASKS

Add failure-first tests for plugin runtime behavior

  • Add test: plugin install() throws, manager still works

  • Add test: failed plugin is not stored

  • Add test: healthy plugin still registers after a failed one

  • Add test: plugin:error is emitted with expected fields

  • Add test: if one listener throws during emit(), other listeners still run

Define canonical PluginErrorPayload (additive type)

  • include: source, phase, pluginName, message, cause, recoverable, timestamp (+ optional eventName)

Replace index-based plugin error event usage

  • add explicit plugin event constants

  • remove runtime dependence on PLUGINEVENTS[1]

Harden PluginManager error boundaries

  • wrap plugin.install(api) in try/catch

  • emit canonical plugin:error on install failure

  • register plugin only after successful install

  • guard each listener invocation during emit() and continue dispatch

Align Standalone.tsx error emission

  • avoid duplicate plugin:error emission for the same failure path

I'm happy to open a PR for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions