Migrate Content Moderation plugin to cpex-content-moderation package#4481
Migrate Content Moderation plugin to cpex-content-moderation package#4481Lang-Akshay wants to merge 1 commit intomainfrom
Conversation
…d tests - Deleted the content moderation plugin manifest file. - Updated to remove references to the content moderation plugin and added a new entry for . - Added integration tests for the content moderation plugin's discoverability and management via the runtime plugin management API. - Updated performance tests to reflect the new plugin structure. - Removed outdated unit tests for the content moderation plugin and replaced them with new tests that align with the updated plugin architecture. - Adjusted configuration files to use the new plugin kind for content moderation. Signed-off-by: Lang-Akshay <[email protected]>
|
Thanks for this migration — the overall approach is clean and consistent with the existing cpex-* pattern. A few things worth addressing before merge: Requests for change1. Integration tests need a skip guard or CI confirmation
pytest.importorskip("cpex_content_moderation", reason="cpex-content-moderation not installed")2. Mode toggle tests have no state reset
3. Unused
|
Closes #4218
Summary
This PR resolves issue #4218 by migrating Content Moderation from the in-tree plugin implementation to the published PyPI package
cpex-content-moderation==1.0.0, consistent with the existing cpex-* migration pattern.It updates all plugin
kindreferences tocpex_content_moderation.ContentModerationPlugin, removes in-tree plugin code/tests now owned by the package, adds integration coverage for runtime discoverability and mode management, and introduces user-facing documentation for API-first dynamic configuration.What Changed
1) Packaging and dependency wiring
cpex-content-moderation>=1.0.0to plugin extras inpyproject.toml.cpex-content-moderationin[tool.uv.exclude-newer-package].uv.lockto includecpex-content-moderationand plugin extra resolution updates.2) Migration away from in-tree plugin code
plugins/content_moderation/README.mdplugins/content_moderation/TESTING.mdplugins/content_moderation/__init__.pyplugins/content_moderation/content_moderation.pyplugins/content_moderation/plugin-manifest.yamltests/unit/mcpgateway/plugins/plugins/content_moderation/test_content_moderation.pytests/unit/mcpgateway/plugins/plugins/content_moderation/test_content_moderation_integration.py3) Runtime/plugin config updates
Updated plugin
kindfrom:plugins.content_moderation.content_moderation.ContentModerationPluginto:
cpex_content_moderation.ContentModerationPluginin:
plugins/config.yamlplugins/config-pii-guardian-policy.yamltests/performance/plugins/config.yamltests/unit/mcpgateway/plugins/fixtures/configs/init_hooks_plugins_test.yaml4) Integration test coverage for dynamic discoverability
Extended
tests/integration/test_plugin_runtime_management.pywithTestContentModerationPluginDiscoverabilityto verify:GET /admin/pluginskindand expected hooksenforce,permissive,disabled) viaPUT /admin/plugins/ContentModeration5) Documentation updates
docs/docs/using/plugins/content-moderation.mdwith:docs/docs/using/plugins/.pages.docs/docs/using/plugins/plugins.mdto reference the PyPI package and typePackage.docs/docs/testing/unittest.md.6) Ancillary/non-functional edits in this branch
.secrets.baselinerefreshed to remove references to deleted in-tree content moderation files.mcpgateway/alembic/env.pymcpgateway/common/validators.pymcpgateway/main.pymcpgateway/services/audit_trail_service.pymcpgateway/transports/context.pymcpgateway/transports/streamablehttp_transport.pyIssue #4218 Acceptance Criteria Mapping
cpex-content-moderationadded and pinned in plugin dependency flow (pyproject.toml+uv.lock).plugins/content_moderation/removed from this repository.cpex_content_moderation.ContentModerationPlugin).Impact
cpex-content-moderationdirectly from PyPI.