Commit da38550
committed
fix(config): harden async config-write lifecycle and fail loud on reset errors
Follow-up hardening from the code review of the Channels async-write migration. Closes the
new exposures that the fire-and-forget writes introduced, plus adjacent findings:
- Lifecycle cancellation (review #1/#5): add a VM-lifetime CancellationTokenSource, thread
its token through the AddChannel / Reset / autosave entry points, and have Dispose cancel
it and DRAIN the in-flight write + label refresh before disposing the reactive state they
publish to. Pre-fix, closing the editor mid-write could let the write resume on a
thread-pool continuation and mutate a disposed ReactiveProperty / Step; the runtime path
also passed CancellationToken.None, so nothing honored cancellation.
- Reset fails loud (review #3): ApplyResetConfirmationAsync now surfaces ANY unexpected
exception (e.g. an InvalidOperationException from a type-malformed config reload) as an
Error status instead of letting it fault the fire-and-forget chain, where the next write's
catch swallowed it silently. Honors the no-silent-fallbacks rule.
- Search re-entrancy (review #6): SubmitCurrentConfigurationFromInputAsync now ignores a
re-entrant submit while a probe is in flight (returns the same task), closing the same
two-rapid-submits-race-the-disk-write hazard the Channels write chain fixed.
- Cleanup: collapse SaveCompletedAsync / SaveFromInputAsync onto one SaveViaAutosaveAsync
helper (#8); extract the shared ArrangeSlackResetWithLabelRefreshInFlight test setup (#9);
the single-worker SynchronizationContext test pump no longer dies on a throwing
continuation, which would mask a real failure as a generic deadlock (#7).
Tests: a dispose-drains-an-in-flight-write test (Channels) and a re-entrancy test (Search).
Deferred (pre-existing, tracked separately): the background label refresh and the save+reload
tail still mutate view-model state off the loop, so a concurrent on-loop edit during a network
resolve can lose an audience edit (review #2/#4). Eliminating that requires marshalling those
mutations back onto the loop (Termina exposes only RequestRedraw) and is its own change; the
lifetime cancellation here bounds the window and closes the disposal portion.1 parent b1fe119 commit da38550
5 files changed
Lines changed: 183 additions & 67 deletions
File tree
- src
- Netclaw.Cli.Tests/Tui
- Config
- Netclaw.Cli/Tui/Config
Lines changed: 66 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1291 | 1291 | | |
1292 | 1292 | | |
1293 | 1293 | | |
1294 | | - | |
1295 | | - | |
1296 | | - | |
1297 | | - | |
1298 | | - | |
1299 | | - | |
1300 | | - | |
1301 | | - | |
1302 | | - | |
1303 | | - | |
1304 | | - | |
1305 | | - | |
1306 | | - | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
| 1294 | + | |
1316 | 1295 | | |
1317 | 1296 | | |
1318 | 1297 | | |
| |||
1334 | 1313 | | |
1335 | 1314 | | |
1336 | 1315 | | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | 1316 | | |
1348 | 1317 | | |
1349 | 1318 | | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
1363 | 1322 | | |
1364 | 1323 | | |
1365 | 1324 | | |
| |||
1377 | 1336 | | |
1378 | 1337 | | |
1379 | 1338 | | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
1380 | 1372 | | |
1381 | 1373 | | |
1382 | 1374 | | |
| |||
1831 | 1823 | | |
1832 | 1824 | | |
1833 | 1825 | | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
1834 | 1855 | | |
1835 | 1856 | | |
1836 | 1857 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
212 | 233 | | |
213 | 234 | | |
214 | 235 | | |
| |||
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
71 | 89 | | |
72 | 90 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
| |||
248 | 255 | | |
249 | 256 | | |
250 | 257 | | |
251 | | - | |
252 | | - | |
253 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
254 | 264 | | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
258 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
259 | 272 | | |
260 | 273 | | |
261 | 274 | | |
| |||
290 | 303 | | |
291 | 304 | | |
292 | 305 | | |
293 | | - | |
| 306 | + | |
294 | 307 | | |
295 | 308 | | |
296 | | - | |
| 309 | + | |
297 | 310 | | |
298 | 311 | | |
299 | 312 | | |
| |||
1349 | 1362 | | |
1350 | 1363 | | |
1351 | 1364 | | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
1352 | 1375 | | |
1353 | 1376 | | |
1354 | 1377 | | |
| |||
1361 | 1384 | | |
1362 | 1385 | | |
1363 | 1386 | | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1364 | 1394 | | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1365 | 1406 | | |
| 1407 | + | |
1366 | 1408 | | |
1367 | 1409 | | |
1368 | 1410 | | |
| |||
1407 | 1449 | | |
1408 | 1450 | | |
1409 | 1451 | | |
1410 | | - | |
| 1452 | + | |
1411 | 1453 | | |
1412 | 1454 | | |
1413 | 1455 | | |
1414 | 1456 | | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
| 1457 | + | |
1421 | 1458 | | |
1422 | 1459 | | |
1423 | 1460 | | |
| |||
Lines changed: 28 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
313 | 323 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
319 | 331 | | |
320 | | - | |
321 | | - | |
322 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
323 | 342 | | |
324 | 343 | | |
325 | 344 | | |
| |||
0 commit comments