Skip to content

Add audit logging to model switcher#953

Open
Trishanthsai wants to merge 2 commits into
imDarshanGK:mainfrom
Trishanthsai:feat/model-switch-audit-log
Open

Add audit logging to model switcher#953
Trishanthsai wants to merge 2 commits into
imDarshanGK:mainfrom
Trishanthsai:feat/model-switch-audit-log

Conversation

@Trishanthsai

Copy link
Copy Markdown
Contributor

Before opening: make sure there is an issue tracking this work, and link it below. PRs without a linked issue may be closed without review.

Linked issue

Closes #817

What this PR does

Adds audit logging when the default AI model is changed through the settings API. Model switch events are now logged with the previous and new model values, improving traceability while preserving existing functionality.

Type of change

  • Bug fix
  • New feature
  • ML model / training pipeline
  • Refactor (no behaviour change)
  • Documentation
  • Tests only

ML tier (if applicable)

  • Tier 1 — Triage
  • Tier 2 — Predictive
  • Tier 3 — Autonomous
  • Not ML-related

Stack affected

  • Backend
  • Frontend
  • Both

Changes

Backend

  • Added audit logging for model switch events in the settings routes.
  • Logged previous and updated model values when default_model changes.
  • Preserved existing settings update behaviour.

Frontend

  • No frontend changes.

New dependencies

  • None.

Database / schema changes

  • None.

Testing

How did you test this?

  • Updated the existing settings API test.
  • Verified that changing the default model still succeeds.
  • Verified that an audit log entry is emitted when the model changes.

Checklist

  • Tested locally
  • New ML model falls back gracefully when model file is absent
  • No new console.error or unhandled Python exceptions introduced
  • Added or updated tests where applicable
  • requirements.txt / package.json updated if new dependencies added
  • New model files (.pkl, .pt, etc.) are gitignored, not committed

Anything reviewers should focus on

Please review the audit logging implementation for model switch events and confirm that logging is emitted only when the configured default model changes.

Screenshots (if UI changed)

N/A (Backend-only changes)

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

@Trishanthsai is attempting to deploy a commit to the Darshan's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Trishanthsai Trishanthsai force-pushed the feat/model-switch-audit-log branch from f88c36b to 90a7389 Compare July 5, 2026 14:10
@Trishanthsai Trishanthsai force-pushed the feat/model-switch-audit-log branch from 42191f9 to 2fa75df Compare July 5, 2026 14:16
@Trishanthsai

Copy link
Copy Markdown
Contributor Author

Hi @imDarshanGK i have raised a pr review it when u get chance thanks!!

@imDarshanGK imDarshanGK left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@Trishanthsai Contains unnecessary changes and leftover code. Keep the PR focused on the audit logging implementation, remove the extra changes, and share a screenshot or short video demonstrating the audit logging.

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.

Add audit logging to model switcher

2 participants