Repository navigation
[Alertas] ADR y clase EventBus local (#77) - #83
Merged
Merged
Conversation
- docs/adr/0001: event naming, delivery semantics, persistence, actor and security rules - #lib/server/events: typed InProcessEventBus (async, per-subscriber ordering, isolated handlers, drain), RecordingEventBus for tests, HMR-safe singleton - request context carries userId / apiKeyId so events resolve their actor - CLAUDE.md: Domain events section Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #77 · Parte de #76
Qué incluye
docs/adr/0001-event-bus-and-alerts.md: convención de nombres, semántica de entrega (asíncrona, at-most-once, por proceso), persistencia, actor y reglas de seguridad (puntos 1.1–1.5). Queda como Proposed hasta aprobarlo en esta review.#lib/server/events:InProcessEventBus:publish()no espera a los handlers, orden por suscriptor (un suscriptor lento no retrasa a los demás), cada handler aislado en sutry/catchcon log detype/id, ydrain()que también espera a los eventos publicados desde handlers.RecordingEventBuspara tests de servicios.globalThis, para que el HMR no lo duplique.userIdyapiKeyId/apiKeyProjectId(se rellenan enhooks.server.ts); el bus resuelve el actor a partir de ahí. A GitDB solo le lleganname/email.CLAUDE.md: sección "Domain events".Tests
19 tests en
event-bus.test.ts, que cubren todos los criterios de aceptación. Sin dependencias nuevas.bun run check✅bun run test✅bun run lint: los ficheros nuevos pasan. El lint global ya fallaba antes de este PR (apps/ignorado por git y 5 errores ensrc/).🤖 Generated with Claude Code