Files
Prakash Dalai 41bcf9db6b feat(ee): get_journal FastAPI dependency + migrate fleet router (#949)
#948 shipped the fleet REST router with a local workaround: it opened
its own SQLite journal at ~/.pocketpaw/journal/fleet.db so the install
trio would land somewhere. That works, but it splits the audit trail
across two files and bakes a per-route decision into what should be
an org-wide primitive.

This PR adds the shared dep every ee/ route can depend on.

- ee/journal_dep.py — get_journal() returns a process-scoped Journal
  rooted at SOUL_DATA_DIR (falling back to ~/.soul/), cached via
  lru_cache so request churn doesn't re-open SQLite. reset_journal_cache
  is the test-only escape hatch.
- ee/fleet/router.py — drops _open_default_journal + the per-request
  close(). Install endpoint now takes journal: Journal = Depends(get_journal).
  The request-body `journal=false` flag still forwards None to install_fleet
  for the opt-out path.
- tests/ee/test_journal_dep.py — three tests: instance shape, cache
  identity, SOUL_DATA_DIR override via monkeypatch.
- tests/ee/test_fleet_router.py — swapped the _open_default_journal
  monkeypatch for FastAPI's dependency_overrides pattern, pointing at
  a tmp_path journal so tests never touch ~/.soul/.

Co-authored-by: Prakash-1 <prakash-1@Mac.lan>
2026-04-16 10:28:15 +05:30
..