Skip to content

refactor(store): separate Store into pure DAO + EventBus + filesystem paths#135

Open
Fullstop000 wants to merge 2 commits intomainfrom
refactor/store-dao-separation
Open

refactor(store): separate Store into pure DAO + EventBus + filesystem paths#135
Fullstop000 wants to merge 2 commits intomainfrom
refactor/store-dao-separation

Conversation

@Fullstop000
Copy link
Copy Markdown
Owner

Summary

Extracts broadcast channels and filesystem paths from Store so it becomes a pure SQLite DAO. This enables backend swap (SQLite → Mongo/Supabase) without carrying non-storage concerns.

Changes

  • New EventBus (src/server/event_bus.rs): Owns stream_tx/trace_tx broadcast channels, decoupled from persistence.
  • Purged Store fields: Removed stream_tx, trace_tx, data_dir, agents_dir_override.
  • Return events instead of sending: Store methods now return StreamEvent tuples; callers publish via EventBus.
  • Updated AppState: Carries event_bus, data_dir, agents_dir.
  • Updated handlers: All callers destructure tuples and publish events.
  • Updated AgentManager::new: Takes trace_tx explicitly.
  • Test helpers: Added build_router_with_lifecycle_and_dir and build_router_with_event_bus.

Verification

  • cargo test --lib: 344 passed
  • cargo test --tests: ~196 integration tests passed
  • No compiler warnings

… paths

Extract broadcast channels and filesystem paths from Store so it becomes
a pure SQLite DAO. This enables backend swap (SQLite → Mongo/Supabase)
without carrying non-storage concerns.

Changes:
- New EventBus owns stream_tx/trace_tx broadcast channels
- Store stripped of stream_tx, trace_tx, data_dir, agents_dir_override
- Store methods return StreamEvent tuples instead of broadcasting internally
- AppState carries EventBus + data_dir + agents_dir
- All handlers updated to destructure tuples and publish via EventBus
- Test helpers updated for new build_router_with_services signature

Tests: 344 lib + ~196 integration tests all pass
Gemini review found three [P1] silent event-drop regressions:

1.  —  dropped  events
   for both human and agent members. Now captures and publishes.

2.  —  and
   dropped  join events. Added  variants that return
   ; regular methods keep backward-compatible
   return. Handler updated to use  and publish.

3.  — empty-run warning  event
   was dropped. Added  to
   , threaded through  from .

All 344 lib + ~196 integration tests pass.
Playwright smoke: 8/10 pass (2 pre-existing failures on main).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant