Fix :Add deprecation warning for prefect integration#937
Fix :Add deprecation warning for prefect integration#937VaibhavUpreti merged 1 commit intoTracer-Cloud:mainfrom
Conversation
Added deprecation warning for the prefect integration module.
Greptile SummaryThis PR attempts to deprecate
Confidence Score: 2/5Not safe to merge — the PR introduces a hard ModuleNotFoundError that breaks both Prefect tools at import time. The single changed file introduces a direct import from a module path (app.services.prefect.client) that does not exist in the repository, causing a P0 crash on every startup for any code importing app.integrations.clients.prefect. The refactoring is also incomplete: the tools were not updated and the proxy is missing two of the three exported names. app/integrations/clients/prefect/init.py is critically broken. The missing app/services/prefect/client.py must be created, and both Prefect tool init.py files must be updated as part of this PR. Important Files Changed
Sequence DiagramsequenceDiagram
participant Tool as PrefectFlowRunsTool / PrefectWorkerHealthTool
participant OldInit as app.integrations.clients.prefect.__init__
participant OldClient as app.integrations.clients.prefect.client (exists ✓)
participant NewClient as app.services.prefect.client (MISSING ✗)
Tool->>OldInit: import make_prefect_client
OldInit->>OldClient: from .client import PrefectClient, PrefectConfig, make_prefect_client ✓
OldInit->>NewClient: from app.services.prefect.client import PrefectClient ✗
NewClient-->>OldInit: ModuleNotFoundError (module does not exist)
OldInit-->>Tool: ImportError propagated — tool fails to load
|
Refactored app/integrations/clients/prefect/ to serve as a deprecated proxy while moving the core logic to app/services/.
Fixes #897
Describe the changes you have made in this PR -
Relocated the PrefectClient from app/integrations/clients/prefect/client.py to app/services/prefect/client.py to align with the project's architectural standards.
Implemented a Proxy Pattern in the original location (app/integrations/clients/prefect/init.py) to maintain backward compatibility.
Added a Deprecation Warning that triggers when the old path is imported, guiding developers toward the new service path.
Updated Tool Imports for PrefectFlowRunsTool and PrefectWorkerHealthTool to use the new canonical service location.
Code Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?
[ ] No, I wrote all the code myself
[x] Yes, I used AI assistance (continue below)
If you used AI assistance:
[x] I have reviewed every single line of the AI-generated code
[x] I can explain the purpose and logic of each function/component I added
[x] I have tested edge cases and understand how the code handles them
[x] I have modified the AI output to follow this project's coding standards and conventions
Explain your implementation approach:
The goal was to move the Prefect client to the app/services/ directory without breaking existing tool integrations. I chose a "Move and Proxy" strategy. I physically moved the file to ensure the new directory structure is the "source of truth," then updated the original init.py to import the client from its new home.
I included warnings.warn with a DeprecationWarning and a stacklevel=2 to ensure that developers see exactly where in their code they are still using the outdated import path. This provides a non-breaking migration path while cleaning up the technical debt of misplaced API clients.
Checklist before requesting a review
[x] I have added proper PR title and linked to the issue
[x] I have performed a self-review of my code
[x] I can explain the purpose of every function, class, and logic block I added
[x] I understand why my changes work and have tested them thoroughly
[x] I have considered potential edge cases and how my code handles them
[x] If it is a core feature, I have added thorough tests
[x] My code follows the project's style guidelines and conventions