# Feature: Entity Relationship Refactor **Branch:** `feature/entity-relationship-refactor` **Base branch:** `master` **Created:** 2026-03-20 **Status:** ✅ Complete **Strategy:** Incremental **Mode:** Automated **Execution:** Orchestrator ## Summary Rework the entity schema so that ServiceProvider capabilities (notifications, commands) are inferred from provider type config. Current Trackers become NotificationTrackers. A new CommandTracker entity links providers to CommandConfigs and CommandsListeners (TelegramBot as first implementation). TelegramBot becomes dual-purpose: notification target backend + commands listener with smart ref-counted polling/webhook. CommandConfig is a new shareable entity scoped to provider type. Telegram targets gain a chat_action setting. ## Build & Test Commands - **Build (backend):** `cd packages/server && pip install -e .` - **Verify (backend):** Server startup + `curl -s http://localhost:8420/api/health` - **Build (frontend):** `cd frontend && npm install && npx vite build` - **Test:** No automated test suite yet — verification via server startup and frontend build ## Phases - [x] Phase 1: Database Schema & Migration [domain: backend] → [subplan](./phase-1-db-schema.md) - [x] Phase 2: Notification Tracker Rename (API) [domain: backend] → [subplan](./phase-2-notification-tracker-rename.md) - [x] Phase 3: CommandConfig & CommandTracker CRUD [domain: backend] → [subplan](./phase-3-command-entities-api.md) - [x] Phase 4: Command System Refactor [domain: backend] → [subplan](./phase-4-command-system-refactor.md) - [x] Phase 5: Frontend Rename & Restructure [domain: frontend] → [subplan](./phase-5-frontend-rename.md) - [x] Phase 6: Frontend Command Entities [domain: frontend] → [subplan](./phase-6-frontend-commands.md) - [x] Phase 7: Integration & Cleanup [domain: fullstack] → [subplan](./phase-7-integration-cleanup.md) ## Phase Progress Log | Phase | Domain | Status | Review | Build | Committed | |-------|--------|--------|--------|-------|-----------| | Phase 1: DB Schema & Migration | backend | ✅ Complete | ✅ | ✅ | ✅ | | Phase 2: Notification Tracker Rename | backend | ✅ Complete | ✅ | ✅ | ✅ | | Phase 3: Command Entities API | backend | ✅ Complete | ✅ | ✅ | ✅ | | Phase 4: Command System Refactor | backend | ✅ Complete | ✅ | ✅ | ✅ | | Phase 5: Frontend Rename | frontend | ✅ Complete | ✅ | ✅ | ✅ | | Phase 6: Frontend Commands | frontend | ✅ Complete | ✅ | ✅ | ✅ | | Phase 7: Integration & Cleanup | fullstack | ✅ Complete | ✅ | ✅ | ✅ | ## Final Review - [x] Comprehensive code review - [x] Full build passes - [x] Full test suite passes - [ ] Merged to `master`