Coverage for src / documint_mcp / connectors / base.py: 0%

4 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-30 22:30 -0400

1"""Abstract base class for notification connectors.""" 

2 

3from __future__ import annotations 

4 

5from abc import ABC, abstractmethod 

6 

7from documint_mcp.models import DriftFinding, DocPatch, VerificationRun 

8 

9 

10class ConnectorBase(ABC): 

11 """Interface that every notification connector must implement. 

12 

13 Each method receives structured domain objects and is responsible for 

14 formatting and delivering a notification appropriate to the target 

15 channel (Slack, email, webhook, etc.). 

16 

17 All methods are async and must be non-blocking. Implementations 

18 should swallow transport errors internally so that a single 

19 connector failure never disrupts the pipeline. 

20 """ 

21 

22 @abstractmethod 

23 async def send_drift_alert( 

24 self, 

25 project_id: str, 

26 findings: list[DriftFinding], 

27 ) -> None: 

28 """Notify the channel that new drift findings have been detected.""" 

29 

30 @abstractmethod 

31 async def send_patch_preview( 

32 self, 

33 project_id: str, 

34 patch: DocPatch, 

35 ) -> None: 

36 """Post a patch diff preview, typically as a thread reply.""" 

37 

38 @abstractmethod 

39 async def send_digest( 

40 self, 

41 project_id: str, 

42 report: VerificationRun, 

43 ) -> None: 

44 """Deliver a periodic summary of documentation health."""