davsclaus opened a new pull request, #29466: URL: https://github.com/apache/camel/pull/29466
## What [CAMEL-26773](https://issues.apache.org/jira/browse/CAMEL-26773): the journal of an exploration, in camel-chaos. Step 4 of [CAMEL-26760](https://issues.apache.org/jira/browse/CAMEL-26760) ("let there be chaos"). Decided with Claus: the journal lives in camel-chaos with the deadline, so the report, `camel get chaos` and the TUI read it, it survives the agent losing context, and camel-chaos enforces the budget whatever the agent does. ``` $ camel get chaos --report ... exploration: running, 6m12s left of 10m0s, focus: orders rules tried: r1, r2 baseline (before the first rule): orders 30 completed, 0 failed ``` ## Changes - `ChaosExploration` (new): start, budget and deadline, focus, the rules added while it ran, the baseline, and how it finished. Guarded by the lock of the manager. - `ChaosManager.startExploration(budget, focus)` and `finishExploration()`, public for the CLI connector, which calls them by reflection: - one exploration at a time; budget 10m by default, between 10s and 2h; - while it runs, a rule ends at the deadline at the latest (`endsAt` capped), also a changed one, and a rule that would start after it (`from=`) is refused, with none of the rules of the add added; - the deadline is checked whenever chaos is used: a rule added or changed, the report read (which the status does every second), a start or finish. At the deadline the rules are removed (`clearRules`) and it is finished (`finishedBy: deadline`). This follows the clock of `TimeSource`, so it works in virtual time too (camel-test-dst); - chaos counts the exchanges from the start of an exploration, not only once a rule is there, and the first rule takes the baseline: the counts per route of the run without faults before it, so the failures that were there already are not blamed on chaos; - a scenario loaded while it runs (a reset of the report) keeps it running with the baseline at zero (`baselineReset`); a reset after it finished drops it. - `ChaosReport`: `exploration` in the JSON, and a section in the text. - CLI connector: `explore-start` (`budget`, `focus`) and `explore-finish` commands of the `chaos` action. - `camel get chaos --report` prints the exploration. - Docs: "An exploration" in the chaos doc; catalog copy. - Next (step 5): one experiment per call, recorded in this journal, and the AI and MCP tools for start, experiment and finish. ## Tests - `ChaosExplorationTest` (new, on a fake clock): the baseline before the first rule and the rules tried, rules capped to the deadline, the time left, finished at the deadline with the rules removed; finished before the deadline; one at a time, the limits of the budget, a rule that starts after the deadline refused and a new exploration after the last one's time is up; a changed rule capped too; a scenario loaded while it runs, and a reset after it finished. - `LocalCliConnectorChaosActionTest.anExplorationStartsAndFinishes`, `ListChaosTest.theExplorationInTheReport`. - Local runs, all passing: camel-chaos (812), camel-cli-connector `LocalCliConnectorChaosActionTest`, camel-jbang-core `ListChaosTest` + `CamelChaos*Test`. _Claude Code on behalf of Claus Ibsen_ -- 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]
