MicroFish/backend/app/services/interviews
Christian Moellmann 6b04ea5c27 feat(interviews): auto-trigger lifecycle hooks + bridge SimulationRunner→Manager on COMPLETED
- Add backend/app/services/interviews/lifecycle.py with install_hooks() that
  registers on_ready (pre-survey) and on_completed (post-survey + synthesis)
  daemon-thread callbacks on a SimulationManager.
- Add SimulationRunner.register_on_completed() / _fire_on_completed() so
  external callbacks can be notified when _monitor_simulation transitions to
  COMPLETED (both exit-code-0 path and simulation_end event path).
- Wire both in app/__init__.py: create singleton SimulationManager, install
  lifecycle hooks, and register its _notify_on_completed with SimulationRunner.
- Add test_lifecycle.py: verifies install_hooks registers one callable for each
  of ready and completed.
- All 40 unit tests + 2 integration tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 12:51:13 +02:00
..
__init__.py feat(interviews): YAML instrument loader with pydantic validation and hash freezing 2026-05-23 12:06:52 +02:00
adapters.py feat(interviews): persona + Zep memory adapters bridging existing services to interview subsystem 2026-05-23 12:34:03 +02:00
base.py feat(interviews): StakeholderInterviewer base with in-character prompting and schema retry 2026-05-23 12:10:01 +02:00
delphi.py feat(interviews): Delphi subagent (3 rounds: open, rate, revise) + convergence metrics 2026-05-23 12:19:07 +02:00
diversity.py feat(interviews): diversity subagent with Q-sort + 6 Likert axes + PCA/k-means typology 2026-05-23 12:16:21 +02:00
instrument_loader.py feat(interviews): YAML instrument loader with pydantic validation and hash freezing 2026-05-23 12:06:52 +02:00
lifecycle.py feat(interviews): auto-trigger lifecycle hooks + bridge SimulationRunner→Manager on COMPLETED 2026-05-23 12:51:13 +02:00
longitudinal.py feat(interviews): longitudinal subagent + 12-item Likert instrument 2026-05-23 12:12:46 +02:00
scenario.py feat(interviews): scenario subagent with 4 futures × 4 dimensions + polarity matrix 2026-05-23 12:21:21 +02:00
storage.py feat(interviews): JSONL/JSON storage layout with run_id directories and latest pointer 2026-05-23 12:23:06 +02:00
zep_writer.py feat(interviews): Zep writer adapts add_activity/add_text_episode for per-agent + aggregate episodes 2026-05-23 12:24:33 +02:00