Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Polecat/DocumentStore.EventStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,18 @@ Task IEventStore.CompactStreamAsync(string streamKey, CancellationToken token)

// Event-type registry — populates the explorer's "known event types"
// panel without forcing operators to crack open assembly metadata.
//
// #411: BOTH collections have to be filled. EventStoreUsage carries the event registry
// twice — Events (List<EventDescriptor>) and RegisteredEventTypes
// (List<EventTypeDescriptor>) — and Marten populates both. Filling only
// RegisteredEventTypes left usage.Events empty, which reads to a consumer as "this store
// has no event types configured" rather than "this store describes them elsewhere".
foreach (var registered in Options.EventGraph.AllKnownEventTypes())
{
usage.Events.Add(new EventDescriptor(
registered.EventTypeName,
TypeDescriptor.For(registered.EventType)));

usage.RegisteredEventTypes.Add(new EventTypeDescriptor(
EventType: TypeDescriptor.For(registered.EventType),
Alias: registered.EventTypeName,
Expand Down
15 changes: 14 additions & 1 deletion src/Polecat/Events/Internal/PcStreamsRowReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,20 @@

/// <summary>
/// Read the row the reader is positioned on into a
/// <see cref="StreamMetadata"/>. <paramref name="firstEventAt"/> comes

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / build

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / test (edge) / test

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / test (edge) / test

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / test (default) / test

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / test (default) / test

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / test (edge) / test

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name

Check warning on line 108 in src/Polecat/Events/Internal/PcStreamsRowReader.cs

View workflow job for this annotation

GitHub Actions / test (default) / test

XML comment on 'PcStreamsRowReader.EmptyTags' has a paramref tag for 'firstEventAt', but there is no parameter by that name
/// from a JOIN against <c>pc_events</c> (not part of <c>pc_streams</c>
/// itself); when it's <see langword="null"/> the row's own <c>created</c>
/// column is used as the fallback, mirroring the pre-consolidation
/// behavior in <c>DocumentStore.GetStreamMetadataAsync</c>.
/// </summary>
/// <summary>
/// Shared empty tag set for <see cref="StreamMetadata.Tags"/>. Polecat does not persist
/// DCB stream tags yet, so every row reports the same immutable empty dictionary rather
/// than allocating one per stream.
/// </summary>
private static readonly IReadOnlyDictionary<string, string> EmptyTags =
new Dictionary<string, string>();

internal static StreamMetadata ReadStreamMetadata(
DbDataReader reader,
string defaultTenantId,
Expand All @@ -134,7 +142,12 @@
LastSnapshotVersion: null,
IsArchived: isArchived,
TenantId: tenantId,
Tags: null!);
// #412: an empty dictionary, never null. StreamMetadata.Tags is declared as a
// non-nullable IReadOnlyDictionary, so "this stream has no tags" is spelled with an
// empty collection -- a null forces every consumer that trusts the declaration into a
// NullReferenceException instead of an empty loop. The `null!` that used to be here
// silenced the compiler's warning rather than answering it.
Tags: EmptyTags);
}

private static string StreamIdToString(object value) => value switch
Expand Down
Loading