Skip to content

CAMEL-26933: camel-jbang-plugin-validate - validate exits with 66 for a missing file or nothing to validate - #29926

Merged
davsclaus merged 2 commits into
mainfrom
CAMEL-26933-validate-exit-codes
Nov 14, 2026
Merged

davsclaus merged 2 commits into
mainfrom
CAMEL-26933-validate-exit-codes

Conversation

@davsclaus

@davsclaus davsclaus commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Part of item 5 of CAMEL-26933: the exit codes of camel validate.

Problem

Agents run camel validate after every edit, so its exit codes need to say what happened. They disagreed:

  • camel validate yaml nope.yaml reported a validation error with exit 1 (YamlValidateCommand), while validate source and validate properties exit 66 (file not found) for a missing file.
  • camel validate source notes.txt printed "Validation success (files:0)" and exited 0 (SourceValidateCommand), although nothing was validated.
  • camel validate normalize notes.txt exited 0 with no output.

Change

  • validate yaml of a file that does not exist: exit 66, "File not found: ".
  • validate source with no file it can validate: exit 66, "No files to validate (YAML, XML, Java and properties files)", as validate yaml ("No YAML files to validate") and validate properties already do.
  • validate normalize with no YAML file: exit 66, "No YAML files to normalize".
  • The 4.24 upgrade guide has an entry, as scripts may check the old codes.

The rest of item 5 (validate yaml --camel-version=9.9.9, the wording of the messages, validate normalize dropping comments, application.yaml, validate properties options) is not in this PR.

Tests

  • ValidateJsonTest.theCommandsAgreeOnMissingFilesAndNothingToDo: the three cases.
  • The camel-jbang-plugin-validate tests pass (24).
  • CamelLauncherTest.testLauncherValidatePlugin validated cheese.yaml, which does not exist, and took the exit 1 of that as the validation error it checks. It now validates bad.yaml (an unknown setCheese step), which is a real validation error: exit 1, "Validation error detected (errors:1)".

Claude Code on behalf of davsclaus

🤖 Generated with Claude Code

… a missing file or nothing to validate

validate yaml of a missing file reported a validation error with exit 1, while validate
source and validate properties exit 66; validate source said "Validation success
(files:0)" and validate normalize exited 0 when no file could be handled. All three
exit 66 now, with a message that says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus davsclaus added this to the 4.24.0 milestone Nov 14, 2026
@davsclaus davsclaus added bug Something isn't working docs dsl labels Nov 14, 2026
@github-actions

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.

@gnodet

gnodet commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

🔄 Backport Bot

This bugfix targets main and may need porting to:

  • camel-4.22.x

Add a port/<branch> label to automatically create a backport PR for that branch.

Backport PRs will be created automatically on merge (once a port label is added). Comment /port to create them immediately.

ℹ️ If you push additional commits after /port, use /port again to update the port PRs.

@gnodet-bot gnodet-bot 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.

LGTM. The fix correctly aligns all three validate subcommands with the existing EX_NOINPUT exit-code contract (66), the test covers all three scenarios, and the upgrade guide documents the breaking change.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-jbang/camel-jbang-plugin-validate
  • dsl/camel-jbang/camel-launcher

🔬 Scalpel shadow comparison — Scalpel: 1 of 726 tested, 0 compile-only — current: 2 all tested

Maveniverse Scalpel detected 1 affected modules (current approach: 2).

Skip-tests mode would test 1 modules (3 direct + 0 downstream), skip tests for 0 (generated code, meta-modules)

Modules only in current approach (1)
  • camel-launcher-container
Modules Scalpel would test (1)
  • camel-jbang-plugin-validate ← dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/SourceValidateCommand.java, dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlNormalizeCommand.java, dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlValidateCommand.java, dsl/camel-jbang/camel-jbang-plugin-validate/src/test/java/org/apache/camel/dsl/jbang/core/commands/validate/ValidateJsonTest.java

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

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-plugin-validate: 1 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-launcher. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (4 modules, 48.2s total)

Total reactor time: 48.2s

Module Duration Status
Camel :: JBang :: Plugin :: Validate 29.8s SUCCESS
Camel :: Docs 17.7s SUCCESS
Camel :: Launcher :: Container 0.7s SUCCESS
Camel :: Launcher n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: Validate (29.8s)
  • Camel :: Docs (17.7s)
  • Camel :: Launcher :: Container (0.7s)

⚙️ View full build and test results

…validation error, not a missing file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus davsclaus self-assigned this Nov 14, 2026
@davsclaus
davsclaus merged commit d1bd749 into main Nov 14, 2026
14 checks passed
@davsclaus
davsclaus deleted the CAMEL-26933-validate-exit-codes branch November 14, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working docs dsl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants