Skip to content

feat(proofpoint-et-reputation): migrate connector to manager-supported mode (#6768)#6779

Open
jabesq wants to merge 9 commits into
masterfrom
feat/6768-migrate-proofpoint-et-reputation
Open

feat(proofpoint-et-reputation): migrate connector to manager-supported mode (#6768)#6779
jabesq wants to merge 9 commits into
masterfrom
feat/6768-migrate-proofpoint-et-reputation

Conversation

@jabesq

@jabesq jabesq commented Jun 19, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Replaced legacy get_config_variable / config_variables.py configuration with Pydantic ConnectorSettings class (src/connector/settings.py) for type-safe, validated configuration management
  • Refactored connector class to accept (config, helper) dependency injection pattern, decoupling configuration parsing from connector logic
  • Removed dead code: config_variables_models.py, config_variables.py, and empty src/__init__.py
  • Updated main.py entry point to use the new manager-supported bootstrap flow
  • Added typing overloads to Utils.get_now for improved type safety
  • Added comprehensive unit tests (test_main.py, test_settings.py) and fixed existing test infrastructure (switched to pytest-mock, updated conftest fixtures)
  • Set manager_supported: true in connector_manifest.json and generated connector_config_schema.json + CONNECTOR_CONFIG_DOC.md
  • Added pyproject.toml with uv build system and updated config.yml.sample for the new configuration structure
  • Updated docker-compose.yml environment variables to align with new settings model

Related issues

Checklist

  • I consider the submitted work as finished
  • I have signed my commits using GPG key.
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

This PR migrates the Proofpoint ET Reputation connector to the manager-supported pattern using the connectors-sdk. The migration follows the standard approach:

  1. Pydantic settings (ConnectorSettings extending BaseConnectorSettings) replace manual get_config_variable calls — providing validation, type coercion, and automatic schema generation.
  2. Config + helper injection — the connector class now receives a typed config object and a pre-configured helper instance, making it fully testable without environment manipulation.
  3. Manager-supported manifest — setting manager_supported: true enables the platform to manage connector lifecycle, provide config UIs via the generated JSON schema, and render documentation from CONNECTOR_CONFIG_DOC.md.

The test suite validates both the settings layer (env parsing, defaults, validation) and the main entry point bootstrap logic.

Copilot AI review requested due to automatic review settings June 19, 2026 10:37
@jabesq jabesq added the filigran team Item from the Filigran team. label Jun 19, 2026
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 10 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ternal-import/proofpoint-et-reputation/src/main.py 0.00% 6 Missing ⚠️
...roofpoint-et-reputation/src/connector/connector.py 63.63% 4 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (879d6ea) and HEAD (0ecab44). Click for more details.

HEAD has 119 uploads less than BASE
Flag BASE (879d6ea) HEAD (0ecab44)
connectors 123 4
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6779       +/-   ##
===========================================
- Coverage   33.27%    0.40%   -32.88%     
===========================================
  Files        1993     1900       -93     
  Lines      122690   120062     -2628     
===========================================
- Hits        40829      487    -40342     
- Misses      81861   119575    +37714     
Files with missing lines Coverage Δ
...proofpoint-et-reputation/src/connector/__init__.py 100.00% <100.00%> (ø)
...int-et-reputation/src/connector/models/__init__.py 100.00% <ø> (ø)
...t-et-reputation/src/connector/services/__init__.py 100.00% <ø> (ø)
...et-reputation/src/connector/services/client_api.py 90.19% <100.00%> (ø)
...oint-et-reputation/src/connector/services/utils.py 52.38% <100.00%> (+5.01%) ⬆️
...proofpoint-et-reputation/src/connector/settings.py 100.00% <100.00%> (ø)
...roofpoint-et-reputation/src/connector/connector.py 23.20% <63.63%> (+5.01%) ⬆️
...ternal-import/proofpoint-et-reputation/src/main.py 0.00% <0.00%> (ø)

... and 1133 files with indirect coverage changes

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Proofpoint ET Reputation external-import connector to the connectors-sdk manager-supported pattern, replacing legacy config parsing with typed Pydantic settings and updating bootstrap/testing accordingly.

Changes:

  • Introduces ConnectorSettings (Pydantic, connectors-sdk) and refactors the connector to accept (config, helper) via dependency injection.
  • Updates the entrypoint to the manager-supported bootstrap flow and removes legacy config code.
  • Adds/updates unit tests and introduces pyproject.toml/uv.lock to support a modern dev workflow.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
external-import/proofpoint-et-reputation/uv.lock Adds uv lockfile for the connector’s dev environment (currently locks pytest/pytest-mock).
external-import/proofpoint-et-reputation/tests/test-requirements.txt Pins pytest + pytest-mock for connector tests.
external-import/proofpoint-et-reputation/tests/test_settings.py Adds settings validation tests for the new ConnectorSettings.
external-import/proofpoint-et-reputation/tests/test_main.py Adds bootstrap tests for settings/helper/connector instantiation.
external-import/proofpoint-et-reputation/tests/conftest.py Updates fixtures and client fixture to match new API token handling.
external-import/proofpoint-et-reputation/src/requirements.txt Adds connectors-sdk dependency to runtime requirements.
external-import/proofpoint-et-reputation/src/main.py Updates entrypoint to instantiate settings + helper, then inject into connector.
external-import/proofpoint-et-reputation/src/connector/settings.py Introduces typed connector + connector-specific configuration models.
external-import/proofpoint-et-reputation/src/connector/services/utils.py Adds overloads to Utils.get_now for better typing.
external-import/proofpoint-et-reputation/src/connector/services/config_variables.py Removes legacy YAML/env config parsing implementation.
external-import/proofpoint-et-reputation/src/connector/services/client_api.py Refactors API client to accept SecretStr token directly (no config object).
external-import/proofpoint-et-reputation/src/connector/services/init.py Updates exports after removing legacy config service.
external-import/proofpoint-et-reputation/src/connector/models/config_variables_models.py Removes legacy Pydantic config var model.
external-import/proofpoint-et-reputation/src/connector/models/init.py Updates exports after removing legacy config model.
external-import/proofpoint-et-reputation/src/connector/connector.py Refactors connector initialization and uses new settings fields for behavior.
external-import/proofpoint-et-reputation/src/connector/init.py Updates public exports to include ConnectorSettings.
external-import/proofpoint-et-reputation/src/config.yml.sample Updates sample YAML config to match the new settings structure.
external-import/proofpoint-et-reputation/src/init.py Removes empty package initializer.
external-import/proofpoint-et-reputation/pyproject.toml Adds pyproject (pytest config + dependency group) for modern tooling.
external-import/proofpoint-et-reputation/docker-compose.yml Updates env var examples for manager-supported settings.
external-import/proofpoint-et-reputation/metadata/connector_manifest.json Enables manager_supported: true.
external-import/proofpoint-et-reputation/metadata/connector_config_schema.json Adds generated JSON schema for manager UI/config validation.
external-import/proofpoint-et-reputation/metadata/CONNECTOR_CONFIG_DOC.md Adds generated connector config documentation.
Comments suppressed due to low confidence (2)

external-import/proofpoint-et-reputation/src/connector/services/client_api.py:75

  • connector_logger structured context should be passed using the meta= keyword (repository convention) rather than as a positional dict argument, to avoid ambiguity and keep calls consistent with other connectors.
            self.helper.connector_logger.error(
                "[CONNECTOR-API] Error occurred while building the query request.",
                {"error": str(e)},
            )

external-import/proofpoint-et-reputation/src/connector/connector.py:276

  • connector_logger.debug structured context should be passed using the meta= keyword (repository convention) rather than as a positional dict argument, to keep logging calls consistent and avoid confusion with printf-style args.
                self.helper.connector_logger.debug(
                    "[CONNECTOR] The creation of the entity was ignored due to your configuration of the min_score variable.",
                    {
                        "collection": collection,
                        "min_score_config": min_score,
                        "entity": model.value,
                        "entity_score": highest_score_converted,
                    },
                )

Comment thread external-import/proofpoint-et-reputation/src/connector/settings.py
Comment thread external-import/proofpoint-et-reputation/tests/conftest.py
Comment thread external-import/proofpoint-et-reputation/pyproject.toml
@jabesq jabesq force-pushed the feat/6768-migrate-proofpoint-et-reputation branch 3 times, most recently from d6af94c to b561d41 Compare June 19, 2026 14:02
@jabesq jabesq requested a review from Copilot June 19, 2026 14:03
@jabesq jabesq force-pushed the feat/6768-migrate-proofpoint-et-reputation branch from b561d41 to 0ecab44 Compare June 19, 2026 14:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.

Comment on lines +101 to +113
def test_settings_should_raise_when_invalid_input(settings_dict, field_name):
"""
Test that `ConnectorSettings` raises on invalid input.
"""

class FakeConnectorSettings(ConnectorSettings):
@classmethod
def _load_config_dict(cls, _, handler) -> dict[str, Any]:
return handler(settings_dict)

with pytest.raises(ConfigValidationError) as err:
FakeConnectorSettings()
assert str("Error validating configuration") in str(err)
from pathlib import Path
from unittest.mock import MagicMock

sys.path.append(str(Path(__file__).parent.parent / "src"))
Comment on lines 66 to 70
try:
return requests.Request(
"GET",
f"{self.base_url}{self.config.extra_api_token}/reputation/{reputation_list_entity}.json",
f"{self.base_url}{self.api_token.get_secret_value()}/reputation/{reputation_list_entity}.json",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Proofpoint): migrate connectors to the catalog

3 participants