Fix serialization of LogLevelOrStdout to match deserialization#1258
Merged
haixuanTao merged 3 commits intomainfrom Dec 13, 2025
Merged
Fix serialization of LogLevelOrStdout to match deserialization#1258haixuanTao merged 3 commits intomainfrom
LogLevelOrStdout to match deserialization#1258haixuanTao merged 3 commits intomainfrom
Conversation
In 40de6a2#diff-9503d86f1f775fbb8657d29e9e692c96d5227828367fdd3e05ca08fb6becb28fR89-R111 , the derived `Deserialize` implementation was replaced with a custom one, which doesn't match the `Serialize` implementation. This led to deserialization errors when sending log messages from the daemon to the coordinator. This commit fixes the issue by removing the enum tagging for the `LogLevel` variant, thereby matching the `Deserialize` implementation again. Serialization before: ```json "level": { "LogLevel": "INFO" } ``` Serialization after: ```json "level": "INFO" ```
To avoid similar errors in the future. By deriving the traits, we can be sure that the `Serialize` and `Deserialize` impls are always compatible. Note that the `Deserialize` impl for `LogLevel` [1] is calling the `FromStr` implementation [2], which ignores case. So deserializing 'INFO', 'info', and 'InFO' will all still work. The `stdout` variant needs to match exactly, but this is a custom extension of ours, so we can ensure to use lowercase everywhere. [1]: https://docs.rs/log/latest/src/log/serde.rs.html#61 [2]: https://docs.rs/log/latest/src/log/lib.rs.html#517-525
haixuanTao
approved these changes
Dec 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In 40de6a2#diff-9503d86f1f775fbb8657d29e9e692c96d5227828367fdd3e05ca08fb6becb28fR89-R111 , the derived
Deserializeimplementation was replaced with a custom one, which doesn't match theSerializeimplementation. This led to deserialization errors when sending log messages from the daemon to the coordinator.This commit fixes the issue by removing the enum tagging for the
LogLevelvariant, thereby matching theDeserializeimplementation again.Serialization before:
Serialization after: