fix(pgdog-plugin): api version check#770
Merged
levkk merged 4 commits intopgdogdev:mainfrom Feb 16, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
pgdog-plugin compatibility check
fixes #600
Adds a compatibility version check for plugins based on the
pgdog-plugincrate version. The implementation extracts and validates only the version ofpgdog-pluginsince it contains the definitions of the bridge layer between PgDog and plugins. Checking onlypgdog-pluginavoids tight coupling with the mainpgdogversion while still enabling a meaningful compatibility check.Highlights
Compatibility check
Added a new function
pgdog_plugin_api_versionto thePlugintrait and a corresponding verification step in the initialization code.For now, this check is not enforced to avoid breaking existing plugins. It can be enabled later to prevent loading older, incompatible plugins.
Integration tests
I added a couple of integration tests to verify the plugins behave as expected. The tests exercise different
pgdog-pluginversions (the local repo version, the crates.io version, and a main-branch/dev version) to exercise the compatibility checks and surface potential issues.Removed
pg_queryversion checkThere were no real checks for the
pg_queryversion despite documentation references, so I removed the separate crate and the export frompgdog-plugin. Thepg_queryversion is important, but the previous check was unused and ineffective.The current approach is to control the
pg_queryversion via thepgdog-plugincrate and rely on its versioning. We currently use a fork ofpg_querypinned by git revision rather than a crates.io version, so this central control makes the most sense.Cleanup and documentation
I updated documentation and cleaned up some plugin-related dependencies. I also added an LLM-generated doc section for the plugin which should help developers get started.
Future design
I explored the current approach and the challenges around enforcing Rust/Rustc compatibility. While most FFI types use
#[repr(C)], there are places that rely on Rust's ABI layout (for example,Vecand somepg_querystructures passed as raw pointers). Because of that, using the same Rust toolchain and dependency versions between host and plugin is sensible but it still does not fully guarantee ABI compatibility, especially when compilation flags differ.For a more robust future solution, consider using a crate like stabby to help enforce ABI compatibility between host and plugins. That approach could add stricter validations and reduce subtle runtime errors, but would likely require reworking parts of the plugin interface and some data representations (notably the
pg_query-related types).TODO
If merged, update the PgDog site documentation to reflect these changes.