Skip to content

CAMEL-25380: camel-yaml-dsl - Do not log the compact notation warning for the Kamelets of the Kamelet catalog - #27448

Merged
davsclaus merged 3 commits into
mainfrom
fix/CAMEL-25380
Oct 6, 2026
Merged

davsclaus merged 3 commits into
mainfrom
fix/CAMEL-25380

Conversation

@davsclaus

@davsclaus davsclaus commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

https://issues.apache.org/jira/browse/CAMEL-25380

Using timer-source, extract-field-action or predicate-filter-action logged this on every load and dev-mode reload:

WARN YAML DSL compact notation detected in: classpath:kamelets/timer-source.kamelet.yaml. ... Use Camel CLI to normalize: camel validate normalize <file>

That tells the user, or an AI agent reading the log, to normalize a file of the Kamelet catalog, which they can't change.

With this PR the warning is skipped only for a file under kamelets/ in a camel-kamelets jar, however it was loaded: classpath:kamelets/..., a scan of the jar, or a jar nested in a Spring Boot jar. This is checked only when the warning is about to be logged. The application's own files, in its jar or not, custom Kamelets included, are still warned about. The yaml-dsl docs mention the exemption.

The catalog itself is made canonical in apache/camel-kamelets#3089. This exemption keeps older pinned Kamelet catalog versions quiet.

Tests in CompactNotationWarnTest:

  • A compact file in a camel-kamelets-4.22.1.jar is not warned about. This test fails without the change.
  • The same file in my-app.jar is warned about.
  • A compact file on the classpath outside a jar is warned about.

The class loader is restored after each test. camel-yaml-dsl passes 461 of 461.

🤖 Generated with Claude Code

https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m

… for YAML inside a jar

The Kamelets of the Kamelet catalog are compact, and every user of timer-source
was told to normalize a file inside a jar they cannot change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
@github-actions github-actions Bot added the dsl label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@Croway Croway left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this — the timer-source case is real. I ran a few reproducers against the PR head (71de42e3ad04) and "is it inside a jar" turns out to be a proxy for "is it the user's file" that misfires in both directions:

1. User's own files referenced explicitly are silenced.
A compact route in the application's own jar, loaded via classpath:routes/my-route.yaml, produces no warning. Same for a user's custom Kamelets packaged under classpath:kamelets/ in an uber jar — those are files the user owns and should normalize.

