Skip to content

perf(backend): batch digest and push writes, read in parallel, share parsers, delete dead code - #2444

Merged
Makisuo merged 18 commits into
fix/audit-agent-runtimefrom
perf/audit-backend-services
Nov 10, 2026
Merged

Makisuo merged 18 commits into
fix/audit-agent-runtimefrom
perf/audit-backend-services

Merge branch 'fix/audit-agent-runtime' into perf/audit-backend-services

0d1d10a
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 10, 2026 in 2m 39s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. Batched writes and the org purge are pinned by new PGlite tests; the three concurrency edits only reorder independent reads. (The kickoff's "changed since then" list named files this diff does not con…
no findings · tests covered · risk high

Batches the daily membership sweep and the device push stamp into multi-row writes, runs three groups of independent reads concurrently, and purges fix-verification rows with the org. The new writes and the purge are exercised by tests; no correctness, scoping or data-loss defect found.

  • reconcileSubscriptions upserts 500 members at a time, deduped by (org, user)
  • markPushed stamps every device id in one IN (...) UPDATE
  • ErrorIssueVerifications moves into the org-delete purge
  • getBearerToken and parseIngestKeyEncryptionKey collapse to one copy each

Production impact

Production traffic of the changed files (last 7 days)
File Calls/day Busiest operations
packages/backend/src/services/digest/DigestService.ts 1.4k Clerk.organizations.getOrganizationMembershipList 1.2k/day, 0.0% err
Clerk.organizations.getOrganizationMembershipList 141/day, 0.0% err
packages/backend/src/services/integrations/scrape-check-retention.ts 76 ScrapeCheckRetention.pruneForTargets 76/day, 0.0% err
What was checked
  • Dedup keyed ${orgId}:${userId} in a Map, so the last entry wins and no statement touches a row twice (DigestService.ts:962)
  • markPushed keeps orgId in the WHERE; the new test pins a foreign device id leaving its row untouched
  • Deleted alert-templates/, captureReusableContext and the two GitHub types have no remaining references at the head

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