feat(plugins): enforce dialog-vtable contract at plugin load time#77
Merged
facontidavide merged 1 commit intodevelopmentfrom Apr 29, 2026
Merged
Conversation
A plugin that advertises kCapabilityHasDialog (DataSource) or
kToolboxCapabilityHasDialog (Toolbox) but doesn't export a usable
dialog vtable is buggy. Previously the host catalog accepted such
plugins silently, and downstream consumers had to discover the
violation at use time — by which point the user is staring at
garbled curves with no diagnostic.
Move the check upstream: PluginRuntimeCatalog now calls
resolveDialogVtable() during loadAndRegister{DataSource,Toolbox}
when the capability bit is set, and refuses to register the plugin
if resolution fails. The reason (e.g. "PJ_get_dialog_vtable returned
null", "Dialog protocol version mismatch") is reported through the
existing DiagnosticSink as kError, so the marketplace UI can show
the plugin as broken.
The PJ4 host (`pj_app/src/DialogPresenter.cpp`) keeps its runtime
contract-violation path as defense-in-depth: any future ABI drift
between scanner and runtime, or a hypothetical hot-loaded plugin
that bypasses the catalog, still produces a sane error rather than
silent garbage.
Verified: clean build, 52/52 tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <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
kCapabilityHasDialog/kToolboxCapabilityHasDialogbut doesn't export a usable dialog vtable is buggy. Previously the host catalog accepted such plugins silently and the violation only surfaced at dialog-show time (by which point the user is staring at garbled curves with no diagnostic).PluginRuntimeCatalognow callsresolveDialogVtable()duringloadAndRegister{DataSource,Toolbox}when the capability bit is set, and refuses to register the plugin if resolution fails. The reason is reported through the existingDiagnosticSinkaskError, so the marketplace UI can show the plugin as broken.DialogPresenter) can keep a runtime contract-violation path as defense-in-depth against ABI drift or hot-loaded plugins that bypass the catalog.Test plan
PJ_get_dialog_vtable, assertingkErroremitted viaDiagnosticSink+ plugin absent from the loaded set (flagged as a follow-up; not blocking)🤖 Generated with Claude Code