CAMEL-24854: the validator reports an include/exclude regex with a doubled backslash, which matches no file - #26637
Conversation
…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
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet-bot
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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 withDOUBLED_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.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 6 of 692 tested, 8 compile-only — current: 6 all testedMaveniverse 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)
|
| 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)
…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>
Description
From the round-2 benchmark (series l3): after the validator's hint for
include: ".*\.json$"(an unknown escape in double quotes, correctly answered withwrite the value in single quotes: '.*\.json$'), the model wroteinclude: '.*\\.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: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