Traced event-store registration duplicates services and overrides existing registrations
Maintainer thường phản hồi trong vòng 7 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 10/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 512
- Fork
- 99
- Merge trung bình
- 5 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Eventuous/eventuous
-
MongoDB integration tests fail on newer GitHub Actions runner kernelsCó thể đã có người làm @nmummau đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Eventuous/eventuous#626 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
-
`dotnet format style --verify-no-changes` fails with naming violations and unnecessary importsCó thể đã có người làm @nmummau đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Eventuous/eventuous#624 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Eventuous/eventuous#627 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
-
SQL Server: `append_events` does not need the `@inserted` table variableCó thể đã có người làm @nmummau đã nhận 10 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
Eventuous/eventuous#619 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
-
SQL Server: stream reads do one key lookup per event, and `IDX_EventsStream` duplicates `UQ_StreamIdAndStreamPosition`Có thể đã có người làm @nmummau đã nhận 10 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 18/100
Eventuous/eventuous#618 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 7 ngày
Tất cả issue của Eventuous/eventuous
Issue tương tự
-
dev/release: verify-release-candidate.sh runs 0 Java tests with Debian's MavenCó thể đã có người làm @kou đã nhận hôm nay. Đang mởType: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/arrow-adbc#4947 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/fluentui-blazor#5535 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
AvaloniaUI/Avalonia#22582 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
:watch: Not Triaged CAC
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/AspNetCore.Docs#38001 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
HTTP logging truncates catch-all route parameters in the formatted request pathCó thể đã có người làm @johnkaram02 đã nhận hôm nay. Đang mởarea-telemetry untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
dotnet/extensions#7883 ·
Maintainer thường phản hồi trong vòng 1 ngày