这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Add CommonRulesPropertyClient C++ Implementation

This PR ports the missing CommonRulesPropertyClient class from the Kotlin implementation to C++ and fixes the uninitialized property_rules_ member in PropertyClientFacade.

Changes Made

New Files Created

  • include/midi-ci/properties/PropertyCommonRules.hpp - Constants and structures for MIDI-CI property handling
  • include/midi-ci/properties/CommonRulesPropertyHelper.hpp - Helper class for JSON header creation and parsing
  • include/midi-ci/properties/CommonRulesPropertyClient.hpp - Main client class implementing MidiCIClientPropertyRules interface
  • src/midi-ci/properties/CommonRulesPropertyHelper.cpp - Implementation of helper functionality
  • src/midi-ci/properties/CommonRulesPropertyClient.cpp - Implementation of the property client

Modified Files

  • src/midi-ci/properties/PropertyClientFacade.cpp - Initialize property_rules_ with CommonRulesPropertyClient
  • src/CMakeLists.txt - Added new source and header files to build system
  • src/midi-ci/messages/Message.cpp - Fixed JSON serialization bug affecting property tests

Implementation Details

The C++ implementation closely mirrors the Kotlin version's structure and functionality:

  • PropertyCommonRules.hpp: Contains all constants, header keys, status codes, and resource names from the Kotlin version
  • CommonRulesPropertyHelper: Provides utility functions for creating JSON headers, parsing property identifiers, and encoding/decoding bodies
  • CommonRulesPropertyClient: Implements the MidiCIClientPropertyRules interface with all 8 required virtual methods

The implementation uses existing C++ JSON utilities and follows modern C++ conventions with smart pointers and RAII principles.

Bug Fixes

Fixed a JSON serialization bug in Message.cpp where get_serialized_bytes() was double-escaping JSON strings. This was causing property JSON serialization tests to fail.

Testing

  • All code compiles successfully without errors
  • 37 out of 38 tests now pass (significant improvement from 34 passing before)
  • The 3 property JSON serialization tests that were previously failing now pass
  • Only 1 unrelated JSON test remains failing (pre-existing issue)

Verification

The PropertyClientFacade now properly initializes the property_rules_ member with a working CommonRulesPropertyClient implementation, resolving the core issue described in the task.


Link to Devin run: https://app.devin.ai/sessions/b6c66f486eb14a8890d611d305e3f787

Requested by: Atsushi Eno (atsushieno@gmail.com)

- Port CommonRulesPropertyClient from Kotlin to C++
- Add PropertyCommonRules.hpp with all constants and structures
- Add CommonRulesPropertyHelper for JSON header creation and parsing
- Implement CommonRulesPropertyClient with MidiCIClientPropertyRules interface
- Fix PropertyClientFacade to initialize property_rules_ with default implementation
- Fix JSON serialization bug in Message.cpp affecting property tests
- Update CMakeLists.txt to include new source and header files

This resolves the missing CommonRulesPropertyClient class that was causing
uninitialized property_rules_ in PropertyClientFacade. The C++ implementation
now matches the Kotlin version's functionality for MIDI-CI property handling.

Co-Authored-By: Atsushi Eno <atsushieno@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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