This repository was archived by the owner on Jul 10, 2026. It is now read-only.
Sprint 2: religa o dispatcher de webhooks aos eventos de domínio - #112
Merged
Conversation
O crate `webhooks` (dispatcher HMAC + retry) existia mas era orfao — nunca linkado ao `api`, entao nenhum webhook era disparado. Agora: - `api` depende do crate `webhooks`; AppState ganha `webhooks: WebhookDispatcher` (construido em main.rs com WebhookStore sobre o PgPool; worker em background) - dispatch fire-and-forget nos eventos: - chat_created (routes/chats.rs::create) - chat_completed (routes/chats.rs::send_message) - document_uploaded (routes/documents.rs::upload) - training_feedback (routes/training.rs::approve) - payloads minimos com IDs (consumidor busca detalhes); workspace_id como String Verificacao local: cargo build/clippy -D warnings limpos. Teste e2e novo (webhooks/tests/dispatch_e2e.rs): insere um webhook inscrito em chat_created, dispara o evento e confirma que o receiver HTTP local recebe um POST assinado (X-Webhook-Signature) com o tipo do evento — passa contra o Postgres local. Pendente (fora deste commit): retry_webhook_delivery (admin_service.rs:793) enfileirar no dispatcher; dispatch no caminho de streaming (tarefa spawnada). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AcsaeS7c9zJ4vkNtxqBcnc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Webhooks deixam de ser órfãos — agora disparam de verdade
O crate
webhooks(dispatcher com HMAC + retry em background) existia mas nunca era linkado aoapi, então nenhum webhook era disparado apesar de a UI/CRUD existirem. Esta PR fecha esse gap.Mudanças
apipassa a depender do cratewebhooks;AppStateganhawebhooks: WebhookDispatcher(construído emmain.rscomWebhookStoresobre oPgPool; worker roda em background)chat_created—routes/chats.rs::createchat_completed—routes/chats.rs::send_messagedocument_uploaded—routes/documents.rs::uploadtraining_feedback—routes/training.rs::approveVerificação local
cargo build -p api✓ ·cargo clippy -p api -- -D warnings✓webhooks/tests/dispatch_e2e.rs): insere um webhook inscrito emchat_created, dispara o evento e confirma que um receiver HTTP local recebe um POST assinado (X-Webhook-Signature) com o tipo do evento — passa contra o Postgres local. Prova o caminho fim-a-fim (store query → entrega → assinatura).Fora de escopo (anotado no roadmap)
retry_webhook_delivery(admin_service.rs:793) enfileirar no dispatcher🤖 Generated with Claude Code
Generated by Claude Code