Skip to content

fix: PR C — operational (round 4, bugs 7/10/12)#80

Merged
telivity-otaip merged 1 commit into
mainfrom
fix/pr-c-operational
Apr 18, 2026
Merged

fix: PR C — operational (round 4, bugs 7/10/12)#80
telivity-otaip merged 1 commit into
mainfrom
fix/pr-c-operational

Conversation

@telivity-otaip
Copy link
Copy Markdown
Collaborator

Summary

Third of 4 PRs from round-4 codex review. Operational correctness.

# Severity Bug Fix
7 HIGH Outbound webhook delivery not implemented HMAC-signed POST with DB-backed retry + exponential backoff
10 HIGH `push-schema.ts` missing agent + 3 other tables 7 tables + 7 enums synced to bootstrap script
12 MEDIUM Agent config/decision mutations unaudited auditLogs row on updateConfig/approveDecision/rejectDecision

Notes

  • BullMQ deferred: Redis/BullMQ isn't wired up in this repo. Used brief's explicit fallback: DB-backed `webhook_deliveries` table + `setInterval` scanner (30s) + 5-attempt exponential backoff. Swap to BullMQ when Redis module lands.
  • push-schema.ts is still not a real migration strategy — long-term it should be replaced with Drizzle migrations. This PR brings it back in sync with schema.

Test plan

  • `pnpm build` green
  • `pnpm typecheck` green
  • `pnpm test` — 562/562 (+9 new: webhook delivery, agent audit, handleEvent enqueue)

🤖 Generated with Claude Code

Bug 7 (HIGH): outbound webhook delivery not implemented
- New webhook_deliveries table (id, subscriptionId, eventType, payload,
  status, attempts, nextRetryAt, lastStatusCode, lastError, etc.)
- WebhookDeliveryService: async POST with HMAC-SHA256 signature,
  X-HAIP-Signature/Event-Id/Event-Type headers, 5s timeout
- Exponential backoff 30s/2m/10m/1h/6h (5 attempts)
- In-process setInterval scanner (30s) re-processes pending retries
- GET /connect/subscriptions/:id/deliveries for observability
- BullMQ deferred — Redis not wired up, pragmatic fallback per brief

Bug 10 (HIGH): push-schema.ts missing tables
- Added: agent_configs, agent_decisions, agent_training_snapshots,
  tax_profiles, tax_rules, guest_reviews, webhook_deliveries
- Enums: agent_type, agent_mode, agent_decision_status, tax_rule_type,
  review_source, review_response_status, webhook_delivery_status
- Long-term: replace push-schema.ts with real Drizzle migrations

Bug 12 (MEDIUM): agent config mutations unaudited
- updateConfig writes audit_logs row with per-field diff (isEnabled, mode,
  autopilotConfidenceThreshold, config), no-op changes skipped
- approveDecision, rejectDecision also audited with actor from @currentuser
- Reused existing auditLogs table; no new schema

562/562 tests passing (+9), build + typecheck clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@telivity-otaip telivity-otaip merged commit 4b0c14c into main Apr 18, 2026
2 of 3 checks passed
@telivity-otaip telivity-otaip deleted the fix/pr-c-operational branch April 18, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant