mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-11 12:17:45 +02:00
remove Tier-0 dead code: dashboard_layout package and service/models stub
backend/apps/dashboard_layout/ was never mounted in main.py and had no frontend/electron callers — its SubApp and endpoints were fully superseded by backend/apps/dashboards/. backend/apps/service/models.py was an empty placeholder with no importers. Also adds .dead-code-scan/ and the scan script to .gitignore, and drops the stale dashboard_layout/ entry from the README directory tree. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -54,6 +54,10 @@ backend/coverage_html/
|
||||
backend/coverage.xml
|
||||
htmlcov/
|
||||
|
||||
# Dead-code scan workspace (one-shot scratch — never committed)
|
||||
.dead-code-scan/
|
||||
backend/scripts/dead_code_scan.py
|
||||
|
||||
# Editor noise — per-developer, never useful in repo
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
@@ -160,7 +160,6 @@ backend/
|
||||
apps/
|
||||
agents/ Agent lifecycle, streaming, worktree management
|
||||
dashboards/ Dashboard CRUD and layout persistence
|
||||
dashboard_layout/ Card positions and spatial canvas state
|
||||
templates/ Prompt template CRUD
|
||||
skills/ Skills CRUD (synced to ~/.claude/skills/)
|
||||
tools_lib/ MCP tool configuration and discovery
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
import json
|
||||
import os
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
from backend.config.Apps import SubApp
|
||||
from backend.apps.dashboard_layout.models import DashboardLayout, DashboardLayoutUpdate
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from backend.config.paths import DASHBOARD_LAYOUT_DIR as DATA_DIR
|
||||
|
||||
LAYOUT_FILE = os.path.join(DATA_DIR, "layout.json")
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def dashboard_layout_lifespan():
|
||||
os.makedirs(DATA_DIR, exist_ok=True)
|
||||
yield
|
||||
|
||||
|
||||
dashboard_layout = SubApp("dashboard_layout", dashboard_layout_lifespan)
|
||||
|
||||
|
||||
def _default_layout() -> DashboardLayout:
|
||||
return DashboardLayout(cards={})
|
||||
|
||||
|
||||
def _load() -> DashboardLayout:
|
||||
if not os.path.exists(LAYOUT_FILE):
|
||||
return _default_layout()
|
||||
try:
|
||||
with open(LAYOUT_FILE) as f:
|
||||
data = json.load(f)
|
||||
if "columns" in data and "cards" not in data:
|
||||
logger.info("Detected old column-based layout format, resetting to empty canvas")
|
||||
return _default_layout()
|
||||
return DashboardLayout(**data)
|
||||
except Exception:
|
||||
logger.exception("Failed to load dashboard layout, returning default")
|
||||
return _default_layout()
|
||||
|
||||
|
||||
def _save(layout: DashboardLayout):
|
||||
with open(LAYOUT_FILE, "w") as f:
|
||||
json.dump(layout.model_dump(), f, indent=2)
|
||||
|
||||
|
||||
@dashboard_layout.router.get("")
|
||||
async def get_layout():
|
||||
layout = _load()
|
||||
return layout.model_dump()
|
||||
|
||||
|
||||
@dashboard_layout.router.put("")
|
||||
async def update_layout(body: DashboardLayoutUpdate):
|
||||
layout = DashboardLayout(cards=body.cards, view_cards=body.view_cards)
|
||||
_save(layout)
|
||||
return layout.model_dump()
|
||||
@@ -1,27 +0,0 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CardPosition(BaseModel):
|
||||
session_id: str
|
||||
x: float = 0
|
||||
y: float = 0
|
||||
width: float = 420
|
||||
height: float = 280
|
||||
|
||||
|
||||
class ViewCardPosition(BaseModel):
|
||||
output_id: str
|
||||
x: float = 0
|
||||
y: float = 0
|
||||
width: float = 480
|
||||
height: float = 360
|
||||
|
||||
|
||||
class DashboardLayout(BaseModel):
|
||||
cards: dict[str, CardPosition] = Field(default_factory=dict)
|
||||
view_cards: dict[str, ViewCardPosition] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class DashboardLayoutUpdate(BaseModel):
|
||||
cards: dict[str, CardPosition]
|
||||
view_cards: dict[str, ViewCardPosition] = Field(default_factory=dict)
|
||||
@@ -1,5 +0,0 @@
|
||||
"""(Reserved for future use; intentionally empty.)
|
||||
|
||||
The service-sync layer ships opaque payload dicts through `submit()` —
|
||||
no Pydantic shape exposed in the public repo.
|
||||
"""
|
||||
Reference in New Issue
Block a user