Commit e449bec
committed
fix(db): count IP-space subscriptions with COUNT(*), not SELECT ips.*
list_ip_range_subscriptions_by_space_paginated built its count query as
'SELECT ips.* ...' and ran it via query_scalar().fetch_one(). For any IP
space with zero subscriptions that fetch_one hit an empty result set and
returned RowNotFound, surfacing as a spurious 404 from the admin
GET /ip_space/{id}/subscriptions endpoint (and a wrong count otherwise).
Use 'SELECT COUNT(*)' so fetch_one always returns exactly one row.
Also harden the e2e test: it previously read spaces.first() off the shared
list, which was None on a fresh DB (a vacuous pass that hid the bug) and a
TOCTOU race against other tests under parallel load. It now creates its own
198.51.100.0/24 space and queries that id. Full e2e suite: 115/115.1 parent 6724818 commit e449bec
2 files changed
Lines changed: 52 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2788 | 2788 | | |
2789 | 2789 | | |
2790 | 2790 | | |
2791 | | - | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
2792 | 2796 | | |
2793 | 2797 | | |
2794 | 2798 | | |
2795 | 2799 | | |
2796 | | - | |
2797 | | - | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
2798 | 2805 | | |
2799 | 2806 | | |
2800 | 2807 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
1018 | | - | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
1019 | 1025 | | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
1023 | 1031 | | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
1029 | 1046 | | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1035 | 1052 | | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1043 | 1064 | | |
1044 | 1065 | | |
1045 | 1066 | | |
| |||
0 commit comments