Skip to content

[Brook] Added stream errors and Core's failure kinds. - #115

Closed
moetemp wants to merge 20 commits into
moe/brook/p2b-records-wirefrom
moe/brook/p2c-errors-cursors
Closed

moetemp wants to merge 20 commits into
moe/brook/p2b-records-wirefrom
moe/brook/p2c-errors-cursors

Conversation

@moetemp

@moetemp moetemp commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR adds the stream error family and maps each of Core's failure kinds to it.

  • StreamRefusedError is for a write the store refused, and StreamStorageError is for a store that failed. StreamOutcomeUnknownError sits under the storage error.
  • error_from_failure maps each StreamFailure kind to its class. A kind this release doesn't know is a storage error.
  • StreamRecordError carries the cursor of a record a reader can't decode.
  • BEGINNING and END are the only cursors lang names. Core mints and checks every other one.

Why?

Core reports one kind per failure, so every SDK raises the same error for the same failure (DD-21). A record skipped with a log line is data the reader never hears of.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

tests/contrib/streams/test_errors_cursors.py. A new kind in Core fails the mapping test first.

moetemp added 15 commits October 9, 2026 14:56
Errors tell a refused write from one with an unknown outcome, and expired
cursors from invalid ones. A cursor names its stream, so a provider can
refuse one from another stream.
# Conflicts:
#	temporalio/contrib/streams/__init__.py
#	tests/contrib/streams/test_records_wire.py
A caller must tell a write the store refused from a store that failed,
and the store's own exceptions must not leak, so both get a StreamError
family that the specific errors join.
Skipping it with a log warning lost data the reader never heard of. The error carries the cursor, so a caller can resume past it on purpose.
Core reports every failed stream call as one failure kind, so each kind maps to the error a caller catches. Cursors are Core's tokens now, and lang keeps only the two a read starts from.
The two need different fixes, and parsing the message was the only way to tell them apart.
@moetemp
moetemp marked this pull request as draft October 12, 2026 06:58
Core now tells a call-input mistake apart from a store refusal. ValueError is the SDK's class for a bad argument, so a caller can catch the two apart.

(cherry picked from commit d5acb48)
@moetemp moetemp closed this Oct 13, 2026
@moetemp moetemp reopened this Oct 13, 2026
@moetemp moetemp added the skip-changelog Changelog entry rides another PR label Oct 13, 2026
@moetemp

moetemp commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

Replaced by Brook #151. Brook was split in two: Brook now has streams with Activity and client publish and outside readers, and Ford has the Workflow Task publish path. The code is the same, re-cut into new branches.

@moetemp moetemp closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Changelog entry rides another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant