FEAT: add qrules.workflow module - #344
Open
grayson-helmholz wants to merge 27 commits into
Open
Conversation
Extract the pipeline stages of the `StateTransitionManager` into free functions in a new `qrules.workflow` module, so that intermediate results (most notably `QNProblemSet`s) can be inspected, modified, and fed back into the pipeline. The STM remains as a thin facade that delegates to these functions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
redeboer
self-requested a review
July 10, 2026 13:15
Contributor
Author
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Introduce `QNProblemSetCollection`, returned by `create_qn_problem_sets()`, which carries the intermediate-particle selection, final state, and formalism along with the strength-grouped `QNProblemSet`s. `find_solutions()` defaults to these values, so the solving stage can no longer silently diverge from the values with which the problem sets were created (e.g. matching against the full PDG although the problem sets were built for a restricted resonance selection, or deduplicating canonical solutions with helicity filters). Explicit arguments still override, and a plain strength-grouped dictionary is still accepted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TWmXKcjJMmRVJCUi58JDLH
The topology creation (including the n-body mass-conservation toggle) and the `ProblemSet` to `QNProblemSet` conversion were duplicated between the `StateTransitionManager` and the workflow module; both now delegate to the single implementation in `qrules.workflow`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TWmXKcjJMmRVJCUi58JDLH
Mirrors `src/qrules/workflow.py` with `tests/unit/test_workflow.py`, covering the intermediate-particle selection, `InteractionConfig` get/set semantics, and an equivalence test that reproduces the STM-generated `ReactionInfo` through the `create_qn_problem_sets`/`find_solutions` pipeline. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TWmXKcjJMmRVJCUi58JDLH
Restores the `# noqa: S403`, `# noqa: F401` and `# noqa: S324` suppression comments that 4b79de2 (#346) rewrote into `# ruff: ignore[...]` form. Note that the current ruff version enforces the opposite: `ruff check` reports 5 `noqa-comments` violations on this file, and `ruff check --fix` will restore the `ruff: ignore` form. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 27, 2026
StateTransitionManager into a workflow moduleqrules.workflow module
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.

StateTransitionManagerto facilitate use of intermediate results #305allowed_intermediate_particles#306allowed_interaction_types#307QNProblemSets without theStateTransitionManager#284✨ New features
qrules.workflowexposes the pipeline as free functions:create_graph_settings(),create_problem_sets(),solve(),convert_to_particle_transitions(), andcollect_reaction_info().create_qn_problem_sets()andfind_solutions()cover the default use case in two calls, meeting at aQNProblemSetCollectionthat carries the final state, formalism, and particle selection from one to the other.AllowedIntermediateParticles, built withfilter_intermediate_particles()and narrowed withselect()andexclude(), which take the same name patterns and return a new selection.InteractionConfig, holding the interaction-type settings, the allowed types globally or per node, and the interaction determinators.SolutionContaineris public, because it is the boundary betweenconvert_to_particle_transitions()andcollect_reaction_info().⚙️ Enhancements
solve()takes strength-groupedQNProblemSets, so one filtered withfilter_quantum_number_problem_set()can be fed straight back in.find_solutions()requiresformalismandallowed_intermediate_particlesfor a plaindictof problem sets instead of guessing. Defaulting to"helicity"stripsReactionInfo.formalism; falling back to the whole particle database matches intermediate states the problem sets were not built for. Both are still inferred from aQNProblemSetCollection.StateTransitionManager.🔨 Maintenance
StateTransitionManagerbecomes a facade over these functions. Its public methods, arguments, and output are unchanged:tests/channels/is untouched and a new test asserts that the pipeline reproduces the STM result for both formalisms.📝 Documentation
intermediate-results.ipynbis rewritten around the workflow functions. It keeps thedict_set_intersection()reduction from CSPSolver generates undesirededge_propertiesafter filtering #301, without which the intermediate edges come back with the full PDG property maps.reaction.ipynbstill teaches theStateTransitionManagerexclusively; converting it is left as a follow-up.Squash commit messages