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:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
from uuid import UUID
|
||||
|
||||
from legal_mcp import config
|
||||
from legal_mcp.services import db, embeddings, git_sync, research_md
|
||||
from legal_mcp.services import audit, db, embeddings, git_sync, research_md
|
||||
from legal_mcp.services.lessons import (
|
||||
CITATION_GUIDANCE,
|
||||
DECISION_TEMPLATES,
|
||||
@@ -423,6 +423,10 @@ async def export_docx(case_number: str, output_path: str = "") -> str:
|
||||
path = await docx_exporter.export_decision(case_id, output_path or None)
|
||||
# Register this export as the new source of truth
|
||||
await db.set_active_draft_path(case_id, path)
|
||||
await audit.log_action_safe(
|
||||
"export_docx", case_id=case_id,
|
||||
details={"path": str(path)},
|
||||
)
|
||||
case_dir = config.find_case_dir(case_number)
|
||||
if case_dir.exists():
|
||||
git_sync.commit_and_push(case_dir, f"ייצוא DOCX: {Path(path).name}")
|
||||
|
||||
Reference in New Issue
Block a user