davsclaus opened a new pull request, #28040:
URL: https://github.com/apache/camel/pull/28040
CAMEL-25744: in the overnight benchmark of Oct 17-18 (ten runs of a local
model on the example ladder), the hardest step asks for a timer that fires
twice and picks a file on the first fire with `CamelTimerCounter`.
- **The mistake:** in 8 of the 10 runs, the model compared the counter with
0. The counter counts the fires from 1 (`TimerConsumer` uses
`incrementAndGet()`), so `== 0` is never true, and both fires took the second
file.
- **Why the model did not catch it:** the option description says so since
CAMEL-25530, but the model looked it up in only 2 of the runs. And
`camel_validate_source` accepted the route.
## What
- `HeaderChecks` reports a comparison of `CamelTimerCounter` that can never
be true (`== 0`, `<= 0`, `< 1`) or never be false (`!= 0`).
- The message: "CamelTimerCounter counts the fires from 1 (the first fire is
1), so == 0 is never true: compare with 1 to pick the first fire".
- It covers the Simple forms (`${exchangeProperty.CamelTimerCounter} == 0`,
`${header.CamelTimerCounter == 0 ? ...}`) and the Groovy one
(`exchange.getProperty('CamelTimerCounter', Integer) == 0`).
Reading the counter as `${header.CamelTimerCounter}` stays valid: a header
lookup in Simple falls back to the exchange properties, and the validator
already accepts it when `includeMetadata` is true.
## Tests
- `SourceValidatorEndpointTest`: three comparisons are reported (`== 0`, `!=
0`, `< 1`), and comparisons with 1 pass.
- All camel-jbang-core tests pass (2531), `CatalogDocExamplesTest` included:
no documentation example compares the counter with 0.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]