Skip to content

fix(infra): one warehouse env for every querying Worker, and small Worker fixes - #2441

Merged
Makisuo merged 17 commits into
fix/audit-ingest-walfrom
fix/audit-worker-env
Nov 10, 2026
Merged

Makisuo merged 17 commits into
fix/audit-ingest-walfrom
fix/audit-worker-env

Merge branch 'fix/audit-ingest-wal' into fix/audit-worker-env

4ed7f94
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 10, 2026 in 2m 12s

Confidence 9/10 · No issues found

🟢 Confidence 9/10 · safe to merge. The warehouse env merge only shows on a real deploy; the status cache change is pinned by three new tests.
no findings · tests partial −1 · risk medium

Consolidates the five warehouse keys into clickhouseEnv bound to the API, alerting and AI Workers, caches a KV host miss in the status Worker, shares queue retry limits, and drops a dead email flag, three consumer shims and the v1 Electric shape. Safe to merge. Neither open McpQueryError nor CancellationReviewError issue is addressed by this diff.

  • clickhouseEnv binds CLICKHOUSE_URL to the alerting and AI Workers
  • pageIdForHost caches a KV host miss for 30 seconds
  • Queue retry limits move into one queue-retry-limits module
  • The v1 alert_destinations Electric shape is retired

Before merge

  • Infra · Check every environment has what this config now expects · alchemy.run.ts
  • Manual · Every stage that sets CLICKHOUSE_URL must let the ai and alerting Workers reach that endpoint

Production impact

Open errors in the changed files (3)
Issue Service Occurrences File
@maple/mcp/errors/McpQueryError (2 issues) maple-chat 6 apps/electric-sync/src/shapes/registry.ts
@maple/mcp/errors/McpQueryError (7 issues) maple-ai 21 apps/electric-sync/src/shapes/registry.ts
@maple/backend/cancellation-review/CancellationReviewError maple-cancellation-reviews 3 apps/api/src/cancellation-review-runtime.ts

After this merges, Maple checks whether they stop.

Production traffic of the changed files (last 7 days)
File Calls/day Busiest operations
apps/api/src/audit-events-runtime.ts 108k WarehouseQueryService.ingest 55k/day, 0.0% err
WarehouseQueryService.ingest 40k/day, 0.0% err
WarehouseQueryService.ingest 12k/day, 0.0% err
packages/backend/src/platform/EmailService.ts 221 EmailService.send 221/day, 0.4% err
What was checked
  • Traced resolveTarget: a cached host miss still falls through to /s/<slug> (handler.ts:33)
  • Grep at head: nothing reads MAPLE_EMAIL_ALLOW_NONPROD or the v1 alert_destinations shape
  • merge spreads nested record configs, so clickhouseEnv lands exactly as the api's five keys did

4ed7f94 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.