chore: add lifecycle client and shutdown aborted notifications#3163
chore: add lifecycle client and shutdown aborted notifications#3163ivankalinovski wants to merge 4 commits intomainfrom
Conversation
Add LifecycleClient for the ingest lifecycle API and notify aborted resyncs on graceful shutdown when transform is enabled. Wire is_transform_enabled, sync/mixin and settings changes, and tests for the client, organization mixin, and transform flag. Made-with: Cursor
Review Summary by QodoAdd lifecycle client and transform feature support for resync notifications
WalkthroughsDescription• Add LifecycleClient for resync lifecycle event notifications • Integrate transform feature flag checks with graceful shutdown handling • Add TransformSettings configuration with enabled toggle and base_url • Notify lifecycle API on resync started, finished, failed, and aborted states • Add comprehensive tests for lifecycle client and transform feature detection Diagramflowchart LR
A["LifecycleClient"] -->|"POST /v1/lifecycle"| B["Lifecycle API"]
C["Ocean App"] -->|"notify_started/finished/failed/aborted"| A
D["TransformSettings"] -->|"enabled + base_url"| C
E["is_transform_enabled()"] -->|"checks org flags + local config"| F["Feature Decision"]
F -->|"true"| C
G["Graceful Shutdown"] -->|"notify_aborted"| A
File Changes1. port_ocean/clients/lifecycle.py
|
Code Review by Qodo
1. Lifecycle URL miswired
|
| self.lifecycle_client: LifecycleClient = LifecycleClient( | ||
| base_url=str(self.config.port.ingest_url), | ||
| auth=self.port_client.auth, | ||
| ) |
There was a problem hiding this comment.
1. Lifecycle url miswired 🐞 Bug ≡ Correctness
Ocean initializes LifecycleClient with config.port.ingest_url, ignoring the newly added transform.base_url setting, so lifecycle notifications will be sent to the Port ingest endpoint rather than the intended lifecycle/transform service. This breaks lifecycle reporting even when transform is enabled.
Agent Prompt
## Issue description
`LifecycleClient` is currently initialized with `config.port.ingest_url`, but the PR introduces `config.transform.base_url` and the feature is described as offloading lifecycle events to a transform/lifecycle service. As-is, lifecycle POSTs will go to the wrong host/path.
## Issue Context
- `TransformSettings.base_url` is added but never used.
- Port ingest URLs are often integration-specific (`metricAttributes.ingestUrl`) rather than the global default.
## Fix Focus Areas
- port_ocean/ocean.py[108-114]
- port_ocean/config/settings.py[84-87]
## Suggested fix
- Initialize `LifecycleClient` with `base_url=str(self.config.transform.base_url)` when provided.
- If you need a fallback, make it explicit (e.g., fallback to `metricAttributes.ingestUrl` fetched from Port, or disable lifecycle reporting when `transform.base_url` is missing).
- Consider updating `is_transform_enabled()` to also require `transform.base_url` if lifecycle reporting cannot function without it.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/25130334734/artifacts/6716596690Code Coverage Total Percentage:
|
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/25130668983/artifacts/6716747312Code Coverage Total Percentage:
|
Code Coverage Artifact 📈: https://github.com/port-labs/ocean/actions/runs/25130718095/artifacts/6716757340Code Coverage Total Percentage:
|
Add LifecycleClient for the ingest lifecycle API and notify aborted resyncs on graceful shutdown when transform is enabled. Wire is_transform_enabled, sync/mixin and settings changes, and tests for the client, organization mixin, and transform flag.
Made-with: Cursor
Description
What -
Why -
How -
Type of change
Please leave one option from the following and delete the rest:
All tests should be run against the port production environment(using a testing org).
Core testing checklist
Integration testing checklist
examplesfolder in the integration directory.Preflight checklist
Screenshots
Include screenshots from your environment showing how the resources of the integration will look.
API Documentation
Provide links to the API documentation used for this integration.