FaultMaven Case Management - SQLite-based troubleshooting case tracking
2.8K
Part of FaultMavenā ā The AI-Powered Troubleshooting Copilot
š¤ This README is auto-generated from code on every commit. Last updated: 2025-11-19 03:09 UTC | Total endpoints: 8
Microservice for case management - Part of the FaultMaven troubleshooting platform.
The Case Service manages the lifecycle of troubleshooting cases in FaultMaven. Cases are persistent containers that track investigations across multiple sessions, allowing users to organize their troubleshooting work over time.
Key Features:
docker run -p 8003:8003 -v ./data:/data faultmaven/fm-case-service:latest
The service will be available at http://localhost:8003. Data persists in the ./data directory.
See faultmaven-deployā for complete deployment with all FaultMaven services.
# Clone repository
git clone https://github.com/FaultMaven/fm-case-service.git
cd fm-case-service
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e .
# Run service
uvicorn case_service.main:app --reload --port 8003
The service creates a SQLite database at ./fm_cases.db on first run.
| Method | Endpoint | Description |
|---|---|---|
| GET | /health | Health Check |
| POST | /api/v1/cases | Create new troubleshooting case |
| GET | /api/v1/cases | List user's cases with pagination |
| GET | /api/v1/cases/session/{session_id} | Get cases linked to a session |
| GET | /api/v1/cases/{case_id} | Get case by ID |
| PUT | /api/v1/cases/{case_id} | Update case details |
| DELETE | /api/v1/cases/{case_id} | Delete case permanently |
| POST | /api/v1/cases/{case_id}/status | Update case status |
OpenAPI Documentation: See docs/api/openapi.jsonā or docs/api/openapi.yamlā for complete API specification.
Configuration via environment variables:
| Variable | Description | Default |
|---|---|---|
SERVICE_NAME | Service identifier | fm-case-service |
ENVIRONMENT | Deployment environment | development |
PORT | Service port | 8003 |
DATABASE_URL | Database connection string | sqlite+aiosqlite:///./fm_cases.db |
DEFAULT_PAGE_SIZE | Default pagination size | 50 |
MAX_PAGE_SIZE | Maximum pagination size | 100 |
CORS_ORIGINS | Allowed CORS origins (comma-separated) | * |
LOG_LEVEL | Logging level (DEBUG/INFO/WARNING/ERROR) | INFO |
Example .env file:
ENVIRONMENT=production
PORT=8003
DATABASE_URL=sqlite+aiosqlite:///./data/fm_cases.db
LOG_LEVEL=INFO
CORS_ORIGINS=https://app.faultmaven.com,https://admin.faultmaven.com
Example Case Object:
{
"case_id": "case_abc123def456",
"user_id": "user_123",
"session_id": "session_xyz789",
"title": "Database connection timeout in production",
"description": "Users experiencing intermittent connection timeouts on RDS instance",
"status": "investigating",
"severity": "high",
"category": "performance",
"metadata": {"environment": "production", "affected_users": 42},
"tags": ["database", "timeout", "rds"],
"created_at": "2025-11-15T10:30:00Z",
"updated_at": "2025-11-15T12:45:00Z",
"resolved_at": null
}
active - Case created, not yet being investigatedinvestigating - Active investigation in progressresolved - Issue resolved successfullyarchived - Case archived for referenceclosed - Case closed without resolutionlow - Minor issues with workarounds availablemedium - Normal priority issueshigh - Significant impact requiring attentioncritical - Urgent issues blocking operationsperformance - Performance degradation or slownesserror - Error messages or exceptionsconfiguration - Configuration problemsinfrastructure - Infrastructure issues (servers, network, etc.)security - Security concerns or vulnerabilitiesother - Uncategorized issuesThis service uses trusted header authentication from the FaultMaven API Gateway:
Required Headers:
X-User-ID (required): Identifies the user making the requestOptional Headers:
X-User-Email: User's email addressX-User-Roles: User's roles (comma-separated)All case operations are scoped to the user specified in X-User-ID. Users can only access their own cases.
Security Model:
Services trust X-User-* headers from the API Gateway without validating JWTs. The gateway:
Additional protections:
Important: This service MUST run behind the fm-api-gatewayā on a private Docker/Kubernetes network. Never expose this service directly to the internet.
āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā FaultMaven API Gateway ā Handles authentication (Clerk)
ā (Port 8000) ā Sets X-User-ID header
āāāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā Trusted headers (X-User-ID)
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā fm-case-service ā Trusts gateway headers
ā (Port 8003) ā Enforces user isolation
āāāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā SQLAlchemy ORM
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā SQLite Database ā fm_cases.db
ā (Local file) ā User-scoped data
āāāāāāāāāāāāāāāāāāāāāāāāāāā
Related Services:
Storage Details:
./fm_cases.db (configurable via DATABASE_URL)# Install dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run with coverage report
pytest --cov=case_service --cov-report=html --cov-report=term
# Run specific test file
pytest tests/test_cases.py -v
# Run with debug output
pytest -vv -s
Test Coverage Goals:
# Format code with black
black src/ tests/
# Lint with flake8
flake8 src/ tests/
# Type check with mypy
mypy src/
# Run all quality checks
black src/ tests/ && flake8 src/ tests/ && mypy src/ && pytest
This repository uses GitHub Actions for automated documentation generation:
Trigger: Every push to main or develop branches
Process:
See .github/workflows/generate-docs.ymlā for implementation details.
Documentation Guarantee: This README is always in sync with the actual code. Any endpoint changes automatically trigger documentation updates.
Apache 2.0 - See LICENSEā for details.
See our Contributing Guideā for detailed guidelines.
š Documentation Statistics
This README is automatically updated on every commit to ensure zero documentation drift.
This service uses a 3-stage CI/CD pipeline:
All deployments to production require manual approval.
Content type
Image
Digest
sha256:716699606ā¦
Size
431.3 MB
Last updated
10 months ago
docker pull faultmaven/fm-case-service