Skip to content

Remove unused boilerplate code, consolidate to frame_parsers_gen files - #63

Merged
rijesha merged 3 commits into
mainfrom
copilot/remove-unused-boilerplate-code
Dec 3, 2025
Merged

Remove unused boilerplate code, consolidate to frame_parsers_gen files#63
rijesha merged 3 commits into
mainfrom
copilot/remove-unused-boilerplate-code

Conversation

Copilot AI commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

Consolidates frame parser implementations to the generated frame_parsers_gen.* files, removing 18 redundant boilerplate files that duplicated functionality.

Removed files

  • C: basic_frame.h, basic_frame_with_len.h, struct_frame.h, struct_frame_cpp.h, struct_frame_default_frame.h, struct_frame_gen.h, struct_frame_parser.h, struct_frame_types.h
  • C++: basic_frame.hpp, basic_frame_with_len.hpp, struct_frame.hpp, struct_frame_parser.hpp, struct_frame_types.hpp
  • TS/JS: struct_frame_gen.*, struct_frame_parser.*
  • Python: struct_frame_parser.py

Code generator updates

  • C/C++ generators no longer emit includes to removed headers
  • C++ namespace changed from StructFrame to FrameParsers to match frame_parsers_gen.hpp
  • generate.py updated to copy only essential boilerplate files

Test updates

Updated C/C++/Python tests to use the consolidated frame parser API:

// Before
basic_frame_encode_buffer_t buffer;
basic_frame_encode_init(&buffer, encode_buffer, sizeof(encode_buffer));
basic_frame_encode_msg(&buffer, MSG_ID, &msg, MSG_SIZE);
basic_frame_msg_info_t result = basic_frame_validate_packet(buf, size);

// After
size_t encoded_size = basic_frame_encode(buf, sizeof(buf), MSG_ID, (uint8_t*)&msg, MSG_SIZE);
frame_msg_info_t result = basic_frame_validate_packet(buf, encoded_size);
# Before
from struct_frame_parser import BasicFrame
basic_frame = BasicFrame()
result = basic_frame.validate_packet(data)
if result['valid']: ...

# After  
from frame_parsers_gen import BasicFrame
result = BasicFrame.validate_packet(data)
if result.valid: ...

All tests pass (41/42 - the one failure is a pre-existing TS node types issue).

Original prompt

This section details on the original issue you should resolve

<issue_title>Remove unused boilerplate code</issue_title>
<issue_description>Remove unused boilerplate code.
The files that should be used are

src/struct_frame/boilerplate/c/frame_parsers_gen.h
src/struct_frame/boilerplate/cpp/frame_parsers_gen.hpp
src/struct_frame/boilerplate/js/frame_parsers_gen.js
src/struct_frame/boilerplate/py/frame_parsers_gen.py
src/struct_frame/boilerplate/ts/frame_parsers_gen.ts

Ensure the tests still pass while using the new files.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 3, 2025 17:02
…gen files

Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
…fix formatting

Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove unused boilerplate code from structure Remove unused boilerplate code, consolidate to frame_parsers_gen files Dec 3, 2025
Copilot AI requested a review from rijesha December 3, 2025 17:08
@rijesha
rijesha marked this pull request as ready for review December 3, 2025 17:46
@rijesha
rijesha merged commit bbbe504 into main Dec 3, 2025
2 checks passed
@rijesha
rijesha deleted the copilot/remove-unused-boilerplate-code branch December 6, 2025 03:20
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.

Remove unused boilerplate code

2 participants