FU-7: audit-trail + provenance (GAP-17/18/19/20) #13
@@ -8,7 +8,7 @@ from pathlib import Path
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from legal_mcp import config
|
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(
|
async def document_upload(
|
||||||
@@ -87,6 +87,10 @@ async def document_upload(
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass # git not available in container — non-critical
|
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({
|
return json.dumps({
|
||||||
"document": doc,
|
"document": doc,
|
||||||
"processing": result,
|
"processing": result,
|
||||||
@@ -344,6 +348,10 @@ async def extract_claims(
|
|||||||
)
|
)
|
||||||
results.append(result)
|
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)
|
return json.dumps(results, default=str, ensure_ascii=False, indent=2)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from pathlib import Path
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
from legal_mcp import config
|
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 (
|
from legal_mcp.services.lessons import (
|
||||||
CITATION_GUIDANCE,
|
CITATION_GUIDANCE,
|
||||||
DECISION_TEMPLATES,
|
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)
|
path = await docx_exporter.export_decision(case_id, output_path or None)
|
||||||
# Register this export as the new source of truth
|
# Register this export as the new source of truth
|
||||||
await db.set_active_draft_path(case_id, path)
|
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)
|
case_dir = config.find_case_dir(case_number)
|
||||||
if case_dir.exists():
|
if case_dir.exists():
|
||||||
git_sync.commit_and_push(case_dir, f"ייצוא DOCX: {Path(path).name}")
|
git_sync.commit_and_push(case_dir, f"ייצוא DOCX: {Path(path).name}")
|
||||||
|
|||||||
Reference in New Issue
Block a user