Commit dc9a5ff
committed
chore: post-PR-triad fixes (review + simplify)
Code review (pr-review-toolkit):
- rpc.go: drop dead `resp.Message = err.Error()` writes — Connect
discards the response on any non-nil error, so the assignments were
never observed by callers. Hoist resp allocation past the err guard
so the success path is the only allocator.
- plugin.go: introduce errPluginNotFound sentinel and an
errors.Is-based mapping helper (connectCodeFor) so the rpc handler
returns connect.CodeNotFound for missing plugins instead of
CodeInternal. CodeInternal is still the default for any other error.
- plugin.go: rewrite stale doc on the private status()/ready() helpers
(the prior wording was a copy-paste leftover from the goridge era
describing a public method that no longer exists).
- tests/plugin_test.go: drive-by lint cleanups — 3 more
http.NewRequest -> NewRequestWithContext(t.Context(), ...) sites
surfaced after fixing the first batch.
- tests/plugin_test.go: assert connect.CodeNotFound on the
StatusNonExistent / ReadyNonExistent subtests instead of string-
matching err.Error() — the typed sentinel makes the wire-code check
more robust.
- tests/plugin_test.go: TestRPCNonExistentPlugin no longer registers
http+server plugins. The test only exercises the "no such plugin"
path of the status RPC handler, doesn't need any Checker/Readiness
providers, and the previous setup pulled in a PHP worker dependency
that broke the test in PHP-less environments.
Simplify:
- Tighten doc comments on errPluginNotFound and connectCodeFor (cut
WHAT, keep WHY).
- Drop the now-unused errors.Op constants in status() and ready()
after dropping the errors.E wrap on the not-found path
(the wrap was hiding the sentinel from errors.Is — *errors.Error
has no Unwrap method).1 parent 558fc67 commit dc9a5ff
3 files changed
Lines changed: 33 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
136 | | - | |
137 | | - | |
138 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
139 | 143 | | |
140 | | - | |
141 | 144 | | |
142 | 145 | | |
143 | | - | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
149 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
150 | 155 | | |
151 | | - | |
152 | 156 | | |
153 | 157 | | |
154 | | - | |
| 158 | + | |
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
23 | | - | |
24 | 32 | | |
25 | 33 | | |
26 | | - | |
27 | | - | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | | - | |
46 | 53 | | |
47 | 54 | | |
48 | | - | |
49 | | - | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
672 | 675 | | |
673 | 676 | | |
674 | 677 | | |
675 | 678 | | |
676 | 679 | | |
677 | | - | |
678 | | - | |
679 | 680 | | |
680 | 681 | | |
681 | 682 | | |
| |||
728 | 729 | | |
729 | 730 | | |
730 | 731 | | |
731 | | - | |
| 732 | + | |
732 | 733 | | |
733 | 734 | | |
734 | 735 | | |
735 | 736 | | |
736 | 737 | | |
737 | 738 | | |
738 | | - | |
| 739 | + | |
739 | 740 | | |
740 | 741 | | |
741 | 742 | | |
| |||
830 | 831 | | |
831 | 832 | | |
832 | 833 | | |
833 | | - | |
| 834 | + | |
834 | 835 | | |
835 | 836 | | |
836 | 837 | | |
| |||
852 | 853 | | |
853 | 854 | | |
854 | 855 | | |
855 | | - | |
| 856 | + | |
856 | 857 | | |
857 | 858 | | |
858 | 859 | | |
| |||
869 | 870 | | |
870 | 871 | | |
871 | 872 | | |
872 | | - | |
| 873 | + | |
873 | 874 | | |
874 | 875 | | |
875 | 876 | | |
| |||
0 commit comments