Commit b6ee9ca
authored
* fix: prevent operation report from returning null when a link paw is absent (#3048)
Three related KeyErrors in c_operation.py could cause Operation.report()
to silently return None, which the API then serialised as JSON null and
the UI rendered as "Null":
1. `agents_steps[step.paw]` in report() raised KeyError when a link's
paw was not in the set of operation agents built at call time (e.g.
the agent was removed between operation run and report download).
Fixed with `agents_steps.setdefault(step.paw, {'steps': []})`.
2. `abilities_by_agent[link.paw]` in _get_all_possible_abilities_by_agent()
had the same pattern — orphan paw not guarded. Fixed with an
explicit membership check before the extend.
3. The `except Exception` block in report() logged the error but fell
off the end of the function, returning None implicitly. The caller
then returned None to web.json_response(), producing the "Null"
download. Fixed by re-raising so the framework returns a proper 500
with an error body instead of a silent null payload.
Adds a regression test that constructs an operation with a chain link
whose paw is not present in operation.agents and asserts report()
returns a non-None dict that includes the orphan paw's steps.
* style: fix E303 too many blank lines in test_operation.py
* refactor: simplify double dict lookup using abilities_by_agent.get()
1 parent 981ab92 commit b6ee9ca
2 files changed
+47
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
| 346 | + | |
| 347 | + | |
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
| |||
487 | 488 | | |
488 | 489 | | |
489 | 490 | | |
490 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
491 | 494 | | |
492 | 495 | | |
493 | 496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
630 | 671 | | |
631 | 672 | | |
632 | 673 | | |
| |||
0 commit comments