Commit ef29e02
Seven findings, batched into one cleanup PR.
PR #3 (file-watcher) findings:
* watcher.py:30 — drop unused ``import time``.
* watcher.py:336 — type ``_log_future_exception`` parameter as
``concurrent.futures.Future`` (NOT ``asyncio.Future``); that's
what ``asyncio.run_coroutine_threadsafe`` returns. Catch its
cancellation/state errors plus the asyncio variants so the
callback can't itself crash on a concurrent cancellation.
* main.py:560 — surface stderr/stdout when watcher mine returns
non-zero. The rc alone hides 'No mempalace.yaml found' / python
tracebacks operators need to diagnose.
* main.py:1202 — ``GET /watch`` now double-checks
``watcher.is_running`` so a thread crash that flips is_running
to False between startup and now is reflected in the endpoint
response. Lifespan still gates publication; this adds defense
in depth.
PR #4 (mine-queue) findings:
* main.py drain replay — re-apply optional ``extract`` and
``limit`` fields. The prior drain dropped them silently, so a
queue entry with those fields got replayed without. Live /mine
accepts them; replay must too.
* main.py drain replay — enforce the same safety guards as the
live /mine endpoint: ``isinstance(dir, str)``, absolute-path,
no ``..`` traversal, ``mode in {convos, projects}``, ``extract
in {exchange, general}`` if set, ``limit`` int-coercible if
set. Without these a queue entry could smuggle through values
the live endpoint would 400.
Tests: +2 — replay-extract-and-limit (asserts the new fields
make it onto the subprocess argv) and skips-invalid-payload-fields
(5 invalid-payload variants, each correctly skipped pre-spawn).
35 daemon tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 924d078 commit ef29e02
3 files changed
Lines changed: 135 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
388 | 394 | | |
389 | 395 | | |
390 | 396 | | |
391 | | - | |
392 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
393 | 410 | | |
394 | 411 | | |
395 | 412 | | |
396 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
397 | 432 | | |
398 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
399 | 440 | | |
400 | 441 | | |
401 | 442 | | |
| |||
406 | 447 | | |
407 | 448 | | |
408 | 449 | | |
409 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
410 | 456 | | |
411 | 457 | | |
412 | 458 | | |
| |||
659 | 705 | | |
660 | 706 | | |
661 | 707 | | |
662 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
663 | 719 | | |
664 | 720 | | |
665 | 721 | | |
| |||
1325 | 1381 | | |
1326 | 1382 | | |
1327 | 1383 | | |
1328 | | - | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
1329 | 1390 | | |
1330 | 1391 | | |
1331 | 1392 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
132 | 188 | | |
133 | 189 | | |
134 | 190 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
| 322 | + | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
333 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
334 | 339 | | |
335 | 340 | | |
336 | 341 | | |
| |||
0 commit comments