soulsync/tests/automation
Broque Thomas d3768610d7 Extract automation handlers (kettui-bar): engine-boundary tests
Per-handler boundary tests pin each handler's body in isolation.
Adding engine-boundary tests that pin the REGISTRATION layer:
- every expected action name registered, no drops, no extras
- guarded actions register a guard, unguarded ones don't
- every registered handler is callable
- every guard returns a bool
- all four progress callbacks registered in the right slots
- progress_init / progress_finish / record_history / on_library_scan_completed
  are invocable through the engine's stored callable shape (not just
  the bare extracted function)
- finish callback respects _manages_own_progress flag at the engine
  boundary too
- library_scan_completed wiring registers a callback on the scan
  manager and that callback fires engine.emit when invoked
- every handler returns a `{'status': ...}` dict on a minimal config
  trigger -- proves no handler raises into the engine, even when its
  guard / short-circuit / error path is the one taken

Uses a minimal _RecordingEngine that captures registrations + a
_RecordingScanMgr that captures completion callbacks. No real
AutomationEngine, no real Flask app, no real DB. The kettui standard
for refactor PRs: don't ship "behavior preserved" claim that's only
validated at the function boundary -- exercise the engine seam too.

EXPECTED_ACTION_NAMES + EXPECTED_GUARDED_ACTIONS frozen sets at the
top: any future drift (rename / drop / add a handler / change which
ones are guarded) fails this test immediately so refactor PRs can't
quietly mutate the registration shape.

13 new tests, 164 automation tests pass total.
2026-05-15 12:35:45 -07:00
..
__init__.py Lift /api/automations/* into core/automation/ 2026-04-27 18:05:14 -07:00
test_automation_api.py Lift /api/automations/* into core/automation/ 2026-04-27 18:05:14 -07:00
test_automation_blocks.py Lift /api/automations/blocks static config into core/automation/blocks.py 2026-04-27 18:31:36 -07:00
test_automation_progress.py Lift /api/automations/* into core/automation/ 2026-04-27 18:05:14 -07:00
test_automation_signals.py Lift /api/automations/* into core/automation/ 2026-04-27 18:05:14 -07:00
test_handler_error_storage.py Surface handler-returned errors in automation last_error 2026-04-30 15:45:28 -07:00
test_handler_registration.py Extract automation handlers (kettui-bar): engine-boundary tests 2026-05-15 12:35:45 -07:00
test_handlers_maintenance.py Extract automation handlers (4/3 — finish): progress callbacks + scan-completion emitter 2026-05-15 11:59:32 -07:00
test_handlers_playlist.py Extract automation handlers (4/3 — finish): progress callbacks + scan-completion emitter 2026-05-15 11:59:32 -07:00
test_handlers_simple.py Extract automation handlers (4/3 — finish): progress callbacks + scan-completion emitter 2026-05-15 11:59:32 -07:00
test_progress_callbacks.py Extract automation handlers (4/3 — finish): progress callbacks + scan-completion emitter 2026-05-15 11:59:32 -07:00