davsclaus opened a new pull request, #25729:
URL: https://github.com/apache/camel/pull/25729

   ## Summary
   
   - Fixes `DefaultSimpleFunctionRegistry.getFunction()` incorrectly failing to 
resolve Simple language custom functions defined via the init block (`$foo ~:= 
<expr>;`) whenever the `CamelContext` profile is `dev`.
   - In dev profile, the lookup intentionally bypasses its own function cache 
to support hot-reloading `SimpleFunction` beans registered in the Camel 
registry — but init-block custom functions are plain `Expression`s stored 
directly in that cache, not registry beans, so they were never found and route 
creation failed with `No custom simple function with name: X`.
   - Since `camel run` (camel-jbang) defaults to `--profile=dev`, this broke 
the init-block custom-function feature for essentially every JBang user, even 
though it worked fine outside dev profile (e.g. plain `mvn`/unit tests).
   - Reported by a community member via Zulip. Root-caused and reproduced 
independently of YAML/JBang in a plain unit test by setting 
`context.getCamelContextExtension().setProfile("dev")`.
   
   ## Test plan
   
   - [x] Added `initBlockCustomFunctionInDevProfile` to 
`SimpleInitBlockTest.groovy`, reproducing the bug by setting the context 
profile to `dev` before loading the route — fails before the fix, passes after.
   - [x] Added `initBlockCompactCustomFunction` to the same test, covering the 
YAML compact-notation form (`simple: |-`) used in the original report.
   - [x] Ran `SimpleInitBlockTest`, `SimpleInitBlockFunctionTest`, 
`SimpleInitBlockOverlappingKeysTest` (camel-core) and 
`SimpleCustomFunctionTest` (bean-based `SimpleFunction` hot-reload) — all pass, 
confirming no regression to dev-mode hot-reload of registry-based custom 
functions.
   - [x] Ran `ManagedSimpleFunctionRegistryTest` (camel-management) — passes.
   - [x] Manually reproduced end-to-end with `camel run` against a real YAML 
file (`camel run foo.yaml`) — failed before the fix, starts successfully after 
rebuilding/reinstalling the affected modules.
   
   _Claude Code on behalf of davsclaus_


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