breken-ai opened a new pull request, #938:
URL: https://github.com/apache/burr/pull/938

   `Application.visualize()` and `Graph.visualize()` pass `**engine_kwargs` 
through to `graphviz.Digraph`. Dict values are merged into Burr's default 
attributes. Only `graph_attr` and `node_attr` have defaults, so any other 
attribute dict fails. For example, styling edges:
   
   ```python
   app.visualize(edge_attr={"color": "red"})
   # KeyError: 'edge_attr'
   #   burr/core/graph.py, in visualize: digraph_attr[g_key].update(**g_value)
   ```
   
   ## Changes
   
   - `burr/core/graph.py`: merge into `digraph_attr.setdefault(g_key, {})`, so 
a dict kwarg with no Burr default is passed to graphviz as given. `graph_attr` 
/ `node_attr` still merge over Burr's defaults, as before.
   - `tests/core/test_graphviz_display.py`: a regression that passes 
`graph_attr`, `node_attr` and `edge_attr`, and checks that each reaches the 
`Digraph` with Burr's defaults kept.
   
   ## How I tested this
   
   - On `main` (`8161159`), the new test fails with `KeyError: 'edge_attr'`. 
With the fix, it passes.
   - End to end, `ApplicationBuilder()...build().visualize(edge_attr={"color": 
"red"})` raises `KeyError` on `main`. On this branch it returns a `Digraph` 
with `edge_attr == {"color": "red"}`.
   - `pytest tests/core`: 401 passed (with `graphviz` installed).
   - black 23.11.0 (`--line-length=100`), isort 5.12.0 and flake8 6.1.0 at the 
pre-commit pins are clean on the changed files.
   
   ## Notes
   
   This is a one-line change. The merge loop has been in place since f1d935b 
(2024-06).
   
   ## Checklist
   
   - [x] PR has an informative and human-readable title (this will be pulled 
into the release notes)
   - [x] Changes are limited to a single goal (no scope creep)
   - [x] Code passed the pre-commit check & code is left cleaner/nicer than 
when first encountered.
   - [x] Any _change_ in functionality is tested
   - [ ] New functions are documented (with a description, list of inputs, and 
expected output) (no new functions)
   - [ ] Placeholder code is flagged / future TODOs are captured in comments 
(none added)
   - [ ] Project documentation has been updated if adding/changing 
functionality (no documented behavior changes; `engine_kwargs` is already 
documented as passed to the engine)
   
   ---
   
   **AI disclosure (per the [ASF Generative Tooling 
guidance](https://www.apache.org/legal/generative-tooling.html)):** an AI 
coding tool (Claude Code, Claude Opus 5.5) wrote this change through the 
`breken-ai` account. The tool found the bug, wrote the fix and the test, and 
wrote this description. The commit carries a `Generated-by:` trailer. The diff 
is a small original change to existing Burr code and includes no third-party 
material. The red/green runs above are real, and you can re-run them from the 
diff. If you would rather not take AI-assisted contributions here, say so and I 
will close this.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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