Commit 8b60c84
committed
fix(client): make DevframeRpcClient.close() optional
Copilot's review on this PR flagged both close() additions
(DevframeRpcClient and DevframeRpcClientMode) as a breaking change:
adding a required property to an exported, externally-implementable
interface breaks any existing consumer that hand-types a mock/adapter
against it without close() — as this repo's own rpc-auth-gate.test.ts
mock did until now.
Made close?: () => void on both interfaces instead. Every factory this
repo owns (createWsRpcClientMode, createStaticRpcClientMode) still
provides it unconditionally, so nothing here loses close(); only the
type requirement is relaxed. getDevframeRpcClient's close now calls
mode.close?.() to match.
Updated the three call sites that invoked close() directly against the
now-optional type (rpc.test.ts, rpc-ws-status.test.ts) to close?.(), and
removed the auth-gate mock's close() entirely rather than keep it,
since a mode without one is now exactly the scenario this is meant to
keep working — a new test asserts rpc.close() against it doesn't throw.
Verified with a full `pnpm run build` + `pnpm exec vitest run --project
tests -u`: only the client tsnapi snapshot changed (close: () => void
-> close?: () => void), nothing else. Full suite: 101 files, 1088 tests
(was 1087), all green. `pnpm run typecheck` and `pnpm run lint` clean
across all 22 packages.
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 8300293 commit 8b60c84
5 files changed
Lines changed: 27 additions & 9 deletions
File tree
- packages/devframe/src/client
- tests/__snapshots__/tsnapi/devframe
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
141 | 155 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
206 | 210 | | |
207 | | - | |
| 211 | + | |
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
| |||
223 | 227 | | |
224 | 228 | | |
225 | 229 | | |
226 | | - | |
| 230 | + | |
227 | 231 | | |
228 | 232 | | |
229 | 233 | | |
| |||
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
390 | | - | |
| 394 | + | |
391 | 395 | | |
392 | 396 | | |
393 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
0 commit comments