Skip to content

#105 - New router task - #527

Merged
njoubert-cleverage merged 1 commit into
dev-v6from
105-router
Dec 3, 2026
Merged

njoubert-cleverage merged 1 commit into
dev-v6from
105-router

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #105 (second pull request, after #526 which added the branches task key and ProcessState::setOutputBranch()).

A core router task dispatches each input to the conditional branches of the task:

  • conditions: by branch name, the conditions of ConditionTrait (match, not_match, empty, not_empty, match_regexp, not_match_regexp) and an optional ExpressionLanguage expression (the input as data, the bundle's cleverage_process.expression_language service); all of them must hold, a branch without conditions (~) matches every input.
  • mode: first (default, the first matching branch in the order of conditions) or all (every matching branch).
  • default: the branch of the inputs matching no branch; without it, they go to the error outputs with a warning, never silently lost.
  • Checked at the initialization of the task, before any input: the conditions and the default branch must be branches of the task, every branch must have conditions or be the default one, the default branch cannot have conditions, a router needs conditions or a default branch; a condition that is neither a mapping nor ~ is rejected.
  • Errors: an error while checking a condition follows the error_strategy of the task and never sends the input to the default branch; a missing array key in an expression is an error whatever the PHP error handler (it gave null and the default branch when the warnings were not converted, e.g. in production).
  • Docs: reference page, a recipe replacing a cascade of filters with a router, filter positioned as the task dropping items (router: dispatching them), a warning against {{ }} contextual values in an expression, CHANGELOG.

Checked locally: make quality, and PHPUnit with pcov (1468 tests, none risky), including an integration test with the real services.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: a new task. The PHPDoc types of the branches of TaskConfiguration accept integer keys (numeric branch names).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage requested a review from a team as a code owner December 3, 2026 14:28
@njoubert-cleverage njoubert-cleverage added this to the v6.0 milestone Dec 3, 2026
@njoubert-cleverage njoubert-cleverage self-assigned this Dec 3, 2026
@njoubert-cleverage
njoubert-cleverage merged commit a366fb2 into dev-v6 Dec 3, 2026
15 checks passed
@njoubert-cleverage
njoubert-cleverage deleted the 105-router branch December 3, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant