Repository navigation
Commit f92f8fa
fix(compare): skip a compare_list entry with no id instead of crashing (#5472)
Compare.run_all() indexed tariff["id"] directly, so a compare_list entry
missing its id line raised KeyError every 5-minute cycle - and because the
crash skipped predbat.py's compare_active reset, the comparison (and the
crash) kept re-triggering until the config was fixed.
The id lookup and its warning are now in their own get_tariff_id() method,
so the guard can be tested directly rather than only by inspecting run_all()'s
source text (code review for #5472 found the source-inspection test alone
would pass a guard that checked the wrong field, e.g. tariff.get("name")).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent d7d8c60 commit f92f8fa
3 files changed
Lines changed: 69 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
595 | 603 | | |
596 | 604 | | |
597 | 605 | | |
| |||
672 | 680 | | |
673 | 681 | | |
674 | 682 | | |
675 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
676 | 687 | | |
677 | 688 | | |
678 | 689 | | |
| |||
684 | 695 | | |
685 | 696 | | |
686 | 697 | | |
687 | | - | |
| 698 | + | |
688 | 699 | | |
689 | 700 | | |
690 | 701 | | |
691 | | - | |
| 702 | + | |
692 | 703 | | |
693 | 704 | | |
694 | 705 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1430 | 1430 | | |
1431 | 1431 | | |
1432 | 1432 | | |
1433 | | - | |
| 1433 | + | |
| 1434 | + | |
1434 | 1435 | | |
1435 | | - | |
1436 | | - | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
1437 | 1440 | | |
1438 | 1441 | | |
1439 | 1442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
720 | 769 | | |
721 | 770 | | |
722 | 771 | | |
| |||
0 commit comments