[ 
https://issues.apache.org/jira/browse/CAMEL-25538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-25538 started by Guillaume Nodet.
-----------------------------------------------
> camel-jbang-mcp - camel_configuration_validate answers accepted:false, 
> valid:true for camel.server.* and any invented key outside the ten known 
> prefixes
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25538
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25538
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-catalog, camel-jbang-mcp
>    Affects Versions: 4.22.1
>            Reporter: Federico Mariani
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> {{camel_configuration_validate}} answers {{"accepted":false,"valid":true}} 
> for any key outside the ten prefixes the catalog validator knows, including 
> {{camel.server.*}} and invented keys, and counts them as valid in the 
> summary. Only keys under {{camel.main.*}} (and the other accepted prefixes) 
> get "Unknown option". The tool description does not say what {{accepted}} 
> means, so a model reads {{accepted:false}} as "this key is rejected" and 
> {{valid:true}} as "this key exists".
> In an evaluation of coding agents (Claude Code and IBM Bob) on migration 
> tasks, using camel-jbang-mcp 4.22.1, 18 of the 22 sessions that called the 
> tool got {{accepted:false}} for at least one line, {{camel.server.port}} most 
> often. Five IBM Bob sessions took {{accepted:false}} for 
> {{camel.server.port=8081}} as a rejection and then spent 5 to 15 calls 
> looking for the right HTTP port property. Invented keys passed as valid.
> h3. Reproduction
> {code}
> camel_configuration_validate runtime=main camelVersion=4.22.1
>   properties="camel.server.port=9999\ncamel.server.bindPort=9999"
> {code}
> {noformat}
> {"summary":{"total":2,"valid":2,"errors":0,"warnings":0},"properties":[
>  
> {"text":"camel.server.port=9999","accepted":false,"valid":true,"errors":0,"issues":[]},
>  
> {"text":"camel.server.bindPort=9999","accepted":false,"valid":true,"errors":0,"issues":[]}]}
> {noformat}
> {{camel.platform.http.server.port=9999}} and 
> {{camel.datasource.default.jdbc-url=...}} get the same answer. 
> {{camel.server.port}} is a real option and {{camel.server.bindPort}} is not, 
> but the answer is the same for both. For comparison, 
> {{camel.main.httpServerPort = 9999}} gets {{"accepted":true,"valid":false}} 
> and {{httpServerPort  Unknown option}}.
> h3. Cause
> {{AbstractCamelCatalog.acceptConfigurationPropertyKey}} (camel-core-catalog) 
> accepts only {{camel.component.}}, {{camel.dataformat.}}, 
> {{camel.language.}}, {{camel.main.}}, {{camel.resilience4j.}}, 
> {{camel.faulttolerance.}}, {{camel.threadpool.}}, {{camel.health.}}, 
> {{camel.lra.}} and {{camel.rest.}}. For any other key, 
> {{validateConfigurationProperty(String)}} returns right after 
> {{setAccepted(false)}} with no checks, and 
> {{PropertiesValidationResult.isSuccess()}} is true because no errors were 
> recorded. {{ConfigurationValidateTools.toPropertyValidationInfo}} copies both 
> flags as they are, and its summary counts the line as valid.
> The main-model branch already checks options against {{mainModel()}}, and 
> {{camel-main-configuration-metadata.json}} already has all the {{camel.*}} 
> groups: {{camel.server}} (28 options, including {{port}} and {{enabled}}), 
> {{camel.management}}, {{camel.ssl}}, {{camel.debug}}, {{camel.trace}}, 
> {{camel.routecontroller}}, {{camel.startupcondition}}, {{camel.security}}, 
> {{camel.vault.*}}, {{camel.opentelemetry}}, {{camel.opentelemetry2}}, 
> {{camel.metrics}}, {{camel.mdc}}, {{camel.errorRegistry}}, 
> {{camel.telemetryDev}} and {{camel.cluster.*}}. Those keys are not checked 
> only because they are missing from the hardcoded prefix lists, which are in 
> {{acceptConfigurationPropertyKey}} and again in the {{key.startsWith("main.") 
> || ...}} branch. {{camel.jbang.*}} has its own model ({{jbangModel()}}, 
> {{camel-jbang-configuration-metadata.json}}), which is not used here.
> Nothing has changed on main: CAMEL-23179 added the tool, and CAMEL-25118 
> fixed other validation bugs without touching the prefix list.
> h3. Fix
> # Build the accepted prefixes from the groups in the main configuration 
> metadata instead of the hardcoded lists, so that {{camel.server.*}}, 
> {{camel.management.*}}, {{camel.ssl.*}}, {{camel.vault.*}} and the other 
> groups go through the main-model branch. An unknown key under a known group, 
> such as {{camel.server.bindPort}}, then gets "Unknown option", with 
> suggestions when there are any.
> # Validate {{camel.jbang.*}} against {{jbangModel()}}.
> # For a {{camel.<x>.*}} key whose group is unknown, such as 
> {{camel.platform.http.server.port}} or {{camel.datasource.*}}, return a 
> warning ("not a known Camel configuration group", with the closest group as a 
> suggestion). {{camel.beans.*}}, {{camel.kamelet.*}} and the other prefixes 
> that are legal but have no model can stay unchecked.
> # In {{camel_configuration_validate}}, report a line that was not checked as 
> {{"checked":false}} (or rename {{accepted}}), do not count it in 
> {{summary.valid}} (add {{summary.unchecked}}), and say in the tool 
> description that such lines were not validated. A non-Camel key such as 
> {{mail.smtp.host}} should read as "not checked", not as "rejected".



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to