Skip to content

Fix Web IDE usage counter

Issue: #555387+

What does this MR do and why?

This change modifies how GitLab tracks when users create code commits through the Web IDE (a browser-based code editor).

The updated logic checks three conditions before recording usage: there must be a valid authentication token, the Web IDE application must be properly configured in the system, and the token must belong specifically to the Web IDE application (not just any application).

why The Web IDE doesn't authenticate HTTP requests to the REST API using the session cookie anymore. It uses OAuth2 tokens and the requests originate on a separate domain as well therefore the session cookie is not available.

References

Screenshots or screen recordings

This change doesn't introduce user-facing changes.

How to set up and validate locally

There aren't behavior changes in this MR.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Duo Workflow Usage

I used Gitlab Duo Agentic Chat to write the test coverage for this change. This is the prompt that I used:

Modify the test in the file spec/requests/api/commits_spec.rb specifically in the context "when using access token authentication" such that it covers the modified behavior of the function track_commit_events in the file lib/api/commits.rb

Edited by Enrique Alcántara

Merge request reports

Loading