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

   _Claude Code on behalf of Claus Ibsen_
   
   [CAMEL-26695](https://issues.apache.org/jira/browse/CAMEL-26695), step 2: 
add a chaos rule from the known rules. **Stacked on #29346** (step 1, the 
actions). Retarget to `main` once #29346 is merged.
   
   ![Adding a chaos rule from the known 
rules](https://raw.githubusercontent.com/apache/camel/CAMEL-26695-chaos-recipes/docs/user-manual/modules/ROOT/images/jbang/camel-tui-chaos-recipes.png)
   
   *Live, against `camel run --chaos`: the 17 recipes come from the catalog of 
the CLI. For "Returns an error (HTTP status)", the HTTP endpoint the route 
calls is picked; status, rate and until start with the recipe's defaults.*
   
   ### How it works
   - `a` on the Chaos screen now opens the known rules of camel-chaos: the 
recipes of the chaos model in the catalog (CAMEL-26689, 
`CamelCatalog.chaosModelJSon()`), grouped by what goes wrong (Downstream, 
Messages, Consumers and routes, Error handling).
   - Picking one opens a field for each placeholder of its rule.
     - **Values from the integration.** A placeholder with a `pick` gets its 
candidates from the status of the integration, cycled with ←/→ (and it can 
still be typed):
       - `producers`: the endpoints its routes send to, filtered by the 
placeholder's `schemes` (the HTTP endpoints for an HTTP status), without the 
query;
       - `pollingConsumers`: the endpoints it consumes with a scheduled poll;
       - `routes`;
       - `steps`: those with an id of their own first;
       - listed `values`, such as the corrupt modes.
     - **Defaults.** The other fields start with the recipe's default.
   - The rule is shown as it is built. Enter takes it to the confirmation of 
step 1. A missing value is named ("header needs a value") and Enter waits for 
it.
   - The last entry, "Write the rule yourself …", is the typed line of step 1.
   - **Older catalogs:** if the CLI's catalog has no chaos model (an older 
Camel), `a` goes straight to the typed line, as before.
   
   ### Code
   - `ChaosRecipes`: loads the recipes from `new 
DefaultCamelCatalog().chaosModelJSon()` (the CLI's own catalog, so nothing is 
downloaded), fills in a rule, and finds the candidates of a placeholder in the 
`IntegrationInfo`.
   - `ChaosRecipeForm`: the list and the form, their keys and the footer.
   - `ChaosControl`: a `RECIPES` step. It counts as text input, so digits and 
letters stay in the form.
   - Help page and `camel-jbang-tui-observe.adoc` updated, with the screenshot.
   
   ### Tests
   - `ChaosRecipesTest` (3): parsing the model, filling a rule, the candidates 
from an integration (schemes, scheduled consumers, steps with their own id 
first, values), and loading the real catalog.
   - `ChaosRecipeFormTest` (6):
     - the grouped list;
     - a recipe filled with the integration's HTTP endpoint and the defaults, 
through to the request;
     - ←/→ picking another route and a typed duration;
     - a missing header holding Enter;
     - the "write it yourself" entry;
     - Esc from the form to the list to closed;
     - the footer.
   - The whole camel-jbang-plugin-tui suite: 2315 tests pass (1 skipped).
   
   🤖 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