Commit 9452a1e
backend/unbounded: test PatchSettings dispatches UnboundedKey
A typo on the diff key (settings.UnboundedKey →
settings.UnboundedKye) or a removal of the unbounded.Apply()
call would silently leave the UI toggle persisted but inert.
The peer-share side has TestPatchSettings_PeerShareDispatches
catching exactly this class of regression; mirror it for
Unbounded.
unbounded/unbounded.go:
- Add applyHook: a nil-in-production function pointer invoked
at the top of Apply(), before any state check. Backend tests
install a counter via SetApplyHookForTest to verify dispatch.
This is the smallest possible test surface — exposing the
manager's internals across packages just for the test wiring
would be a much bigger surface, and the hook fires regardless
of the Enabled() gate so tests catch dispatch even when no
transition results.
backend/radiance_test.go:
- TestPatchSettings_UnboundedDispatches: install the hook,
PATCH {UnboundedKey:true}, assert hook fired once; PATCH
{UnboundedKey:false}, assert hook fired twice. Then PATCH
{PeerShareEnabledKey:false} (a key OTHER than UnboundedKey)
and assert the counter doesn't move — confirms the diff
check is in place rather than always firing.
Sanity-checked the test by removing the Apply call from
PatchSettings: test fails with 'expected 2, actual 0'.
Restored: test passes.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 991afac commit 9452a1e
2 files changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
203 | 206 | | |
204 | 207 | | |
205 | 208 | | |
| |||
337 | 340 | | |
338 | 341 | | |
339 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
340 | 360 | | |
341 | 361 | | |
342 | 362 | | |
| |||
0 commit comments