Inconsistent results on GraphQL aiUserMetrics when using default timeframe

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

aiUserMetrics query produces different results when used with the default date range. It has a default startDate to the beginning of the month and endDate to the end of the current month. https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/graphql/resolvers/analytics/ai_metrics/user_metrics_resolver.rb#L107

query {
  group(fullPath: "gitlab-org") {
	aiUserMetrics {
      nodes {
        user {
          username
        }
        
        totalEventCount
      }
    }
  }
}

If the same query is used for the same timeframe, but with startDate and endDate defined explicitly, the results will be different. Example query for the current month using arguments:

query {
  group(fullPath: "gitlab-org") {
    aiUserMetrics(startDate: "2026-02-01", endDate: "2026-02-28" ) {
      nodes {
        user {
          username
        }
        
        totalEventCount
      }
    }
  }
}

When the default query without arguments is executed, the timeframe is not passed to UserAddOnAssignmentsFinder, forcing it to call current_add_on_assigned_users instead of historical_add_on_assigned_users.

Edited by 🤖 GitLab Bot 🤖