This is an automated email from the ASF dual-hosted git repository.

luigidemasi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 6fd800813c384f819cf829367db29a10d4d8b439
Author: Luigi De Masi <[email protected]>
AuthorDate: Wed Oct 7 19:05:49 2026 +0200

    CAMEL-25382: Fix JBang validation of semantic documentation
    
    Treat the semantic function's missing runtime dependency as an unavailable
    language in JBang's static Simple checks, matching the existing policy for
    other optional languages. Keep reporting malformed semantic arguments.
    
    Update the catalog excerpt regression to assert expert-owned evaluation
    concepts instead of the removed question and TypeSafe policy model.
    
    Co-authored-by: Codex <[email protected]>
    Signed-off-by: Luigi De Masi <[email protected]>
---
 .../dsl/jbang/core/commands/ai/SimpleChecks.java   |  1 +
 .../core/commands/ai/CatalogDocExcerptTest.java    |  4 +--
 .../commands/ai/SourceValidatorSimpleTest.java     | 36 ++++++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SimpleChecks.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SimpleChecks.java
index 4cff024faf1f..5d71ae876aab 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SimpleChecks.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SimpleChecks.java
@@ -223,6 +223,7 @@ final class SimpleChecks {
 
     static boolean isMissingDependency(String error) {
         return error.startsWith("No language could be found for:")
+                || error.equals("The semantic function requires camel-semantic 
on the classpath")
                 || error.startsWith("No " + 
SimpleLanguageFunctionFactory.FACTORY + "/")
                         && error.contains("service could be found in the 
classpath");
     }
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocExcerptTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocExcerptTest.java
index 8da10bbe9563..96bad2e799ea 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocExcerptTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocExcerptTest.java
@@ -87,12 +87,12 @@ class CatalogDocExcerptTest {
 
     @Test
     public void testALanguageCarriesWhatItsOptionsCannotSay() throws Exception 
{
-        // CAMEL-25235: the semantic language is configured by named 
questions, which are not options at all, so its
+        // CAMEL-25235: the semantic language is configured by named 
evaluations, which are not options at all, so its
         // option list (id, language, expression) says nothing about how to 
use it
         JsonObject answer = catalogDoc(Map.of("name", "semantic", "kind", 
"language"));
         String documentation = answer.getString("documentation");
         assertNotNull(documentation, "no documentation in: " + 
answer.toJson());
-        for (String needed : new String[] { "question", "instructions", 
"criteria", "threshold" }) {
+        for (String needed : new String[] { "evaluation", "expert", 
"operation", "parameters", "state" }) {
             assertTrue(documentation.contains(needed), needed + " is not in 
the excerpt:\n" + documentation);
         }
         assertNotNull(answer.getString("documentationHint"));
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidatorSimpleTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidatorSimpleTest.java
index 3842cdb4046b..13a0917d8020 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidatorSimpleTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidatorSimpleTest.java
@@ -255,6 +255,42 @@ class SourceValidatorSimpleTest {
         assertThat(msgs).isEmpty();
     }
 
+    @Test
+    void semanticExpressionsAndPredicatesDoNotRequireTheRuntimeDependency() {
+        assertThat(catalog.validateLanguageExpression(null, "simple", 
"${semantic('department')}").getShortError())
+                .isEqualTo("The semantic function requires camel-semantic on 
the classpath");
+        List<String> msgs = SourceValidator.validateYamlSimple("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - setBody:
+                          simple: "${semantic('department')}"
+                      - filter:
+                          simple: "${semantic('allowed')}"
+                          steps:
+                            - log: accepted
+                """, catalog);
+        assertThat(msgs).isEmpty();
+    }
+
+    @Test
+    void invalidSemanticArgumentsAreStillReportedWithoutTheRuntimeDependency() 
{
+        List<String> msgs = SourceValidator.validateYamlSimple("""
+                - from:
+                    uri: direct:start
+                    steps:
+                      - setBody:
+                          simple: "${semantic(department)}"
+                      - filter:
+                          simple: "${semantic('allowed', 'other')}"
+                          steps:
+                            - log: accepted
+                """, catalog);
+        assertThat(msgs).hasSize(2);
+        assertThat(msgs).allSatisfy(msg -> assertThat(msg)
+                .contains("Simple syntax error", "Semantic requires one quoted 
evaluation name"));
+    }
+
     @Test
     void thePredicateEipsComeFromTheCatalog() {
         // the same text is a predicate (error: no ${}) where the catalog 
marks the option asPredicate, and a

Reply via email to