Skip to content

BREAK: map conservation rules to priorities - #377

Open
grayson-helmholz wants to merge 1 commit into
mainfrom
merge-rule-priorities
Open

grayson-helmholz wants to merge 1 commit into
mainfrom
merge-rule-priorities

Conversation

@grayson-helmholz

@grayson-helmholz grayson-helmholz commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Interface changes

EdgeSettings and NodeSettings now carry the rules and their priorities in a single field. conservation_rules became a mapping of each rule to its priority (rules with a higher priority are evaluated first), so the separate rule_priorities field disappears. A set is still accepted as input: a converter normalizes it to a mapping in which every rule gets the new DEFAULT_RULE_PRIORITY (1), but reading the attribute back always yields a dict.

Old name New name
EdgeSettings.rule_priorities removed, folded into EdgeSettings.conservation_rules
NodeSettings.rule_priorities removed, folded into NodeSettings.conservation_rules
EdgeSettings.conservation_rules: set[GraphElementRule] EdgeSettings.conservation_rules: dict[GraphElementRule, int]
NodeSettings.conservation_rules: set[Rule] NodeSettings.conservation_rules: dict[Rule, int]

Priorities are now attached per rule instance rather than looked up by rule type, which simplifies filter_quantum_number_problem_set() and _get_rules_by_priority(). create_interaction_settings() still derives its mappings from EDGE_RULE_PRIORITIES and CONSERVATION_LAW_PRIORITIES, so the default interaction settings are unchanged.

❗ Behavioral changes

  • In the DOT output of qrules.io, a rule without a declared priority is now rendered with its effective priority 1 instead of NA, and the RULES block is emitted whenever a setting has any rules, not only when priorities were declared separately.

Squash commit messages

* BEHAVIOR: render unprioritized rules with priority 1

@redeboer
redeboer added this pull request to stack #386 September 15, 2026 14:29
@redeboer redeboer changed the title BREAK: merge rule priorities into conservation rules BREAK: map conservation rules to priorities Sep 15, 2026
@redeboer redeboer added ❗ Behavior Changes that may affect the framework output ⚠️ Interface Breaking changes to the API labels Sep 15, 2026
@redeboer
redeboer self-requested a review September 15, 2026 14:40
@redeboer redeboer added this to the 0.11.0 milestone Sep 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

❗ Behavior Changes that may affect the framework output ⚠️ Interface Breaking changes to the API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge conservation_rules and rule_priorities attributes

2 participants