Conversation
… constraint - Fix operator precedence bug in feedforward.dag_from_flow: self-loops were only removed from zflow but not xflow due to | having lower precedence than -. Wrap the union in parentheses so self-loops are correctly excluded from both. - Add constraint to schedule_solver that every non-input, non-output node must be prepared strictly before it is measured. - Add integration test verifying MINIMIZE_SPACE enforces preparation before measurement, and fix RUF031 lint errors (remove redundant parentheses in tuple subscripts). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #168 +/- ##
==========================================
- Coverage 84.17% 84.15% -0.03%
==========================================
Files 22 22
Lines 2603 2606 +3
Branches 474 476 +2
==========================================
+ Hits 2191 2193 +2
Misses 308 308
- Partials 104 105 +1 🚀 New features to boost your workflow:
|
- Update CHANGELOG with fixed bug, new constraint, and new test - Narrow types via local variables before comparisons to fix mypy/pyright operator errors on int | None dict values Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d1ssk
approved these changes
Mar 9, 2026
Collaborator
d1ssk
left a comment
There was a problem hiding this comment.
Looks good.
It would be even better to add a test that verifies dag_from_flow() does not result in a self-loop when xflow[node] includes node.
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
feedforward.dag_from_flowhad an operator precedence bug where self-loops were only removed fromzflowbut notxflow. The expressionxflow.get(node, set()) | zflow.get(node, set()) - {node}evaluates asxflow | (zflow - {node})because-binds tighter than|. Adding parentheses fixes this:(xflow | zflow) - {node}.schedule_solver._add_constraintsnow enforces that every non-input, non-output node must be prepared strictly before it is measured (node2prep[node] < node2meas[node]).test_minimize_space_cpsat_prepares_node_before_measuring_itto verify this constraint under theMINIMIZE_SPACECP-SAT strategy. Also fixed RUF031 lint errors (redundant parentheses in tuple subscripts).Test plan
pytest tests/test_scheduler_integration.py— all 21 tests passpytest— all 315 tests passruff check— no errorsmypy— no errorspyright— no errors🤖 Generated with Claude Code