Skip to content

Fix :Add deprecation warning for prefect integration#937

Merged
VaibhavUpreti merged 1 commit intoTracer-Cloud:mainfrom
IBOCATA:patch-1
Apr 27, 2026
Merged

Fix :Add deprecation warning for prefect integration#937
VaibhavUpreti merged 1 commit intoTracer-Cloud:mainfrom
IBOCATA:patch-1

Conversation

@IBOCATA
Copy link
Copy Markdown

@IBOCATA IBOCATA commented Apr 25, 2026

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

Added deprecation warning for the prefect integration module.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 25, 2026

Greptile Summary

This PR attempts to deprecate app/integrations/clients/prefect/ by introducing a proxy __init__.py that re-exports PrefectClient from a new app/services/prefect/client.py location and emits a DeprecationWarning on import. However, the new app/services/prefect/ module was never created and is not included in this PR, making the proxy immediately broken.

  • P0 – ModuleNotFoundError on every import: from app.services.prefect.client import PrefectClient (line 11) references a module path that does not exist; any import of app.integrations.clients.prefect — including both Prefect tools — raises ModuleNotFoundError at startup.
  • P1 – Tool imports not updated: Both PrefectFlowRunsTool and PrefectWorkerHealthTool still import from the deprecated path, contradicting the PR description.
  • P1 – Incomplete proxy: Only PrefectClient is proxied from the new path; PrefectConfig and make_prefect_client (used by the tools) remain tied to the old client.py.

Confidence Score: 2/5

Not 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

Filename Overview
app/integrations/clients/prefect/init.py Adds a deprecation proxy that imports from a non-existent module (app.services.prefect.client), causing ModuleNotFoundError on any import; also has duplicate binding of PrefectClient, missing re-exports of PrefectConfig/make_prefect_client, and wrong import ordering.

Sequence Diagram

sequenceDiagram
    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
Loading

Comments Outside Diff (2)

  1. app/integrations/clients/prefect/__init__.py, line 3-11 (link)

    P1 Duplicate PrefectClient binding — old import silently shadowed

    Lines 3–7 import PrefectClient from app.integrations.clients.prefect.client (the original location), and then line 11 re-imports a different PrefectClient from app.services.prefect.client, overwriting the first name. If the two classes ever diverge, callers that import PrefectClient from this package would silently get the service-path version while PrefectConfig and make_prefect_client still come from the old path, creating a split-source package with inconsistent types. The old imports on lines 3–7 should be removed once the service-path module is created.

  2. app/tools/PrefectFlowRunsTool/__init__.py, line 7 (link)

    P1 Tool still imports from deprecated path — deprecation warning fires on every startup

    The PR description states "Updated Tool Imports for PrefectFlowRunsTool and PrefectWorkerHealthTool to use the new canonical service location," but this file (and PrefectWorkerHealthTool/__init__.py line 7) still imports from app.integrations.clients.prefect. As long as these tools use the old path, every process startup will trigger the DeprecationWarning, and the tools will also be broken by the missing app.services.prefect module.

Reviews (1): Last reviewed commit: "Add deprecation warning for prefect inte..." | Re-trigger Greptile

Comment thread app/integrations/clients/prefect/__init__.py
Comment thread app/integrations/clients/prefect/__init__.py
Comment thread app/integrations/clients/prefect/__init__.py
Copy link
Copy Markdown
Author

@IBOCATA IBOCATA left a comment

Choose a reason for hiding this comment

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

Peer to peer comment dev

Comment thread app/integrations/clients/prefect/__init__.py
Comment thread app/integrations/clients/prefect/__init__.py
Comment thread app/integrations/clients/prefect/__init__.py
@VaibhavUpreti VaibhavUpreti merged commit af9b680 into Tracer-Cloud:main Apr 27, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the Prefect client under app/services/ and keep compatibility imports

2 participants