Repository navigation
refactor(alerts): drop fetch from AlertRuntime, use the runtime HttpClient - #1261
Merged
Merged
Maple Review Bot / Maple / review
succeeded
Oct 5, 2026 in 4m 32s
Confidence 4/5 · No issues found
🟢 Confidence 4/5 · likely safe to merge
Every production hunk is a semantics-preserving swap of the raw fetch for the ambient client, and all call sites and fake-fetch wirings were updated together.
quality 100/100 · no findings · tests covered · risk low · 2/3 new units observable
Removes the raw fetch from AlertRuntime and routes alert delivery, Telegram verification and the PagerDuty key check through the runtime HttpClient (fake wire injected as FetchHttpClient.Fetch). The refactor is equivalent in behavior; nothing here needs changing before merge.
dispatchDeliveryandTransportRuntimedropfetchFn; delivery uses the ambientHttpClienttelegramGetreplaces raw fetch and suppresses the client span for the token-bearing URLverifyPagerDutyRoutingKeyposts viaHttpClientRequest/HttpClient.executeAlertRuntimeApilosesfetch; tests injectFetchHttpClient.Fetchinstead
What was checked
telegramGetkeeps old semantics:okfromstatus >= 200 && < 300(telegram.ts:157) equals fetch'sresponse.ok, and the timeout still wraps each discovery callHttpClient.TracerDisabledWhenprovided around the call is the repo's established pattern (apps/cli/src/commands/server.ts:499,lib/safe-fetch/src/index.ts:235,runTransport.ts:139), so the bot…- Body reads stay in the request continuation (
telegram.ts:155,pagerduty.ts:108), matchingElectricClient.ts:271and the CLI, so no scope-closed read
Observability coverage: 2 of 3 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
| Telegram Bot API GET (getMe/getChat/getUpdates) via HttpClient | outbound call | no | Client span deliberately suppressed via HttpClient.TracerDisabledWhen at telegram.ts:163 — bot token is in the URL path |
| PagerDuty routing-key verification POST via HttpClient | outbound call | yes | pagerduty.ts:91-101 now emits the client span for the fixed vendor host (routing key is in the body) |
| Alert delivery provider sends via HttpClient | outbound call | yes | runTransport.ts:133 keeps the AlertDelivery.http client span with peer.service; only the per-send FetchHttpClient.Fetch override was removed |
1b9274f · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Loading