Skip to content

Conversation

@somdoron
Copy link
Contributor

No description provided.

@somdoron somdoron requested a review from keisar November 11, 2025 08:52
Copilot finished reviewing on behalf of somdoron November 11, 2025 09:43
Copy link
Contributor

Copilot AI left a 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 E across the session state machine APIs to represent error types
  • Updates the cache schema to store Either[E, R] instead of just R, 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.

@somdoron somdoron requested a review from Copilot November 12, 2025 08:50
Copilot finished reviewing on behalf of somdoron November 12, 2025 08:57
Copy link
Contributor

Copilot AI left a 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 with SessionSchema[R, SR, E]. For better clarity and consistency, consider reordering to Schema[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.

@somdoron somdoron requested a review from Copilot November 12, 2025 10:27
Copilot finished reviewing on behalf of somdoron November 12, 2025 10:30
Copy link
Contributor

Copilot AI left a 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.

@somdoron somdoron merged commit e6f1617 into unit-finance:main Nov 12, 2025
1 check passed
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