forked from viewit/KX-Bridge-Release
Found during a targeted code review, not from a user report. parse_profile()'s `name` field went straight through clean_name() without routing through first_str() first, unlike filament_vendor/filament_type/ default_filament_colour right below it - all of which handle the documented case where OrcaSlicer stores a field as ["value"] instead of a plain string. If `data["name"]` was ever a list, clean_name()'s re.sub() raised TypeError since it requires a string argument. Fixed by routing it through first_str() like its neighbors. Also added a debug log when sys_by_name (the system-profile lookup index) overwrites an entry due to a name collision - clean_name() deliberately collapses variant-suffixed profile names (e.g. "...@base" vs "...@Anycubic Kobra X 0.4 nozzle") onto the same cleaned name, so a collision is expected, but the resulting last-write-wins overwrite was previously silent, making an unexpected inherits-parent resolution hard to debug. New tests in tests/test_orca_filaments_parser.py add the first dedicated coverage for parse_profile()/parse_profile_bytes()/clean_name() - previous tests only used pre-parsed profile dicts as fixtures and never exercised the parsing logic itself.