Read the audit trail card from aiGovernanceSessions behind a flag

What does this MR do and why?

The AI Governance dashboard is moving from Duo workflow data to the new ai_governance_sessions table (#630706+s). This MR updates the "Most recent sessions" (audit trail) card to read from the new aiGovernanceSessions GraphQL field behind a shared flag, keeping today's behaviour when the flag is off.

  • Behind the flag, the card queries aiGovernanceSessions for the group or project instead of duoWorkflowSessionArtifacts.
  • Row titles show the session id (sessionId) and flow type. Sessions from external agents have no flow type, so the source name is shown instead (GitLab Duo, Claude Code (Compliance API), Claude Code (glab)).
  • Each row shows its source label.
  • Row links open the audit events tab. Duo rows pass their workflow id (sessionId), which is what the tab's drawer matches today. External rows link to the tab without a session, since the drawer cannot show them until #630785+s lands.
  • The new type has no auditEventsCount yet (#630095+s), so rows show the source label in that spot until the count lands.
  • Adds two query files under ee/app/assets/javascripts/ai/governance/graphql/queries, a SESSION_SOURCE_LABELS constant, and pushes the flag from both governance controllers.

Feature flag

Frontend and backend share one flag, ai_governance_sessions_api (#630933+s). It is off by default, so the card keeps using duoWorkflowSessionArtifacts until the flag is enabled. The flag definition comes from Add aiGovernanceSessions GraphQL field (!257545 - merged), which is merged.

Open question

When #630785+s moves the audit events tab to aiGovernanceSessions, the drawer will match the session row id instead of the workflow id, and the link parameter here moves with it. Both are behind the same flag; the two MRs should land close together.

Depends on

Screenshots

Captured against Add aiGovernanceSessions GraphQL field (!257545 - merged) • Hitesh Raghuvanshi • 19.5 with the flag on. Group and project names are masked.

Card, flag on Duo row click (drawer opens) Claude Code row click (tab, no drawer)
after-card after-duo-click after-claude-click

How to validate

ee/spec/frontend/ai/governance/components/dashboard/cards/audit_trail_card_spec.js, extended with four flag-on cases. The flag is off by default.

Edited by Dheeraj Joshi

Merge request reports

Loading
Loading