Skip to content

CAMEL-24854: the validator reports an include/exclude regex with a doubled backslash, which matches no file - #26637

Merged
davsclaus merged 3 commits into
mainfrom
fix/CAMEL-24854
Sep 21, 2026
Merged

davsclaus merged 3 commits into
mainfrom
fix/CAMEL-24854

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Description

From the round-2 benchmark (series l3): after the validator's hint for include: ".*\.json$" (an unknown escape in double quotes, correctly answered with write the value in single quotes: '.*\.json$'), the model wrote include: '.*\\.json$', doubling the backslash as a Java string would. Inside single quotes YAML keeps both, the regex then matches a file name containing a literal backslash, no file matched, and the route ran ten seconds in silence. A person used to Java strings makes the same slip.

EndpointChecks.checkRegexOptions, which already parses include/exclude on the file components, now reports a value with a doubled backslash:

Line 5: file: include=.*\\.json$ matches a backslash in the file name (in single quotes one backslash escapes the dot): write include='.*\.json$'

Tests

SourceValidatorEndpointTest.aDoubledBackslashInAnIncludeRegexIsReported: the doubled form is reported with the form to write, the single-backslash form is not.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj

…ubled backslash, which matches a literal backslash in the file name and so no file

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj
@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.

@github-actions github-actions Bot added the dsl label Sep 20, 2026

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

The detection logic and fix suggestion are correct — a doubled backslash in YAML single-quoted include/exclude produces a regex that matches a literal backslash in the filename instead of the intended pattern, so the route runs in silence. One nit on the user-facing error message wording.

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

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

Two issues with the new check in checkRegexOptions.

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

…r a single backslash would escape, and the message explains the regex rather than YAML

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>

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

Both previous findings addressed:

  • Wording nit ✅ — parenthetical now correctly explains regex semantics (\\ is one literal backslash, \. matches a dot), no longer conflates with YAML single-quote escaping rules.
  • False-positive on intentional \\ ✅ — value.contains("\\\\") replaced with DOUBLED_BACKSLASH_ESCAPE.matcher(value).find(), which only fires when \\ precedes a character that \ would escape in a regex (., d, s, w, b, (, [, {, etc.). The .*\\myfile.* case is now correctly left alone, with a test to prove it.

The pattern itself is correct — checked the character class: [.dswDSWbB()\[\]{}+*?|^$] matches all regex shorthands and metacharacters where a doubled backslash is a user mistake, while leaving intentional literal-backslash patterns (\\m, \\f, etc.) untouched.

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

@github-actions

github-actions Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-core

🔬 Scalpel shadow comparison — Scalpel: 6 of 692 tested, 8 compile-only — current: 6 all tested

Maveniverse Scalpel detected 15 affected modules (current approach: 6).

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

⚠️ Modules only in Scalpel (9)
  • 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-launcher
  • coverage
Modules Scalpel would test (6)
  • camel-jbang-core ← dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/EndpointChecks.java, dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/YamlLines.java, dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidatorEndpointTest.java
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-jbang-core
  • 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-jbang-core
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-jbang-core
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
Modules with tests skipped (8)
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-launcher
  • coverage

ℹ️ 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-core: 2 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core. 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 (15 modules, 3m 9s total)

Total reactor time: 3m 9s

Module Duration Status
Camel :: Launcher 58.0s SUCCESS
Camel :: JBang :: MCP 45.2s SUCCESS
Camel :: JBang :: Plugin :: TUI 38.5s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 17.6s SUCCESS
Camel :: JBang :: Plugin :: Testing 9.8s SUCCESS
Camel :: JBang :: Plugin :: Validate 6.6s SUCCESS
Camel :: Coverage 5.1s SUCCESS
Camel :: JBang :: Plugin :: Edit 1.6s SUCCESS
Camel :: JBang :: Plugin :: Route Parser 1.5s SUCCESS
Camel :: JBang :: Plugin :: Generate 1.3s SUCCESS
Camel :: JBang :: Plugin :: MCP 1.1s SUCCESS
Camel :: JBang :: Main 1.0s SUCCESS
Camel :: JBang :: Integration tests 0.9s SUCCESS
Camel :: Launcher :: Container 0.8s SUCCESS
Camel :: JBang :: Core n/a

Top 20 slowest modules:

  • Camel :: Launcher (58.0s)
  • Camel :: JBang :: MCP (45.2s)
  • Camel :: JBang :: Plugin :: TUI (38.5s)
  • Camel :: JBang :: Plugin :: Kubernetes (17.6s)
  • Camel :: JBang :: Plugin :: Testing (9.8s)
  • Camel :: JBang :: Plugin :: Validate (6.6s)
  • Camel :: Coverage (5.1s)
  • Camel :: JBang :: Plugin :: Edit (1.6s)
  • Camel :: JBang :: Plugin :: Route Parser (1.5s)
  • Camel :: JBang :: Plugin :: Generate (1.3s)
  • Camel :: JBang :: Plugin :: MCP (1.1s)
  • Camel :: JBang :: Main (1.0s)
  • Camel :: JBang :: Integration tests (0.9s)
  • Camel :: Launcher :: Container (0.8s)

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.23.0 milestone Sep 21, 2026
…does, so ".*\\.pdf" is the regex .*\.pdf and is not reported

The doubled-backslash check fired on every doc example written as
include: ".*\\.pdf" (CatalogDocExamplesTest): YamlLines.unquote stripped
the quotes and kept the escapes, so the check saw two backslashes where
the runtime sees one. In double quotes the escapes are decoded with
Jsoner.unescape (the JSON escapes are the YAML ones that matter, a
YAML-only one such as \e keeps the text as written); in single quotes a
backslash stays a backslash, which is the case the check is for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus
davsclaus merged commit 3989606 into main Sep 21, 2026
5 checks passed
@davsclaus
davsclaus deleted the fix/CAMEL-24854 branch September 21, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants