Skip to content

feat: let a host wait for its own write - #212

Merged
yesbert merged 3 commits into
mainfrom
feature/let-a-host-wait-for-its-own-write
Oct 23, 2026
Merged

yesbert merged 3 commits into
mainfrom
feature/let-a-host-wait-for-its-own-write

Conversation

@yesbert

@yesbert yesbert commented Oct 23, 2026

Copy link
Copy Markdown
Owner

What this changes

A host can take a mark of the streams it just wrote and wait only for the partitions those streams fall into, rather than for the projection to catch up with the whole store.

  • IProjectionProgress.MarkAsync(IEnumerable<Guid> streamIds, CancellationToken) (new overload). It returns the committed head of each touched partition and 0 for every other partition. WaitAsync already treats a partition at 0 as reached, so it needs no change, and a partition that lags or is stopped elsewhere does not hold the wait up. Within a touched partition the reader still passes every earlier entry, as it has to.
  • The default interface implementation answers the whole-store mark, which covers more. An implementation of the interface outside the framework therefore keeps compiling and keeps the promise.
  • Docs: Read your own write (projection guide) takes the stream mark in its example, and names the whole-store mark for decisions that span streams. Also updated: the cost note in the operations guide, llms.txt, and CHANGELOG.md.

The first commit archives let-heavy-work-wait-without-losing-attempts (#211).

Implements the OpenSpec change let-a-host-wait-for-its-own-write (approved). It adds A host can wait until a projection has applied its own write to orleans-execution.

Why

A consumer (finding SF-011) waits after setting a connection. With the whole-store mark, that wait grows with unrelated write traffic, and at its bound the consumer answers without the guarantee. The narrower mark was listed as deferred when the wait shipped in 4.4.6.

How it was verified

  • Stratara.Testing.Orleans.Tests (SQLite, portable reader):

    • a mark of the host's stream is reached while a projection is stopped in another partition, and the whole-store mark in the same situation answers Stalled, naming that partition;
    • a mark of a stream with nothing committed is reached at once.
  • Stratara.Orleans.IntegrationTests (PostgreSQL, native reader): the same own-write-versus-stopped-partition case, plus the existing progress tests. 4/4 pass.

  • ./scripts/local-gauntlet.sh passes

Copilot AI balanced review requested due to automatic review settings October 23, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yesbert

yesbert commented Oct 23, 2026

Copy link
Copy Markdown
Owner Author

Copilot could not review this PR because the quota is exhausted, so a local review at high stood in for it. The review confirmed that the partition mapping matches the store, the dispatcher and the PostgreSQL reader. Findings and how each was handled:

  1. The ADDED requirement would have contradicted the existing one ("in every partition") after archiving. Fixed: the delta now modifies A host can wait until a projection has applied what was committed. The whole-store mark constrains every partition, and a mark of streams constrains only theirs.
  2. "A stream with nothing committed is reached at once" holds only when its partition is empty. Fixed: the scenario now says streams in partitions nothing was committed to.
  3. The tests would not catch a mark that constrains the wrong partition, or none. Fixed: both tests assert that the mark constrains the written stream's partition and no other, and that the write is in the read model.
  4. An empty set silently gave an all-zero mark, which reads as reached. Fixed: it is refused with ArgumentException (A_mark_of_no_stream_is_refused).
  5. The guide over-promised for the same partition. Fixed: within the stream's partitions, another stream's slow or stopped entry still holds the wait up.
  6. The XML docs named only the whole-store mark, and the example used it. Fixed: both overloads are named, and the example takes the stream mark.
  7. The mark-building code was duplicated. Fixed: one shared builder.
  8. The stream-to-partition expression is repeated in several places. Kept: lifting it into a new public PartitionMap member would be API for an internal convenience.
  9. The refusing projection was registered for every PostgreSQL progress test. Fixed: only the test that passes refused streams registers it.
  10. The proposal is "approved" in the same commit as the code. It was approved by the owner in the working session before implementation, after being presented as proposed. The status line records that approval. It was not flipped after the fact.

Unit 11/11, documentation 792/792, PostgreSQL progress 4/4, gauntlet green.

@yesbert
yesbert merged commit 678f62a into main Oct 23, 2026
6 checks passed
@yesbert
yesbert deleted the feature/let-a-host-wait-for-its-own-write branch October 23, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants