-
Notifications
You must be signed in to change notification settings - Fork 1
support error in session state machine apply command #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds error handling support to the session state machine's applyCommand method. Commands can now fail with user-defined errors, which are cached to maintain idempotency semantics.
Key changes:
- Introduces a new type parameter
Eacross the session state machine APIs to represent error types - Updates the cache schema to store
Either[E, R]instead of justR, allowing both successful responses and errors to be cached - Adds a new
RequestError.UserError(e: E)case to represent command execution failures
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/package.scala |
Adds error type parameter to StateWriter and RequestError; updates schema types |
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/SessionStateMachine.scala |
Implements error handling in handleClientRequest to cache and return errors |
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/SessionCommand.scala |
Adds E type parameter to command types |
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/ScodecSerialization.scala |
Updates type signatures with error parameter |
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/Codecs.scala |
Updates codec signatures for new type parameter |
session-state-machine/src/test/scala/**/*.scala |
Updates test files with Nothing error type and adds new error caching test |
kvstore/src/main/scala/zio/kvstore/*.scala |
Updates KV store implementation to use Nothing error type |
.specify/templates/plan-template.md |
Unrelated documentation update for project workflow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/SessionStateMachine.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/package.scala
Show resolved
Hide resolved
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/package.scala
Outdated
Show resolved
Hide resolved
…ine/package.scala Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 21 comments.
Comments suppressed due to low confidence (1)
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/package.scala:200
- The type parameter order
Schema[E, R, SR, UserSchema]is inconsistent withSessionSchema[R, SR, E]. For better clarity and consistency, consider reordering toSchema[R, SR, E, UserSchema]to match the parameter order of SessionSchema.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/IdempotencySpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/IdempotencySpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/ResponseCachingSpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/IdempotencySpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/IdempotencySpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/CumulativeAckSpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/IdempotencySpec.scala
Outdated
Show resolved
Hide resolved
session-state-machine/src/test/scala/zio/raft/sessionstatemachine/IdempotencySpec.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
session-state-machine/src/main/scala/zio/raft/sessionstatemachine/package.scala
Outdated
Show resolved
Hide resolved
…ine/package.scala Co-authored-by: Copilot <[email protected]>
No description provided.