feat(export-report-pdf): migrate connector to manager-supported mode (#7221) - #7337
feat(export-report-pdf): migrate connector to manager-supported mode (#7221)#7337Hugo Dupras (jabesq) wants to merge 8 commits into
Conversation
…-supported mode (#7221)
|
The following packages appear to be unused:
|
There was a problem hiding this comment.
Pull request overview
Migrates the internal-export-file/export-report-pdf connector to connectors-sdk/Pydantic-based settings so it can run in connector-manager–supported mode, while keeping the existing connector logic largely intact.
Changes:
- Introduces
ConnectorSettings(connectors-sdkBaseConnectorSettings) and wiresOpenCTIConnectorHelpercreation viato_helper_config(). - Refactors the connector to read configuration from namespaced settings (
config.export_report_pdf.*) and removes the legacyConnectorConfig. - Adds/updates unit tests and generates manager-oriented metadata (
connector_config_schema.json,CONNECTOR_CONFIG_DOC.md), and marks the connector asmanager_supported.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal-export-file/export-report-pdf/src/export_report_pdf/settings.py | Adds Pydantic/connectors-sdk settings models for connector + connector-specific config. |
| internal-export-file/export-report-pdf/src/main.py | Builds helper config via ConnectorSettings.to_helper_config(). |
| internal-export-file/export-report-pdf/src/export_report_pdf/connector.py | Switches config access to config.export_report_pdf.* and updates typing. |
| internal-export-file/export-report-pdf/src/export_report_pdf/config.py | Removes legacy YAML/env parsing config class. |
| internal-export-file/export-report-pdf/src/requirements.txt | Adds connectors-sdk + pydantic requirements. |
| internal-export-file/export-report-pdf/src/config.yml.sample | Normalizes sample config with required vs defaulted values. |
| internal-export-file/export-report-pdf/src/init.py | Re-exports ConnectorSettings. |
| internal-export-file/export-report-pdf/tests/test_main.py | Adds wiring tests for settings → helper → connector instantiation. |
| internal-export-file/export-report-pdf/tests/export_report_pdf/test_config.py | Adds settings validation/defaulting tests. |
| internal-export-file/export-report-pdf/tests/export_report_pdf/test_connector.py | Updates tests to use ConnectorSettings and new config layout. |
| internal-export-file/export-report-pdf/tests/export_report_pdf/conftest.py | Updates config fixture to align with new settings expectations. |
| internal-export-file/export-report-pdf/metadata/connector_manifest.json | Sets manager_supported: true. |
| internal-export-file/export-report-pdf/metadata/connector_config_schema.json | Adds generated JSON schema for manager-supported env vars. |
| internal-export-file/export-report-pdf/metadata/CONNECTOR_CONFIG_DOC.md | Adds generated configuration documentation. |
| internal-export-file/export-report-pdf/README.md | Points configuration documentation to generated metadata doc. |
Suppressed comments (3)
internal-export-file/export-report-pdf/tests/export_report_pdf/test_config.py:79
- This
_load_config_dictoverride returns a validatedConnectorSettingsinstance fromhandler(...), not a dict. Updating the return annotation avoids confusion when reading these tests and aligns with the connectors-sdk validator signature.
@classmethod
def _load_config_dict(cls, _, handler) -> dict[str, Any]:
return handler(
internal-export-file/export-report-pdf/tests/export_report_pdf/test_config.py:209
- The
_load_config_dictoverride returns a validated settings instance (viahandler(...)), not a dict. The current return type annotation is misleading and should be updated to match what the function actually returns.
class FakeConnectorSettings(ConnectorSettings):
@classmethod
def _load_config_dict(cls, _, handler) -> dict[str, Any]:
return handler(settings_dict)
internal-export-file/export-report-pdf/tests/export_report_pdf/test_config.py:148
- The
_load_config_dictvalidator override returns the validated settings model fromhandler(settings_dict). The declared return typedict[str, Any]is inaccurate here and should reflect that a settings instance is returned.
class FakeConnectorSettings(ConnectorSettings):
@classmethod
def _load_config_dict(cls, _, handler) -> dict[str, Any]:
return handler(settings_dict)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @classmethod | ||
| def _load_config_dict(cls, _, handler) -> dict[str, Any]: | ||
| return handler( |
| @@ -0,0 +1,24 @@ | |||
| # Connector Configurations | |||
|
|
|||
| Below is an exhaustive enumeration of all configurable parameters available, each accompanied by detailed explanations of their purposes, default behaviors, and usage guidelines to help you understand and utilize them effectively. | |||
| @classmethod | ||
| def _load_config_dict(cls, _, handler) -> dict[str, Any]: | ||
| return handler( |
Proposed changes
docker-compose.yml,config.yml.sampleandsrc/requirements.txt(required vars uncommented asChangeMe, defaulted vars commented out)to_helper_config()manager_supported: truein the connector manifest__metadata__/connector_config_schema.jsonandCONNECTOR_CONFIG_DOC.mdconnector.ida unique UUIDv4 default (the SDK declares it required with no default)connector.pyandtests/test_main.pyat the renamed settings moduleRelated issues
Checklist
Further comments
Structure-preserving ("lite") migration: the file layout, class names, scheduling
mechanism and logging are unchanged. Configuration now flows through validated
Pydantic settings, which is what makes the connector manager-supported — it is not
yet "verified"; that broader pass is tracked separately.
Validation: isort, black,
flake8 --ignore=E,Wand the custom STIX-ID pylint checker(10.00/10) all pass; 15 unit tests pass. Regenerating the config schema produces no
diff against the committed version.