-
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
The current negation system has three separate rule types and an implicit priority chain in negate():
NegationDefaultWithRule(replace with fixed string)NegationDefaultWhenRule(usedefaultform)NegationSubRule(regex substitution)swap_negation()(fallback)
These are three different Pydantic models, three fields on HConfigDriverRules, and the precedence is encoded in method ordering rather than being explicit.
Proposed Change
Unify into a single rule type:
class NegationStrategy(Enum):
REPLACE = auto() # was negate_with
DEFAULT = auto() # was negation_default_when
REGEX_SUB = auto() # was negation_sub
class NegationRule(BaseModel):
match_rules: tuple[MatchRule, ...]
strategy: NegationStrategy
value: str = "" # replacement text or regex pattern
replace: str = "" # for REGEX_SUB strategySingle negation_rules field on HConfigDriverRules. First matching rule wins.
Benefits
- Collapses three rule types and three driver fields into one
- Precedence is explicit (list order) rather than implicit (method ordering)
- Easier to understand and extend
Breaking Change
Yes — all existing negate_with, negation_default_when, and negation_sub rules must be migrated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
v4-enhancementEnhancement planned for hier_config v4.0.0Enhancement planned for hier_config v4.0.0