fix: mixed filament manual_pattern dependency resolution and delete/merge remap#366
Merged
LuckZAE merged 1 commit intoMay 25, 2026
Conversation
…emap - manual_pattern now participates in dependency resolution with priority: manual_pattern → gradient → pair - Add errno-based overflow detection for strtoul calls - Add bounds checking for symbolic tokens "1"/"2" in physical_filament_from_token - remove_physical_filament now detects and removes entries that depend on the deleted physical filament via manual_pattern tokens - Deleted mixed filament virtual IDs are correctly remapped to 0 (NONE), preventing paint from being reassigned to a surviving mixed filament - build_filament_id_remap accepts deleted_mixed_idx parameter; merge path correctly handles dependent mixed entries via remap injection - UI: properly show/hide delete button and enable/disable add button when physical filament count changes - Add 50+ regression tests covering serialization, resolve, delete, merge, gradient, bracket notation, and group boundary scenarios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix dependency resolution and ID remapping for mixed filaments during
physical filament deletion and merge operations, with manual_pattern
properly integrated into the dependency chain.
Changes
Dependency resolution priority
manual_pattern → gradient → component_a/b(pattern already resolves every token, avoiding false positives)
strtoul safety
errno-based overflow detection to all strtoul callsToken bounds checking
physical_filament_from_tokennow validates symbolic "1"/"2" tokensagainst physical filament count
Deletion logic (
remove_physical_filament)deleted physical filament
the deleted ID), including bracket notation
[12]→[11]andcomma-separated groups
34,78→23,67ID remap (
build_filament_id_remap)deleted_mixed_idxparameter: deleted mixed virtual IDs nowcorrectly remap to 0 (NONE) instead of being shifted onto survivors
mixed_filament_depends_on_physicalhelper for pattern-awaredependency detection
UI fixes
delete_filamenttrack physical filament count changes
Tests
delete (bracket/group/gradient boundaries), merge, and gradient
encode/decode