2. …but the same file via a wildcard still warns.
classpath:routes/*.yaml (camel-main style) scans the jar into a PackageScanJarResource with location file:/…/my-app.jar!/routes/my-route.yaml — not classpath:-prefixed, so it warns:

YAML DSL compact notation detected in: file:/…/my-app.jar!/routes/my-route.yaml. …

So the same file warns or not depending on how it's referenced.

3. Non-jar archive protocols still warn.
A classpath resource served via vfs: (WildFly) still logs the "fix this file" warning; same expected for wsjar:, bundle:, Quarkus native resource::

YAML DSL compact notation detected in: classpath:archived/compact.yaml. …

4. Lookup cost on every load.
isInsideJar runs in newYamlDeserializationContext, i.e. twice per resource (pre-parse + parse) and on every reload, even for canonical files that will never warn — 2 lookups for a single canonical route in my reproducer.

Suggestion: decide by origin rather than URL protocol — e.g. suppress for templates loaded via RouteTemplateHelper/KameletRoutesBuilderLoader from the default Kamelet location, and keep warning for user route locations. If the jar check stays, resource.getURI() already resolves classpath URLs (no need to re-derive the path), and it could run lazily inside warnCompactNotationOnce.

Minor:

  • CompactNotationWarnTest leaves the context on the closed URLClassLoader — restore the original in a finally.
  • Add a test asserting a non-jar classpath file still warns, so over-silencing is caught.
  • yaml-dsl.adoc "Compact notation warning" section should mention the exemption.

Reproducer test class available on request.

Claude Code on behalf of Croway

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • dsl/camel-yaml-dsl/camel-yaml-dsl-common
  • dsl/camel-yaml-dsl/camel-yaml-dsl

🔬 Scalpel shadow comparison — Scalpel: 11 of 699 tested, 26 compile-only — current: 11 all tested

Maveniverse Scalpel detected 11 affected modules (current approach: 11).

Skip-tests mode would test 11 modules (2 direct + 10 downstream), skip tests for 26 (generated code, meta-modules)

Modules Scalpel would test (11)
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-yaml-dsl
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-route-parser ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-semantic ← downstream of org.apache.camel:camel-yaml-dsl-common
  • camel-typesafe-ai ← downstream of org.apache.camel:camel-semantic
  • camel-yaml-dsl-common ← dsl/camel-yaml-dsl/camel-yaml-dsl-common/src/main/java/org/apache/camel/dsl/yaml/common/YamlDeserializationContext.java
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-yaml-dsl
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (26)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (38 modules, 5m 48s total)

Total reactor time: 5m 48s

Module Duration Status
Camel :: Launcher 48.5s SUCCESS
Camel :: JBang :: Plugin :: TUI 43.2s SUCCESS
Camel :: JBang :: MCP 38.7s SUCCESS
Camel :: Catalog :: Camel Catalog 22.5s SUCCESS
Camel :: YAML DSL :: Validator 19.1s SUCCESS
Camel :: Component DSL 18.7s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 18.5s SUCCESS
Camel :: YAML DSL 18.4s SUCCESS
Camel :: AI :: TypeSafe AI 15.2s SUCCESS
Camel :: Docs 14.2s SUCCESS
Camel :: Kamelet Main 12.7s SUCCESS
Camel :: AI :: Semantic Evaluation 8.3s SUCCESS
Camel :: JBang :: Plugin :: Testing 8.0s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 7.5s SUCCESS
Camel :: YAML DSL :: Deserializers 7.4s SUCCESS
Camel :: Catalog :: Camel Route Parser 7.0s SUCCESS
Camel :: YAML DSL :: Common 7.0s SUCCESS
Camel :: JBang :: Plugin :: Validate 5.5s SUCCESS
Camel :: All Components Sync point 4.5s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 3.9s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 2.6s SUCCESS
Camel :: YAML DSL :: Maven Plugins 2.5s SUCCESS
Camel :: Catalog :: Maven 2.0s SUCCESS
Camel :: Assembly 1.6s SUCCESS
Camel :: Coverage 1.4s SUCCESS
Camel :: JBang :: Plugin :: Edit 1.3s SUCCESS
Camel :: Endpoint DSL :: Support 1.2s SUCCESS
Camel :: JBang :: Plugin :: Generate 1.2s SUCCESS
Camel :: Catalog :: Dummy Component 1.0s SUCCESS
Camel :: JBang :: Plugin :: MCP 0.8s SUCCESS
Camel :: JBang :: Integration tests 0.7s SUCCESS
Camel :: JBang :: Main 0.7s SUCCESS
Camel :: Launcher :: Container 0.7s SUCCESS
Camel :: Catalog :: Console 0.6s SUCCESS
Camel :: JBang :: Plugin :: Route Parser 0.5s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a

Top 20 slowest modules:

  • Camel :: Launcher (48.5s)
  • Camel :: JBang :: Plugin :: TUI (43.2s)
  • Camel :: JBang :: MCP (38.7s)
  • Camel :: Catalog :: Camel Catalog (22.5s)
  • Camel :: YAML DSL :: Validator (19.1s)
  • Camel :: Component DSL (18.7s)
  • Camel :: JBang :: Plugin :: Kubernetes (18.5s)
  • Camel :: YAML DSL (18.4s)
  • Camel :: AI :: TypeSafe AI (15.2s)
  • Camel :: Docs (14.2s)
  • Camel :: Kamelet Main (12.7s)
  • Camel :: AI :: Semantic Evaluation (8.3s)
  • Camel :: JBang :: Plugin :: Testing (8.0s)
  • Camel :: Catalog :: Camel Report Maven Plugin (7.5s)
  • Camel :: YAML DSL :: Deserializers (7.4s)
  • Camel :: Catalog :: Camel Route Parser (7.0s)
  • Camel :: YAML DSL :: Common (7.0s)
  • Camel :: JBang :: Plugin :: Validate (5.5s)
  • Camel :: All Components Sync point (4.5s)
  • Camel :: YAML DSL :: Validator Maven Plugin (3.9s)

⚙️ View full build and test results

…the Kamelet catalog are not warned about

Review: "inside a jar" was a proxy for "not the user's file" that misfired both
ways (the application's own jar silenced, the same file through a wildcard scan
warned, other archive protocols warned) and looked up every resource on every
load. Now only a file under kamelets/ in a camel-kamelets jar is exempt, however
it was loaded, and that is asked only when the warning is about to be logged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
@davsclaus davsclaus changed the title CAMEL-25380: camel-yaml-dsl - Do not log the compact notation warning for YAML inside a jar CAMEL-25380: camel-yaml-dsl - Do not log the compact notation warning for the Kamelets of the Kamelet catalog Oct 6, 2026
@davsclaus

Copy link
Copy Markdown
Contributor Author

Thanks @Croway, agreed: "inside a jar" was the wrong test. Reworked in 7b5cf88 to decide by origin, as you suggested:

  • Only the Kamelet catalog is exempt. Only a file under kamelets/ in a camel-kamelets jar skips the warning. This is matched on the resource location and on its resolved URI, so classpath:kamelets/..., a scan of the jar, and a jar nested in a Spring Boot jar are all treated the same.
    • Your 1 and 2: the application's own jar and custom Kamelets warn again, whether loaded explicitly or by wildcard.
    • Your 3: other archive protocols warn as for any user file.
  • Lazy (your 4): the check runs inside warnCompactNotationOnce, only when a warning is about to be logged. Canonical files never trigger a lookup. The YamlRoutesBuilderLoaderSupport change is reverted.
  • Minor points: the class loader is restored in a finally. New tests check that a user's jar and a plain classpath file still warn. yaml-dsl.adoc documents the exemption.

Claude Code on behalf of Claus Ibsen

@github-actions github-actions Bot added the docs label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

✅ Generated files are up to date

An earlier CI run reported uncommitted generated changes; the latest run no longer does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
@davsclaus
davsclaus merged commit f05e340 into main Oct 6, 2026
7 checks passed
@davsclaus
davsclaus deleted the fix/CAMEL-25380 branch October 6, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants