Capstone Mini-Projekt: incident-tracker (CLI + SQLite + JSON logs)
Ten sam projekt SRE realizujesz w Pythonie, Go i Ruście, żeby porównać ergonomię i architekturę wszystkich trzech języków.
Wymagania
Zaimplementuj aplikację incident-tracker (tracker.py):
- Model domenowy:
Incident(id, title, severity, status)gdzieseverity∈{"low", "medium", "high", "critical"},status∈{"open", "resolved"}. - Warstwa persystencji (
IncidentStorena SQLite):init_schema()— idempotentne tworzenie tabeliincidents.add(title: str, severity: str) -> Incident— walidacja niepustego tytułu i dozwolonegoseverity, zapis przez parametryzowane zapytanie.list_incidents(severity: str | None = None) -> list[Incident]— opcjonalne filtrowanie.resolve(incident_id: int) -> Incident— zmiana statusu na"resolved"(lubIncidentNotFoundError).stats() -> dict[str, int]— zliczenie incydentów postatus({"open": ..., "resolved": ...}).
- Warstwa CLI (
build_cli(db_path: Path)wtyper):- Podkomendy:
add <title> --severity <sev>,list [--severity <sev>],resolve <id>,stats. - Wynik wypisywany jako czysty JSON na
stdout.
- Podkomendy:
Uruchomienie testów
make test-project