Commit e1cb4e3
feat(profile): refuse writes while Elgato app is running + restart_app path fix (#16)
## Summary
Follow-up to #15. Closes a silent data-loss hole and fixes a
pre-existing bug in the app-restart helper — both surfaced by the Phase
1 on-device smoke test.
- **Data loss bug:** the Elgato desktop app caches every profile in
memory and rewrites the on-disk manifests from its snapshot on quit.
Edits made via `streamdeck_write_page` while the app is running are
silently wiped the next time it closes (observed live during Phase 1
testing). This PR makes \`write_page\` refuse to run while the app is up
and exposes a single additive \`auto_quit_app\` opt-in field for callers
that want the tool to quit it for them (AppleScript → killall fallback).
- **restart_app -600 bug:** \`open -a \"Stream Deck\"\` / \`open -a
\"Elgato Stream Deck\"\` both fail with
\`LSOpenURLsWithCompletionHandler -600\` on some macOS installs.
Launching by explicit \`/Applications/Elgato Stream Deck.app\` path
bypasses LaunchServices entirely. \`STREAMDECK_APP_PATH\` env var
overrides the default for non-standard installs.
- **Tool count unchanged** (still 6 tools). The new behavior is a single
\`auto_quit_app: bool = false\` field on the existing
\`streamdeck_write_page\` tool — per Jack's \"avoid tool bloat\"
direction.
## Workflow (added to README)
1. \`streamdeck_write_page(auto_quit_app: true, …)\` — tool quits the
app, writes, leaves app quit
2. Additional writes can follow without re-passing \`auto_quit_app\`
(app stays quit)
3. \`streamdeck_restart_app()\` once done → device picks up the changes
## Test plan
- [x] \`uv run pytest tests/\` — 44 passed (5 new)
- [x] \`uv run ruff check .\`
- [x] \`uv run ruff format --check .\`
- [ ] Manual: reproduce the Phase 1 scenario end-to-end (app running →
write fails with clear error → retry with auto_quit_app=true → write
succeeds → restart_app shows the button on the deck)
## Dependencies
Orthogonal to #15 — no merge-order requirement. Either can land first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jack-arturo <13076544+jack-arturo@users.noreply.github.com>1 parent f4a8402 commit e1cb4e3
4 files changed
Lines changed: 308 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
80 | 92 | | |
81 | 93 | | |
82 | | - | |
83 | 94 | | |
84 | 95 | | |
85 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
105 | 123 | | |
106 | 124 | | |
107 | 125 | | |
| |||
277 | 295 | | |
278 | 296 | | |
279 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
280 | 371 | | |
281 | 372 | | |
282 | 373 | | |
| |||
415 | 506 | | |
416 | 507 | | |
417 | 508 | | |
| 509 | + | |
418 | 510 | | |
419 | 511 | | |
420 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
421 | 533 | | |
422 | 534 | | |
423 | 535 | | |
| |||
518 | 630 | | |
519 | 631 | | |
520 | 632 | | |
| 633 | + | |
521 | 634 | | |
522 | 635 | | |
523 | 636 | | |
| |||
599 | 712 | | |
600 | 713 | | |
601 | 714 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
609 | 720 | | |
610 | | - | |
611 | | - | |
612 | 721 | | |
613 | | - | |
614 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
615 | 729 | | |
616 | 730 | | |
617 | 731 | | |
618 | 732 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
| 733 | + | |
| 734 | + | |
629 | 735 | | |
630 | | - | |
| 736 | + | |
631 | 737 | | |
632 | 738 | | |
633 | 739 | | |
634 | | - | |
635 | 740 | | |
| 741 | + | |
| 742 | + | |
636 | 743 | | |
637 | 744 | | |
638 | 745 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
192 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
193 | 199 | | |
194 | 200 | | |
195 | 201 | | |
| |||
227 | 233 | | |
228 | 234 | | |
229 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
230 | 246 | | |
231 | 247 | | |
232 | 248 | | |
| |||
322 | 338 | | |
323 | 339 | | |
324 | 340 | | |
| 341 | + | |
325 | 342 | | |
326 | 343 | | |
327 | 344 | | |
| |||
350 | 367 | | |
351 | 368 | | |
352 | 369 | | |
| 370 | + | |
| 371 | + | |
353 | 372 | | |
354 | 373 | | |
355 | 374 | | |
| |||
0 commit comments