feat: implement Phase 2 stabilization
Some checks failed
CI / lint-and-test (push) Has been cancelled

- Cache Graph API tokens with expiry-aware reuse in graph/auth.py
- Add tenacity-based retry/backoff wrapper (utils/http.py) and apply to all Graph/source API calls
- Add Pydantic request/response models (models/api.py) and FastAPI query constraints
- Add unit tests for event_model, auth and integration tests for API endpoints
- Configure ruff linter/formatter in pyproject.toml
- Add GitHub Actions CI pipeline (.github/workflows/ci.yml)
- Add requirements-dev.txt with pytest, mongomock, httpx, ruff
- Clean up typing imports and fix ruff linting across codebase
This commit is contained in:
2026-04-14 12:02:28 +02:00
parent 4f6e16d64d
commit 9271b4e461
29 changed files with 518 additions and 118 deletions

View File

41
backend/models/api.py Normal file
View File

@@ -0,0 +1,41 @@
from pydantic import BaseModel, ConfigDict
class EventItem(BaseModel):
id: str | None = None
timestamp: str | None = None
service: str | None = None
operation: str | None = None
result: str | None = None
actor_display: str | None = None
target_displays: list[str] | None = None
display_summary: str | None = None
display_category: str | None = None
dedupe_key: str | None = None
actor: dict | None = None
targets: list[dict] | None = None
raw: dict | None = None
raw_text: str | None = None
model_config = ConfigDict(extra="allow")
class PaginatedEventResponse(BaseModel):
items: list[dict]
total: int
page: int
page_size: int
class FilterOptionsResponse(BaseModel):
services: list[str]
operations: list[str]
results: list[str]
actors: list[str]
actor_upns: list[str]
devices: list[str]
class FetchAuditLogsResponse(BaseModel):
stored_events: int
errors: list[str]

View File

@@ -2,7 +2,6 @@ import json
from mapping_loader import get_mapping
CATEGORY_LABELS = {
"ApplicationManagement": "Application",
"UserManagement": "User",