fabro/lib/components/fabro-workflow/src/handler
Bryan Helmkamp ee9189ddb5
Reuse existing helpers in the for_each fan-out
Simplification pass over the for_each branch. No behavior change.

Share what was duplicated:
- Node::prompt_or_label replaces the "prompt, else label" fallback that
  agent, prompt, and the for_each item injector each wrote out.
- context::lookup_flat replaces the "exact key, then strip context."
  lookup that condition.rs had twice and the for_each source had again.
- is_llm_handler_type replaces the inline agent/prompt match, so the
  runtime and the for_each_contract rule agree by construction.
- find_join_node now takes branch ids, so a for_each fan-out passes its
  template target instead of needing find_join_for_target.
- collect_events moves to test_support; parallel and integration tests
  shared one copy already.
- One ScriptedHandler replaces four test handlers that differed only in
  what they returned.

Straighten the branch retry loop:
- Reserve the branch scope once before the loop instead of guarding it
  with an Option, which removes three expect() calls.
- acquire_branch_permit and backoff_or_cancel replace the cancel-aware
  select! blocks the loop repeated verbatim.
- Keep the match arms in Executor::execute_with_retry order so the two
  loops stay easy to compare.

Drop redundant state:
- BranchPlan::is_for_each derives from template_target_id.
- for_each_contract checks node type before source shape, so one
  mistake reports one diagnostic.

Prove the new wire fields survive the OpenAPI boundary: the fabro-api
round-trip fixture now carries index and item_label.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 18:42:23 -04:00
..
llm fix(workflow): drop token accounting from agent-facing preamble 2026-07-25 09:51:14 -04:00
agent.rs Reuse existing helpers in the for_each fan-out 2026-07-28 18:42:23 -04:00
command.rs refactor(agent): streamline shell outcome reporting 2026-07-24 21:50:07 -04:00
conditional.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
exit.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
fan_in.rs refactor: simplify parallel handler and overview parsing 2026-07-24 08:28:58 -04:00
human.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
manager_loop.rs Merge origin/main into feat/stage-execution-identity-on-resume 2026-07-24 10:07:35 -04:00
mod.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
parallel.rs Reuse existing helpers in the for_each fan-out 2026-07-28 18:42:23 -04:00
prompt.rs Reuse existing helpers in the for_each fan-out 2026-07-28 18:42:23 -04:00
start.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
structured_output.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
wait.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00