Repository navigation
Conversation
- Write the module path, not the class name, for PROCESSOR, READ/WRITE_CONVERSION, LIMITS_RESPONSE, ACCESSOR, VALIDATOR and SUBPACKETIZER via a new class_to_filename helper, so output loads back - Fix WatermarkProcessor.as_json, which raised AttributeError - Fix IpWriteConversion.to_config missing its read_or_write argument and PacketItem.to_config not calling limits.response.to_config() - Omit an unset microseconds item in UnixTimeConversion.to_config instead of writing a literal None Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/packet-item-to-config-states #4163 +/- ##
====================================================================
+ Coverage 80.59% 80.64% +0.05%
====================================================================
Files 913 915 +2
Lines 71062 71095 +33
Branches 2745 2745
====================================================================
+ Hits 57270 57335 +65
+ Misses 13119 13090 -29
+ Partials 673 670 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
6d10e03
into
fix/packet-item-to-config-states



Stacked on #4154.
What changed
Python
to_configwrote a bare class name (e.g.WatermarkProcessor) wherever a config keyword names a class. The Python parser loads these by file path (openc3/processors/watermark_processor.py), so the output didn't load back in. A newclass_to_filename()helper inutilities/string.pybuilds the path from the class's module, the inverse offilename_to_module/filename_to_class_name. It's now used for:PROCESSORprocessor.py,watermark_processor.py,statistics_processor.pyREAD/WRITE_CONVERSIONconversion.py,processor_conversion.py,unix_time_conversion.py(and the 7 conversions that inheritto_config)LIMITS_RESPONSElimits_response.pyVALIDATORpacket.pyACCESSOR,SUBPACKETIZERpacket.pyBecause the path comes from the class's module, custom classes in a target's
libload back in too.Other bugs fixed along the way, each of which stopped
to_configoras_jsonworking on its own:WatermarkProcessor.as_jsonusedself.__class__.__name__.nameand raisedAttributeError.IpWriteConversion.to_config(self)was missing theread_or_writeparameter, so every call raisedTypeError.PacketItem.to_configaddedlimits.response.to_configto the string without calling it, which raisedTypeError.UnixTimeConversion.to_configwrote a literalNonewhen there's no microseconds item, and the parser would read that as an item name. It's now left out, which is what Ruby does.The Ruby side already writes filenames and needs no change.
Testing
test_to_config_output_parses_back_to_the_same_classes(intest_packet_config.py) writes packets that use every keyword above withPacketConfig.to_config, loads the files back in, and checks every class and its parameters match. It fails on the old code.WatermarkProcessor.as_jsontest; updated two assertions that expected the old class-name output.ruff check/ruff format --checkare clean.Not included
PacketItem.as_json(packet_item.py:500) stores the limits response object itself inconfig["limits"]["response"], so the JSON for any item with a limits response can't be serialized. Ruby storesresponse.to_s. It's a separate bug, left for a follow-up.🤖 Generated with Claude Code