Skip to content

TieredEventStore reports existing streams as missing #612

Description

@nmummau

Related test issue

Discovered while implementing #609 — tiered event-store coverage.

Problem

TieredEventStore.StreamExists effectively requires a stream to exist in both the hot and archive stores. Streams that exist in only one tier are incorrectly reported as missing. Existence checks also fail to account for an archive exposed only through IEventReader, which the constructor accepts.

This makes the existence result inconsistent with readable data: an archived stream can still be read after hot-store deletion, yet StreamExists returns false.

Reproduction

  1. Create separate hot and archive InMemoryEventStore instances.
  2. Append events to a stream in only the hot store.
  3. Construct TieredEventStore(hot, archive) and call StreamExists for that stream.
  4. Repeat with events in only the archive store.

Actual: both single-tier cases return false.

Expected: a stream exists if either tier contains it.

Hot tier Archive tier Expected result
Missing Missing false
Present Missing true
Missing Present true
Present Present true

Fix and acceptance criteria

  • Return true when the hot store contains the stream, without requiring an archive lookup.
  • Otherwise check archive existence directly when it implements IEventStore.
  • For an archive implementing only IEventReader, establish existence with a bounded read according to that interface's missing-stream contract.
  • A successful empty read represents an existing empty stream; StreamNotFound represents absence.
  • Archive failures and cancellation propagate rather than being converted into false.
  • Dispose the archive enumerator and forward cancellation to the read.
  • Deleting the hot copy does not make an existing archive copy disappear from the existence result.
  • Preserve existing cross-tier read behavior and hot-only append, truncate, and delete behavior.

Existing regression tests and implementation

TieredEventStoreTests.cs in src/Core/test/Eventuous.Tests.Application reproduced five failing cases before the fix:

  • Hot-only stream existence.
  • Archive-only stream existence.
  • An existing stream in an archive exposed only as IEventReader.
  • An empty existing stream in a read-only archive.
  • Existence after deleting the hot copy while retaining the archive copy.

Additional tests cover archive failures, cancellation, an unavailable archive when the hot stream exists, bounded reads across tiers, and hot-only mutations.

An implementation is already committed locally on fix/issue-609-tiered-store, commit 1639f36c. All 36 tests in the application test project pass on .NET 10, including 15 tiered-store cases. The branch has not been published or merged as part of this work.

Activity

  1. linear commented on Oct 6, 2026

    @linear
  2. nmummau commented on Oct 6, 2026

    @nmummau
    ContributorAuthor

    I’ve implemented this locally with regression tests. I’m waiting for a prerequisite PR 603 to merge so I can rebase and open a focused PR. I’ll link it here once it’s ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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