Skip to content

Lift CompactStreamAsync<T> onto the shared operations surface, then a stream-compacting compliance suite #5153

Description

@jeremydmiller

Part of #5118 (compliance wave growth), epic #5110. Cross-repo: the first half targets jasperfx.

Stream compacting is implemented in both products with the same signature over the same shared request type, but declared on each product's own operations interface rather than on JasperFx's:

Declaration
shared today JasperFx.Events/Protected/StreamCompactingRequest.cs:71StreamCompactingRequest<T> is already a JasperFx type
Marten Marten.Events.IEventStoreOperations.CompactStreamAsync<T>(Guid|string, Action<StreamCompactingRequest<T>>?) (Marten/Events/EventStore.StreamCompacting.cs:35)
Polecat Polecat.Events.IEventOperations.CompactStreamAsync<T>(Guid|string, Action<StreamCompactingRequest<T>>?) (Polecat/Events/IEventOperations.cs:61)

JasperFx.Events.IEventStore.CompactStreamAsync(Guid\|string, CancellationToken) exists but is the store-level, non-generic, no-configuration form — and on Marten both overloads reflect back onto the generic method rather than being the real entry point. It is not what the tests exercise.

Part 1 (jasperfx): lift the generic method

Declare CompactStreamAsync<T>(Guid id, Action<StreamCompactingRequest<T>>? configure = null) and the string overload on the shared JasperFx.Events.IEventStoreOperations. Both products already have the exact signature, so adoption is deleting a declaration, not writing an implementation. Confirm this is additive on both sides before shipping — it is a source-breaking change if either product's method differs in optionality or return type.

Part 2 (compliance): the suite

Once the method is shared, StreamCompactingCompliance is portable with no fixture change.

Marten tests today Polecat tests today
Aggregation/stream_compacting.cs Events/stream_compacting_tests.cs
  1. Compacting collapses events below the compaction point into a snapshot event and leaves the aggregate's folded state unchanged
  2. AggregateStreamAsync after compaction equals the pre-compaction result
  3. FetchStreamAsync returns the compacted shape; FetchStreamStateAsync still reports the true version
  4. Compacting an already-compacted stream
  5. Compacting a stream with an inline snapshot registered keeps the document consistent
  6. Guid and string stream identity

Acceptance

  • jasperfx: method lifted, JasperFxVersion bumped in the same PR (the --skip-duplicate publish trap), both products adopt
  • Suite enrolled in both stores; originals retired in both repos

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