-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
v4-enhancementEnhancement planned for hier_config v4.0.0Enhancement planned for hier_config v4.0.0
Description
Description
Currently HConfigChild.text is mutable (modified during negate()), and comments/tags are mutable sets. This means remediation can mutate the source tree, requiring deep_copy() to avoid side effects.
Proposed Change
Make tree nodes immutable after construction:
negate()returns a new node rather than mutatingself.textcommentsandtagsbecomefrozenset(or copy-on-write)- Tree modifications create new branches rather than mutating in place
Benefits
- Eliminates mutation bugs (remediation can't corrupt the source config)
deep_copy()becomes unnecessary in most cases- Thread-safe by default
- Easier to reason about
Breaking Change
Yes — any code that mutates child.text, child.comments, or child.tags directly.
Considerations
This is a high-effort change that touches nearly every method. May need a phased approach or a compatibility layer.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
v4-enhancementEnhancement planned for hier_config v4.0.0Enhancement planned for hier_config v4.0.0