Traced event-store registration duplicates services and overrides existing registrations
Los mantenedores suelen responder en 7 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 10/100
Línea de trabajo
Read StoreRegistrationTests.cs in src/Extensions/test/Eventuous.Tests.DependencyInjection, especially the tracing-enabled cases for repeated registrations and explicit overrides. The issue reports an implementation already committed locally on fix/issue-608-store-registrations, so check that branch and commit df3dbe48 before starting. Done means the acceptance criteria pass, including append/read behavior, both tracing modes, and all 31 DI project tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Related test issue
Discovered while implementing #608 — event-store dependency injection coverage.
Problem
With tracing enabled, both overloads of AddEventStore<T> use unconditional AddSingleton calls for the traced store and its interface registrations. Calling the registration method repeatedly adds duplicate service descriptors. Calling it after explicitly registering IEventStore, IEventReader, or IEventWriter replaces the service returned by normal single-service resolution.
This differs from the tracing-disabled path's TryAddSingleton behavior. Enabling diagnostics can therefore change service selection and route writes to a different backing store.
Reproduction
Repeated registration
- Enable diagnostics, preserving the previous setting for restoration afterward.
- Call
services.AddEventStore<InMemoryEventStore>()twice and build a host. - Resolve
GetServices<IEventWriter>(),GetServices<IEventReader>(), andGetServices<IEventStore>().
Actual: each enumeration contains duplicate registrations.
Expected: repeating the default registration leaves one registration per interface.
Explicit service overrides
- Register an existing store instance explicitly as
IEventStore,IEventReader, andIEventWriter. - Call
services.AddEventStore<InMemoryEventStore>()with tracing enabled. - Build the host and append an event through its resolved
IEventWriter. - Read the stream through the explicitly registered instance.
Actual: the explicit instance has no such stream; the later registration selected a different store.
Expected: default store registration preserves explicitly registered interfaces, consistently with tracing disabled.
Fix and acceptance criteria
- Use conditional registration for the traced store and interface aliases.
- Repeated generic and factory registrations do not add duplicate interface services.
- Existing interface registrations remain the services resolved by the host.
- An unused replacement factory is not invoked.
- Tests verify actual append/read behavior, in addition to service counts and identities.
- Test both tracing modes and restore the global diagnostics setting with parallel isolation.
Existing regression tests and implementation
StoreRegistrationTests.cs in src/Extensions/test/Eventuous.Tests.DependencyInjection contains RepeatedRegistrationKeepsOneServiceAndOneFactory and RegistrationPreservesExplicitInterfaceOverrides. Their tracing-enabled cases reproduced these failures before the fix.
An implementation is already committed locally on fix/issue-608-store-registrations, commit df3dbe48. It also fixes separate backing instances when tracing is disabled. The complete DI project passes all 31 tests on .NET 10 after both fixes. The branch has not been published or merged as part of this work.
- Lenguaje dominante
- C#
- Estrellas
- 512
- Forks
- 99
- Merge medio
- 5 d 6 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Eventuous/eventuous
-
MongoDB integration tests fail on newer GitHub Actions runner kernelsPosiblemente ocupada @nmummau la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Eventuous/eventuous#626 · 2 comentarios ·
Los mantenedores suelen responder en 7 días
-
`dotnet format style --verify-no-changes` fails with naming violations and unnecessary importsPosiblemente ocupada @nmummau la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Eventuous/eventuous#624 · 1 comentario ·
Los mantenedores suelen responder en 7 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Eventuous/eventuous#627 · 1 comentario ·
Los mantenedores suelen responder en 7 días
-
SQL Server: `append_events` does not need the `@inserted` table variablePosiblemente ocupada @nmummau la tomó hace 9 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 20/100
Eventuous/eventuous#619 · 1 comentario ·
Los mantenedores suelen responder en 7 días
-
SQL Server: stream reads do one key lookup per event, and `IDX_EventsStream` duplicates `UQ_StreamIdAndStreamPosition`Posiblemente ocupada @nmummau la tomó hace 9 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 18/100
Eventuous/eventuous#618 · 1 comentario ·
Los mantenedores suelen responder en 7 días
Todos los issues de Eventuous/eventuous
Issues similares
-
dev/release: verify-release-candidate.sh runs 0 Java tests with Debian's MavenPosiblemente ocupada @kou la tomó hoy. AbiertoType: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/arrow-adbc#4947 ·
Los mantenedores suelen responder en 1 día
-
:watch: Not Triaged CAC
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/AspNetCore.Docs#38001 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Nimblesite/SharpLsp#468 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
elastic/ecs-dotnet#575 ·
-
V4 alert-rule reads have no scope gate, so any authenticated credential can list alert rulesAbiertoalerts bug effort:S P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
nightscout/nocturne#2511 ·
Los mantenedores suelen responder en 1 día