Repository navigation
fix: unify notification routing and preserve alert bodies #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -536,3 +536,22 @@ def _heartbeat_outcome_key(execution, *, skip_logs, note_logs) -> str: | |
| if bool(execution.get("direct_live_routing_blocked")): | ||
| return "heartbeat_execution_blocked" | ||
| return "no_executable_orders" if (skip_logs or note_logs) else "no_trades" | ||
|
|
||
|
|
||
| def render_runtime_error(*, kind="real_error", occurred_at=None, report=None, locale=None): | ||
| """Adapt runtime facts to the step-1 shared formatter; never render diagnostics. | ||
|
|
||
| The QPK step-1 revision must be pinned before deployment. Monitor time is | ||
| not a business-run observation; missing producer links/counts stay unknown. | ||
| """ | ||
| import os | ||
| from datetime import datetime, timezone | ||
| from quant_platform_kit.notifications.renderer_base import render_asset_management_error | ||
| from quant_platform_kit.notifications.unified_contract import NotificationEvent | ||
|
Comment on lines
+549
to
+550
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the repository's ordinary frozen dependencies, this import fails because the new renderer API is unavailable in the QPK revision still pinned by Useful? React with 👍 / 👎. |
||
|
|
||
| report = report or {} | ||
| stamp = occurred_at or datetime.now(timezone.utc) | ||
| event = NotificationEvent(kind, stamp, platform_id="longbridge", | ||
| strategy_profile=report.get("strategy_profile"), | ||
| incident_reason=kind) | ||
| return render_asset_management_error(event, locale=locale or os.environ.get("NOTIFY_LANG") or "zh-CN") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a quote lookup, purchase-quantity estimate, or order-status poll raises, its caller passes the exception details to this notifier without logging them separately (
safe_quote_last_price,estimate_cash_buy_quantity_safe, andmonitor_submitted_order_status). The previousbuild_issue_notifierprinted the title and detail through its publisher's logging sink; this replacement discards both arguments and only sends a generic error body. Consequently, these failures now lose their exception message or traceback entirely, even when notification delivery succeeds. Keep the sanitized notification body, but preserve the diagnostic information in the restricted logging path before sending it.Useful? React with 👍 / 👎.