feat(audit): log document_upload/extract_claims/export_docx (GAP-18, FU-7)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 21:31:09 +00:00
parent a121f79d6a
commit 1f483383b9
2 changed files with 14 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ from pathlib import Path
from uuid import UUID
from legal_mcp import config
from legal_mcp.services import db, git_sync, processor
from legal_mcp.services import audit, db, git_sync, processor
async def document_upload(
@@ -87,6 +87,10 @@ async def document_upload(
except Exception:
pass # git not available in container — non-critical
await audit.log_action_safe(
"document_upload", case_id=case_id, document_id=UUID(doc["id"]),
details={"title": title, "doc_type": actual_doc_type},
)
return json.dumps({
"document": doc,
"processing": result,
@@ -344,6 +348,10 @@ async def extract_claims(
)
results.append(result)
await audit.log_action_safe(
"extract_claims", case_id=case_id,
details={"docs_processed": len(docs), "results": len(results)},
)
return json.dumps(results, default=str, ensure_ascii=False, indent=2)