refactor(integrations): hoist delivery-readiness helpers into platform/scheduler (#4164)#4187
Conversation
Greptile code reviewThis repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md. Run a review — add a PR comment with: Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5. Optional: automate with the greploop skill. |
Greptile SummaryThis PR hoists the delivery-readiness helpers out of the Sentry-owned
Confidence Score: 5/5Safe to merge — pure structural refactor with no logic modifications and full backward compatibility preserved through the re-export shim. All five delivery-readiness functions are faithfully reproduced in the new canonical module, the shim correctly delegates to them, and the previous comment about missing shim test coverage has been addressed. No logic was changed, no imports were broken, and monkeypatch targets in the test suite now point to the correct canonical location. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Consumer (e.g. digest_prerequisites.py)
participant S as integrations/sentry/digest_delivery.py (shim)
participant P as platform/scheduler/delivery_readiness.py (canonical)
participant CR as platform/scheduler/credentials.py
Note over S,P: Before this PR: logic lived only in the shim
Note over S,P: After this PR: shim re-exports canonical
C->>P: from platform.scheduler.delivery_readiness import delivery_provider_ready
P->>CR: resolve_telegram_credentials / resolve_slack_credentials
CR-->>P: credentials dict
P-->>C: bool (ready)
Note over S: Legacy consumers still work
C->>S: from integrations.sentry.digest_delivery import telegram_delivery_ready
S->>P: re-exports (same object)
P-->>C: bool (ready)
Reviews (3): Last reviewed commit: "test(shim): assert __all__ parity betwee..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR refactors the scheduled digest/report delivery-readiness helpers into a vendor-neutral module under platform/scheduler/, so multiple integrations (e.g., Sentry and others) can share the same Telegram/Slack readiness logic without introducing vendor-to-vendor imports.
Changes:
- Added
platform/scheduler/delivery_readiness.pyas the canonical implementation for Telegram/Slack delivery-readiness checks and setup hints. - Updated Sentry prerequisites and tests to import/monkeypatch the new canonical module.
- Converted
integrations/sentry/digest_delivery.pyinto a backward-compatibility re-export shim.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
platform/scheduler/delivery_readiness.py |
New canonical, provider-neutral delivery readiness + setup hint helpers. |
integrations/sentry/digest_delivery.py |
Re-export shim pointing to the canonical platform/ implementation. |
integrations/sentry/digest_prerequisites.py |
Switched imports to platform.scheduler.delivery_readiness. |
tests/integrations/sentry/test_digest_delivery.py |
Updated imports and monkeypatch paths to target the new canonical module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if name == Provider.SLACK.value: | ||
| return ( | ||
| "Slack is not configured for delivery. Run " | ||
| "`opensre integrations setup slack` or set SLACK_WEBHOOK_URL / SLACK_BOT_TOKEN." |
…e test, mention SLACK_ACCESS_TOKEN in hint
|
Addressed all review feedback:
@greptile review |
|
@greptile review |
Refs #4164
Description
Move the cross-cutting delivery-readiness helpers from
integrations/sentry/digest_delivery.pytoplatform/scheduler/delivery_readiness.pyso no vendor owns them and both Sentry and PostHog can consume them from a neutral location.Changes:
platform/scheduler/delivery_readiness.pywith the canonical implementationintegrations/sentry/digest_delivery.pyto a thin re-export shim for backward compatibilityintegrations/sentry/digest_prerequisites.pyto import fromplatform/Testing
pytest tests/integrations/sentry/test_digest_delivery.py— all 4 tests passruff checkpassesCode Understanding and AI Usage
Implementation approach: Moved helpers to
platform/scheduler/delivery_readiness.py(sibling tocredentials.py). Kept the original file as a re-export shim so any existing consumer that imports fromintegrations.sentry.digest_deliverystill works. Updateddigest_prerequisites.pyto import from the new canonical location directly.Checklist before requesting a review