davsclaus opened a new pull request, #29498:
URL: https://github.com/apache/camel/pull/29498

   [CAMEL-26786](https://issues.apache.org/jira/browse/CAMEL-26786), step 5b of 
"let there be chaos" 
([CAMEL-26760](https://issues.apache.org/jira/browse/CAMEL-26760)), part 1: the 
Camel CLI. It builds on the experiments in the journal (#29480) and `camel cmd 
send --repeat` (#29459), both merged.
   
   An agent, or a person, runs one experiment in one call:
   
   ```
   $ camel cmd chaos-explore-start --budget=5m --focus=refunds
   Chaos exploration started: 5m0s (focus: refunds)
   
   $ camel cmd chaos-experiment --hypothesis='a refund never fails' \
       --rule='route=refunds error rate=every:5 expect=refunds:failed<=0 
within=20s' \
       --feed=refunds --body=R-1 --repeat=10 --interval=100ms --note='no error 
handler on refunds'
   Experiment 1 FAIL  a refund never fails (r1, ended after 3s)
     expect refunds:failed<=0: unmet, 2 failed
     routes: refunds 8 completed, 2 failed
     note: no error handler on refunds
     traffic: 10 messages sent to direct://refunds (2 failed) in 950ms
     waited 1s for the verdict; 4m49s left of the exploration
   
   $ camel cmd chaos-explore-finish
   Chaos exploration finished after 48s: 4 rules tried, 0 removed, 4 
experiments (2 failed)
   ```
   
   (Output from a real run against a small integration with chaos on, built 
from this branch. The traffic time printed "0s" in that run; it now prints 
sub-second times in millis.)
   
   **What changes**
   - `ChaosExperimentRun` (camel-jbang-core `common`) runs one experiment in 
one call, so the CLI and, next, the AI and MCP tools share it:
     1. begin the experiment;
     2. send the traffic of the feed (as `camel cmd send`);
     3. read the report in the status (written every second) until the verdict 
is no longer PENDING, the exploration ended the experiment at its deadline, or 
the wait is up;
     4. end the experiment, also when the send failed, so its rules never stay.
   - `camel cmd chaos-experiment`:
     - `--hypothesis`, `--rule` (repeatable, one with `expect=`), `--note`;
     - the feed: `--feed` (an endpoint or a route id, as the `feed:` line of 
chaos-suggest), with `--body`, `--header`, `--repeat` and `--interval`;
     - `--wait` (default 2m, at most 10m);
     - `--end` ends an open experiment.
     - It exits 1 on FAIL, as `camel run --chaos` does. INCONCLUSIVE prints a 
hint to wait longer than the `within=`.
   - `camel cmd chaos-explore-start` (`--budget`, `--focus`) and 
`chaos-explore-finish`.
   - `ListChaos.experimentLines` is shared, so `camel get chaos --report` and 
`chaos-experiment` print an experiment the same way.
   - Docs:
     - a "Chaos explorations" section in camel-jbang-managing;
     - a paragraph in the chaos doc (copied to the catalog);
     - the generated command pages and metadata.
   - Golden help regenerated. The `camel cmd` column is wider now because 
`chaos-explore-finish` is the longest name, so the list rewrapped.
   
   **Tests**
   - `ChaosExperimentRunTest`, with a fake integration and a clock that does 
not sleep:
     - the verdict ends the wait;
     - the wait runs out;
     - the send fails and the experiment is still ended;
     - the exploration ends the experiment at its deadline;
     - a refused begin is not ended.
   - `CamelChaosActionTest`: explore start and finish, `--end`, the usage 
errors, and the printed lines.
   - Full camel-jbang-core suite: 2724 + 318, all green.
   
   Part 2 (next PR): the same as tools for `camel ask` and the MCP server 
(`chaos_explore_start`, `chaos_experiment`, `chaos_explore_finish`).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS
   


-- 
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]

Reply via email to