Skip to content

Feature/examination audit logs#31

Closed
Soldier224K wants to merge 2 commits into
mainfrom
feature/examination-audit-logs
Closed

Feature/examination audit logs#31
Soldier224K wants to merge 2 commits into
mainfrom
feature/examination-audit-logs

Conversation

@Soldier224K

@Soldier224K Soldier224K commented May 23, 2026

Copy link
Copy Markdown
Collaborator

closes #20

Raj added 2 commits May 23, 2026 19:35
- Add reviewer_id, review_timestamp, review_reason to ConflictAlert
- Add get_conflict_details() to inspect prior face history
- Add admin_review_conflict() for approval/rejection actions
- Add get_override_log() to persist manual review decisions
- Add API endpoints: /face/conflict/{id}, /admin/review-conflict, /admin/override-log
- Add new event types: ADMIN_REVIEW_STARTED, ADMIN_REVIEW_APPROVED, ADMIN_REVIEW_REJECTED, ADMIN_OVERRIDE_ACTION
- Add 5 new tests for admin review functionality
- Add AuditLogService for comprehensive identity event logging
- Log verification attempts, face matches/mismatches, suspicious events
- Log admin override actions and examination access decisions
- Add get_timeline() for roll-number or session filtered audit trails
- Add search() for querying audit log content
- Add new event types: VERIFICATION_ATTEMPT, FACE_MATCH, FACE_MISMATCH, SUSPICIOUS_IDENTITY, ADMIN_OVERRIDE, EXAMINATION_ACCESS
- Add API endpoints: /audit/timeline, /audit/search, /audit/events/{type}
- Add 15 tests covering all audit logging functionality
Copilot AI review requested due to automatic review settings May 23, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds examination audit logging support and admin review metadata around face identity conflicts.

Changes:

  • Introduces an in-memory AuditLogService and tests for audit event logging/querying.
  • Extends face conflict alerts with reviewer metadata and admin review helpers.
  • Adds API routes for conflict details, admin review/override logs, and audit log queries.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
backend/src/services/audit_log.py Adds audit event model and in-memory audit log service.
backend/tests/test_audit_log.py Adds unit tests for audit log service behavior.
backend/src/services/face_detection.py Adds reviewer fields and conflict detail/admin review helpers.
backend/tests/test_face_detection.py Expands face detection tests for review metadata and conflict lookup.
backend/src/models/events.py Adds admin review and audit event enum values.
backend/src/main.py Wires new services and exposes admin/audit/conflict API endpoints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/src/main.py
async def get_conflict_details(conflict_id: str):
details = face_service.get_conflict_details(conflict_id)
if details is None:
return {"error": "Conflict not found"}, 404
Comment thread backend/src/main.py
request.reason
)
if not success:
return {"error": "Conflict not found"}, 404
Comment thread backend/src/main.py
Comment on lines +88 to +89
@app.post("/admin/review-conflict")
async def admin_review_conflict(request: AdminReviewRequest):
Comment thread backend/src/main.py

app = FastAPI(title=settings.PROJECT_NAME)
face_service = FaceDetectionService()
audit_log = AuditLogService()
Comment on lines +31 to +36
VERIFICATION_ATTEMPT = "verification.attempt"
FACE_MATCH = "face.match"
FACE_MISMATCH = "face.mismatch"
SUSPICIOUS_IDENTITY = "suspicious.identity"
ADMIN_OVERRIDE = "admin.override"
EXAMINATION_ACCESS = "examination.access"
Comment thread backend/src/main.py
Comment on lines +104 to +105
@app.get("/audit/timeline")
async def get_audit_timeline(roll_number: Optional[str] = None, session_id: Optional[str] = None):
Comment thread backend/src/main.py
Comment on lines +100 to +101
@app.get("/admin/override-log")
async def get_override_log():
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ISSUE 6 — Examination Access Authorization Engine

3 participants