Skip to content

Fix swapped labels in the command type mismatch message - #97

Merged
slinkydeveloper merged 1 commit into
restatedev:mainfrom
SciMigo:fix/type-mismatch-message-labels
Sep 21, 2026
Merged

slinkydeveloper merged 1 commit into
restatedev:mainfrom
SciMigo:fix/type-mismatch-message-labels

Conversation

@thinkinginmath

Copy link
Copy Markdown
Contributor

Fixes #96.

CommandTypeMismatchError printed the handler's command as what the previous execution recorded, and the recorded command as what the current execution attempts.

Every caller constructs the error with the recorded command as actual and the handler's command as expected:

  • RawMessage::decode_to, which PopJournalEntry uses during replay;
  • the lazy and eager state replay paths.

This PR swaps the two arguments in Display and documents the fields. No caller changes.

Test

journal_mismatch::command_type_mismatch_names_recorded_and_attempted_commands replays a recorded Run at index 1 while the handler writes output, then checks both labels in the emitted ErrorMessage.

  • Before the change: it fails with the swapped message: recorded the following: 'handler return' (index '1') / attempts to perform the following: 'run'.
  • After the change: it passes.

Checks run locally

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --workspace -- -D warnings, with default features and with --all-features
  • cargo test: 256 library tests pass with default features, 259 with --all-features.

tests/bootstrap.rs fails locally only because protoc isn't installed; it fails the same way on main, and this change doesn't touch the protocol.

CommandTypeMismatchError printed the handler's command as what the
previous execution recorded, and the recorded command as what the
current execution attempts. Its callers construct it with the recorded
command as `actual` and the handler's command as `expected`
(RawMessage::decode_to during replay, and the lazy/eager state replay
paths), so swap the two arguments in Display and document the fields.

The regression test replays a recorded Run at index 1 while the handler
writes output, and checks both labels in the ErrorMessage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@thinkinginmath

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@slinkydeveloper

Copy link
Copy Markdown
Collaborator

Thanks

@slinkydeveloper
slinkydeveloper merged commit 511152b into restatedev:main Sep 21, 2026
5 of 6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 21, 2026
@thinkinginmath
thinkinginmath deleted the fix/type-mismatch-message-labels branch September 22, 2026 00:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Journal mismatch message swaps "previous" and "current" when the command types differ

2 participants