Croway opened a new pull request, #29738: URL: https://github.com/apache/camel/pull/29738
JIRA: [CAMEL-26411](https://issues.apache.org/jira/browse/CAMEL-26411) ## What `camel_eval_expression` evaluates against a scratch exchange, and some of its answers sent local models the wrong way (the runs r24 to r26 in the JIRA). Of the proposals of the issue and the findings in its comments, these are already on `main`: - the fields of a JSON text body are read on the parsed data (CAMEL-26690, #29327), which also covers `${body.lines.size()}`; - the note for a repeated identical call (CAMEL-26690); - a SpEL filter inside Simple gets the same message as at write time (CAMEL-26632). This PR does the rest, in `ExpressionEvaluator` only: - **No body is empty text.** With no `body`, the evaluation has `""` as the body, in the local context and in a running integration (the eval action of the CLI connector defaults it to `""`), so `${body} == null` answered `false`. The note said "evaluated with an empty body"; it now says that the body is empty text, not null as in a route whose message has none. The body stays `""`: evaluating with `null` would need a change of the eval action, and an older integration would still use `""`. - **jsonpath, jq and xpath with no body** fail with an error that does not name the body (`json string can not be null or empty`). The answer now says that the language reads its JSON or XML from the body, and to pass it as `body`. In a running integration, where the failure is a tool error, the note goes with its message. - **An unset header.** A Simple expression that is null because it reads a header that was not passed now names the header and the `headers` argument. For `CamelRedeliveryCounter`, `CamelRedeliveryMaxCounter` and `CamelRedelivered` it adds that the error handler sets them from the first redelivery on, so they are not set on the first attempt, and `onException` has them only after a redelivery. `${exchangeProperty.X}` says that an evaluation has no exchange properties, and for the redelivery names that they are headers. Other null results keep the generic note, which now says that an evaluation has only the headers and variables passed to it. ## Tests - New `ExpressionEvaluatorNotesTest` (2 tests): xpath with and without a body; the notes for `${header.CamelRedeliveryCounter}` and `${exchangeProperty.CamelRedeliveryCounter}`; a header that was passed keeps the generic note. - `EvalInTheIntegrationTest`: jsonpath with no body in a running integration, where the tool error carries the note. - `ExpressionEvaluatorTest`, `EvalInTheIntegrationTest`: the expected texts of the existing no-body and null assertions. - `camel-jbang-core`, every test in `org.apache.camel.dsl.jbang.core.commands.ai`: 1043 tests, 1 skipped (the download test). The 2 `IndentLinesTest` failures (doCatch under doTry) fail the same way locally on `main` without this change. `camel-jbang-mcp` `AuthoringToolsTest`: 14 tests, 0 failures. _Claude Code on behalf of Federico Mariani_ -- 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]
