Skip to content

GetStreamMetadataAsync returns a null Tags dictionary, but StreamMetadata.Tags is declared non-nullable #412

Description

@jeremydmiller

Found by the new EventStoreExplorerCompliance suite (JasperFx.Events.ComplianceTests, compliance wave 5 — marten#5146).

IEventStore.GetStreamMetadataAsync(streamId, ct) returns a StreamMetadata whose Tags property is null.

JasperFx.Descriptors.StreamMetadata declares it as a non-nullable positional parameter:

public sealed record StreamMetadata(
    ...
    IReadOnlyDictionary<string, string> Tags);

So null is a contract violation rather than a legitimate "this stream has no tags" answer — an empty dictionary is how that is spelled. Any consumer that trusts the declaration and enumerates Tags gets a NullReferenceException instead of an empty loop. Marten returns a non-null dictionary here.

Repro

var metadata = await store.As<IEventStore>().GetStreamMetadataAsync(streamId.ToString(), ct);
metadata.Tags.ShouldNotBeNull(); // fails on Polecat

Current state

Gated in the compliance suite behind EventStoreComplianceFixture.SupportsStreamMetadataTags, which PolecatComplianceFixture overrides to false with a pointer to this issue. The gate is temporary and tracked — the assertion stays.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions