fix(filament): suppress stale slot profile when AMS material family changes #1

Closed
walterioo wants to merge 0 commits from fix/stale-slot-profile-material-guard into nightly
Owner

Problem

The per-slot filament profile override (config.ini [filament_profiles]) stores
only vendor + name and is sticky: swapping the physical filament updates the AMS
colour and type live, but the saved profile persists. Real case (KX1): a slot
that held "KINGROON PETG Basic" kept showing and sending PETG in the device panel
and the OrcaSlicer lane hint after yellow PLA was loaded — and it survived
restarts, since the override lives in config.ini.

Fix — non-destructive suppression

The override is now applied only while its material family still matches the
material currently loaded in the AMS. PLA / PLA+ / PLA SILK / PLA MATTE are one
family, so within-family swaps never invalidate a valid profile (this also guards
against an over-strict material compare). On a family change the slot falls back
to the generic default; the override is not deleted, so reloading the
original material reactivates it. The profile's material is resolved from the
Orca filament library; when it is unknown we do not suppress (fail-safe).

Wired into the three resolution sites:

  • handle_kx_filament_slots — the device panel
  • _build_lane_data — the AMS array sent to OrcaSlicer
  • _build_mmu_objectgate_filament_name (Happy-Hare path)

Tests

13 new TDD tests (tests/test_slot_profile_material_guard.py): unit coverage for
the family reduction and the effective-profile resolution, plus in-process
integration for the panel endpoint and the print path. Validated against the live
bridge that user filament profiles resolve their material type correctly, so the
guard fires in production.

## Problem The per-slot filament profile override (config.ini `[filament_profiles]`) stores only vendor + name and is sticky: swapping the physical filament updates the AMS colour and type live, but the saved profile persists. Real case (KX1): a slot that held "KINGROON PETG Basic" kept showing and sending PETG in the device panel and the OrcaSlicer lane hint after yellow PLA was loaded — and it survived restarts, since the override lives in config.ini. ## Fix — non-destructive suppression The override is now applied only while its material **family** still matches the material currently loaded in the AMS. PLA / PLA+ / PLA SILK / PLA MATTE are one family, so within-family swaps never invalidate a valid profile (this also guards against an over-strict material compare). On a family change the slot falls back to the generic default; the override is **not** deleted, so reloading the original material reactivates it. The profile's material is resolved from the Orca filament library; when it is unknown we do not suppress (fail-safe). Wired into the three resolution sites: - `handle_kx_filament_slots` — the device panel - `_build_lane_data` — the AMS array sent to OrcaSlicer - `_build_mmu_object` — `gate_filament_name` (Happy-Hare path) ## Tests 13 new TDD tests (`tests/test_slot_profile_material_guard.py`): unit coverage for the family reduction and the effective-profile resolution, plus in-process integration for the panel endpoint and the print path. Validated against the live bridge that user filament profiles resolve their material type correctly, so the guard fires in production.
walterioo added 1 commit 2026-07-09 08:21:48 +02:00
A per-slot filament profile override (config.ini [filament_profiles]) stores
only {vendor, name, id} and is sticky: swapping the physical filament updates
the AMS colour + type live, but the saved profile persisted. Loading yellow PLA
into a slot that held "KINGROON PETG Basic" kept showing/sending PETG in the
panel and the OrcaSlicer lane hint, and survived restarts (config.ini).

Resolve the effective profile per slot as the saved override only when its
material *family* still matches the loaded AMS material — PLA / PLA+ / PLA SILK /
PLA MATTE are one family, so within-family swaps never invalidate a valid
profile (guards against the earlier over-strict material compare). On a family
change the override is suppressed (slot falls back to the generic default) but
NOT deleted, so re-loading the original material reactivates it. Profile
material is resolved from the Orca filament library; unknown → never suppress.

Wired into the three resolution sites: handle_kx_filament_slots (panel),
_build_lane_data (OrcaSlicer AMS array), _build_mmu_object (gate_filament_name).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
Owner

Superseded by the upstream PR: viewit/KX-Bridge-Release#88 — closing this fork-internal one.

Superseded by the upstream PR: https://gitea.it-drui.de/viewit/KX-Bridge-Release/pulls/88 — closing this fork-internal one.
walterioo closed this pull request 2026-07-09 08:47:45 +02:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: walterioo/KX-Bridge-Release#1
No description provided.