Fix import paths and remove organ metaphors
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled

- Update all `from storage.` imports to `from dss.storage.`
- Update `from config import config` to use `dss.settings`
- Update `from auth.` imports to `from dss.auth.`
- Update health check to use `dss.mcp.handler`
- Fix SmartMerger import (merger.py not smart_merger.py)
- Fix TranslationDictionary import path
- Fix test assertion for networkx edges/links
- Remove organ/body metaphors from:
  - API server health check
  - CLI status command and help text
  - Admin UI logger and error handler

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-10 13:05:00 -03:00
parent 41fba59bf7
commit faa19beef3
22 changed files with 251 additions and 295 deletions

View File

@@ -353,7 +353,7 @@ class TokenDriftCreate(BaseModel):
# === Authentication ===
from auth.atlassian_auth import get_auth
from dss.auth.atlassian_auth import get_auth
async def get_current_user(authorization: Optional[str] = Header(None)) -> Dict[str, Any]:
"""
@@ -421,71 +421,62 @@ async def root():
@app.get("/health")
async def health():
"""
🏥 ORGANISM VITAL SIGNS CHECK
Health check endpoint.
Performs a complete health diagnostic on the DSS component.
Returns 200 OK with vital signs if component is healthy.
Performs a complete health diagnostic on the DSS server.
Returns 200 OK with service status.
Vital Signs Checked:
- ❤️ Heart (Database) - Is the source of truth responsive?
- 🧠 Brain (MCP Handler) - Is the decision-making system online?
- 👁️ Sensory (Figma) - Are the external perception organs configured?
Services Checked:
- Storage - Is the data directory accessible?
- MCP Handler - Is the MCP handler initialized?
- Figma - Is the Figma integration configured?
"""
import os
import psutil
from pathlib import Path
# ❤️ Check Heart (storage) connectivity
db_ok = False
# Check storage connectivity
storage_ok = False
try:
from storage.json_store import DATA_DIR
db_ok = DATA_DIR.exists()
from dss.storage.json_store import DATA_DIR
storage_ok = DATA_DIR.exists()
except Exception as e:
import traceback
error_trace = traceback.format_exc()
print(f"🏥 VITAL SIGN: Heart (storage) error: {type(e).__name__}: {e}", flush=True)
print(f" Traceback:\n{error_trace}", flush=True)
pass
print(f"[Health] Storage check error: {type(e).__name__}: {e}", flush=True)
# 🧠 Check Brain (MCP handler) functionality
# Check MCP handler functionality
mcp_ok = False
try:
import sys
from pathlib import Path
# Add project root to path (two levels up from tools/api)
project_root = Path(__file__).parent.parent.parent
if str(project_root) not in sys.path:
sys.path.insert(0, str(project_root))
from tools.dss_mcp.handler import get_mcp_handler
from dss.mcp.handler import get_mcp_handler
handler = get_mcp_handler()
mcp_ok = handler is not None
except Exception as e:
import traceback
error_trace = ''.join(traceback.format_exception(type(e), e, e.__traceback__))
print(f"🧠 BRAIN CHECK: MCP handler error: {type(e).__name__}: {e}", flush=True)
print(f" Traceback:\n{error_trace}", flush=True)
print(f"[Health] MCP handler check error: {type(e).__name__}: {e}", flush=True)
# Get uptime (how long component has been conscious)
# Get uptime
try:
process = psutil.Process(os.getpid())
uptime_seconds = int((datetime.now() - datetime.fromtimestamp(process.create_time())).total_seconds())
except:
uptime_seconds = 0
# Overall vitality assessment
status = "healthy" if (db_ok and mcp_ok) else "degraded"
# Overall status
status = "healthy" if (storage_ok and mcp_ok) else "degraded"
return {
"status": status,
"vital_signs": {
"overall": "🟢 All systems nominal" if status == "healthy" else "🟡 System degradation detected",
"consciousness_duration_seconds": uptime_seconds
},
"uptime_seconds": uptime_seconds,
"version": "0.8.0",
"timestamp": datetime.utcnow().isoformat() + "Z",
"services": {
"storage": "ok" if db_ok else "error",
"storage": "ok" if storage_ok else "error",
"mcp": "ok" if mcp_ok else "error",
"figma": "connected" if config.figma.is_configured else "not configured"
}