feat(client/codegen): C++ wire-contract header from the Python registry#270
Open
ryanontheinside wants to merge 1 commit into
Open
feat(client/codegen): C++ wire-contract header from the Python registry#270ryanontheinside wants to merge 1 commit into
ryanontheinside wants to merge 1 commit into
Conversation
…egistry
Add render_wire_types_hpp to gen_wire_types.py — a JSON-library-agnostic C++
projection of the same wire_contract() registry that backs the TypeScript
types. It emits string constants only (message "type" names, per-field JSON
keys, enum option values) under demon::wire::{command,event,config,handshake},
plus kProtocolVersion / kKnobSchemaVersion / kTypeKey. No structs, no JSON
dependency: a C++ client keeps its own (de)serialization and just references
the generated names.
main() now writes both the .ts and the new
packages/demon-client/types/wireContract.gen.hpp; a byte-for-byte drift guard
(test_generated_wire_types_hpp_match_contract) mirrors the existing .ts one.
The rtmg-vst JUCE plugin vendors this header so the C++ client shares one
source of truth for the wire contract instead of hand-copying message strings.
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.
Step 04 (DEMON side) of the wire-contract onboarding: project a C++ header from the same
demos/realtime_motion_graph_web/protocol.pyregistry that already generates the TypeScriptwireContract.gen.ts, so the JUCE/C++ rtmg-vst plugin can share one source of truth for the wire contract instead of hand-copying message strings.What it adds
render_wire_types_hpp(contract, knob_schema_version)inscripts/gen_wire_types.py(parallel torender_wire_types_ts), plus_cpp_comment/_cpp_str_lit/_cpp_const_name/_indent/_emit_cpp_message/_emit_cpp_grouphelpers.main()now writes both.tsand.hpp.packages/demon-client/types/wireContract.gen.hpp— committed beside the.ts.test_generated_wire_types_hpp_match_contractmirroring the.tsone.Design: constants + enums only, JSON-library-agnostic
The header declares no structs and pulls in no JSON dependency. It emits string constants only — message
"type"names, per-field JSON keys, and enum option values — underdemon::wire::{command,event,config,handshake}, pluskProtocolVersion/kKnobSchemaVersion/kTypeKey. The VST parses withjuce::varand has nonlohmann, so a struct-typed header wouldn't compile there; this keeps the emitter framework-neutral and the VST keeps its own (de)serialization.Relationship to other PRs
Sibling of #269 — both branch off
refactor/client-sdk-config. #269 never touchesprotocol.py/gen_wire_types.py, so there is no overlap; this reads the registry only. Merges as part of the #266 → #267 stack.Verification
tests/unit/test_wire_contract.py: 16 passed (was 15); drift guard confirmed non-hollow (fails on a stale header, passes after regenerate)./WX.