elijahbenizzy opened a new pull request, #778:
URL: https://github.com/apache/burr/pull/778

   Fixes #761
   
   ## Root cause
   
   `TaskBasedParallelAction` (and subclasses `MapStates`, `MapActions`, 
`MapActionsAndStates`) generated sub-application IDs that were deterministic in 
`(parent_app_id, i, j)` only -- no per-invocation discriminator. When the 
parent application was built with `initialize_from(...)`, the cascaded state 
initializer would, on the second invocation of the same parallel action, see a 
sub-app ID matching the first invocation's persisted state and silently hydrate 
it instead of running the action.
   
   Result: every invocation after the first replayed the first invocation's 
outputs. Silent wrong results.
   
   Fresh runs (no `initialize_from`) were unaffected because the cascaded 
initializer was `None`, so sub-apps never tried to load existing state even 
though their IDs still collided.
   
   ## Fix
   
   In `TaskBasedParallelAction.run_and_update`, salt each task's 
`application_id` with the parent context's `sequence_id`. The parent's 
`sequence_id` increments on every action step, so it uniquely identifies which 
invocation of the parent action we are in. Applied via a small 
`_salt_task_app_id` helper in both sync and async generator paths, so every 
subclass inherits the fix automatically without overriding `tasks()`.
   
   This matches the workaround pattern the issue reporter (hippalectryon-0) 
verified.
   
   ## Regression test
   
   
`tests/core/test_parallelism.py::test_map_states_reexecutes_on_repeated_invocations_with_initializer`
 -- builds an app with `initialize_from(...)` and a `MapStates` action, invokes 
it three times in a row using a counter inside the sub-action, and asserts the 
outputs differ across invocations and the counter advanced as expected. 
Confirmed it fails on `main` and passes with the fix.
   
   ## Test plan
   
   - [x] New regression test passes with the fix
   - [x] New regression test fails on `main` (without the fix), confirming it 
actually catches the bug
   - [x] All 19 existing tests in `tests/core/test_parallelism.py` still pass
   
   ## Backwards-compat note for release notes
   
   This changes the sub-application IDs produced by every 
`TaskBasedParallelAction` subclass. Anyone who has persisted sub-app state 
under the old (deterministic-without-salt) IDs and depended on resuming from 
those exact IDs will see new IDs after upgrading. Worth flagging in the release 
notes for the next release.


-- 
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]

Reply via email to