Skip to content

Fix xtce_converter CLI crash with gem_name nil and PythonProxy .class#2841

Merged
jmthomas merged 2 commits into
mainfrom
xtce_converter
Feb 18, 2026
Merged

Fix xtce_converter CLI crash with gem_name nil and PythonProxy .class#2841
jmthomas merged 2 commits into
mainfrom
xtce_converter

Conversation

@jmthomas
Copy link
Copy Markdown
Member

Two bugs prevented the xtce_converter from running via CLI:

  1. plugin_model.rb: gem_name was only set when gem_file_path was nil, causing a NoMethodError on line 234 when gem_file_path was passed directly by the xtce_converter.

  2. xtce_converter.rb: PythonProxy overrides .class to return a String (the Python class path) rather than a Ruby Class object, so calling .class.name on a PythonProxy conversion failed for Python-based targets like INST2.

closes #2837

Two bugs prevented the xtce_converter from running via CLI:

1. plugin_model.rb: gem_name was only set when gem_file_path was nil,
   causing a NoMethodError on line 234 when gem_file_path was passed
   directly by the xtce_converter.

2. xtce_converter.rb: PythonProxy overrides .class to return a String
   (the Python class path) rather than a Ruby Class object, so calling
   .class.name on a PythonProxy conversion failed for Python-based
   targets like INST2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.65%. Comparing base (d22dbda) to head (895723f).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
openc3/lib/openc3/models/plugin_model.rb 50.00% 1 Missing ⚠️
...penc3/lib/openc3/packets/parsers/xtce_converter.rb 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2841      +/-   ##
==========================================
- Coverage   78.66%   78.65%   -0.02%     
==========================================
  Files         667      667              
  Lines       54452    54458       +6     
  Branches      731      731              
==========================================
- Hits        42834    42833       -1     
- Misses      11538    11545       +7     
  Partials       80       80              
Flag Coverage Δ
python 80.56% <ø> (-0.02%) ⬇️
ruby-api 80.22% <ø> (-0.05%) ⬇️
ruby-backend 82.00% <71.42%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

gem_name = plugin_hash['name'].split("__")[0]
gem_file_path = OpenC3::GemModel.get(gem_name)
else
gem_name = File.basename(gem_file_path)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with SonarQube here -- if / else would be much easier to read 😅

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fix a totally separate bug I've noticed -- the openc3cli validate fails if public/ is in the directory list, but this will fix that issue.

Without public in the gemspec, the gem doesn't contain public/store_img.png. So line 232 (File.exist?) is false, img_path stays nil, and line 234's if img_path guard prevents the nil .split from ever executing.

@sonarqubecloud
Copy link
Copy Markdown

@jmthomas jmthomas merged commit a06e0c1 into main Feb 18, 2026
29 of 31 checks passed
@jmthomas jmthomas deleted the xtce_converter branch February 18, 2026 22:10
jmthomas added a commit that referenced this pull request Mar 21, 2026
Fix xtce_converter CLI crash with gem_name nil and PythonProxy .class
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.

Recent regression in xtce_converter

2 participants