feat: remove msgpack support and replace with JSON#120
Conversation
- Remove msgpack struct tags from all model files - Replace msgpack encoding/decoding with JSON in daemon socket communication - Update daemon client and handlers to use JSON marshaling - Remove model/msgpack.go file completely - Remove legacy SendHTTPRequest function from api.base.go - Update daemon/handlers_test.go to use JSON - Remove msgpack dependencies from go.mod This change standardizes the project to use JSON encoding throughout, making it more maintainable and aligning with common software development practices. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Le He <AnnatarHe@users.noreply.github.com>
Summary of ChangesHello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a significant refactoring effort to standardize the project's data serialization mechanism. By migrating entirely from Msgpack to JSON, the codebase becomes more consistent, easier to maintain, and aligns with widely adopted industry practices. This change impacts various components, from daemon communication to API models, ensuring a unified approach to data handling. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively replaces msgpack with JSON across the project, which is a great move for standardization and maintainability. The changes are applied consistently. I've identified an area for performance improvement in daemon/handlers.sync.go to avoid an unnecessary marshal/unmarshal cycle. Also, it seems model/msgpack_test.go was left behind and should be removed to prevent build failures. Other than that, the changes look good.
| pb, err := json.Marshal(socketMsgPayload) | ||
| if err != nil { | ||
| slog.Error("Failed to marshal the sync payload again for unmarshal", slog.Any("payload", socketMsgPayload)) | ||
| return err | ||
| } | ||
|
|
||
| var syncMsg model.PostTrackArgs | ||
| err = msgpack.Unmarshal(pb, &syncMsg) | ||
| err = json.Unmarshal(pb, &syncMsg) |
There was a problem hiding this comment.
This function marshals socketMsgPayload to JSON and then immediately unmarshals it back into syncMsg. This is an inefficient pattern involving an unnecessary serialization and deserialization cycle. Since socketMsgPayload is already a map[string]interface{} in memory after the initial JSON decoding, this double-conversion should be avoided.
A better approach would be to refactor the data handling. For instance, you could change SocketMessage.Payload in daemon/socket.go to be of type json.RawMessage. This would allow you to unmarshal the payload directly into the target model.PostTrackArgs struct in the handler, eliminating the intermediate marshaling step and improving performance.
Remove msgpack_test.go that was left behind after msgpack support was removed in commit 6a8229e. The msgpack functionality has been replaced with JSON. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Fixes #117
This PR removes msgpack support from the entire project and replaces it with JSON encoding.
Changes
This change standardizes the project to use JSON encoding throughout, making it more maintainable and aligning with common software development practices.
Generated with Claude Code