sangkyoonnam commented on code in PR #908:
URL: https://github.com/apache/burr/pull/908#discussion_r4178409337
##########
tests/core/test_application.py:
##########
@@ -2178,21 +2193,132 @@ def test_iterate_with_inputs():
graph=Graph(
actions=[counter_action, result_action],
transitions=[
- Transition(counter_action, counter_action,
Condition.expr("count < 2")),
Transition(counter_action, result_action, default),
Review Comment:
The loop this test had never ran a second `counter` step, since the first
step already makes `count` 11. A test where the input-driven action runs twice
would pin down the new behavior for self-loops.
##########
tests/core/test_application.py:
##########
@@ -2350,7 +2519,7 @@ def test_run_with_inputs():
def test_run_with_inputs_multiple_actions():
- """Tests that inputs aren't popped off and are passed through to multiple
actions."""
+ """Inputs supplied to run are consumed by its first action only."""
Review Comment:
The old docstring said inputs "aren't popped off and are passed through to
multiple actions", from 742b596a. Linking that commit in the Notes would help
reviewers see the history.
##########
burr/core/application.py:
##########
@@ -1296,10 +1296,12 @@ def iterate(
result = None
prior_action: Optional[Action] = None
+ step_inputs = inputs
while self.has_next_action():
# self.step will only return None if there is no next action, so
we can rely on tuple unpacking
- prior_action, result, state = self.step(inputs=inputs)
+ prior_action, result, state = self.step(inputs=step_inputs)
yield prior_action, result, state
+ step_inputs = {}
Review Comment:
Resetting here also drops inputs for a self-loop. This is the shape of the
hello-world-counter example (excerpt):
```python
.with_transitions(("counter", "counter", expr("counter < 10")), ("counter",
"result", default))
app.run(halt_after=["result"], inputs={"increment_by": 1})
```
On head the second `counter` step raises `missing required inputs` for
`increment_by`. If this goes ahead, the example and the pydantic tests need
updating in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]