Backend: `Rules:Changes` not working when using triggers

Update

The issue was resolved when #293645 (closed) got implemented, please review the compare_to keyword

Summary

Using rules:changes does not process the changes as per expectation when using pipeline triggers

Steps to reproduce

  1. create a project with only a js folder
  2. create a gitlab-ci.yml file with the following content https://gitlab.com/haris.ali.khan/gitlab-ci-rules-testing/blob/dd08a97e7ef2f48faf50b2dc3bf39a430c7a5c51/.gitlab-ci.yml
  3. create 2 branches, one with changes inside the js folder and one with changed outside the js folder
  4. create a merge request and notice pipelines wont be run on the merge request creation.
  5. using curl, call the triggers api to run the pipeline for both the merge requests (https://docs.gitlab.com/ee/ci/triggers/#triggering-a-pipeline)
  6. notice the pipelines run for both the branches (one with the changes inside the js folder as well as the one with changes outside the js folder)

Example Project

Refer to the following repo: https://gitlab.com/haris.ali.khan/gitlab-ci-rules-testing/-/branches the rules: changes should only rule if any changes has been done in the js/**/* but it would still end up running if the changes have been done outside the js folder. Refer to the following Merge request created. After the MR were created, external apis we haris.ali.khan/gitlab-ci-rules-testing!7 haris.ali.khan/gitlab-ci-rules-testing!6

What is the current bug behavior?

Runs the pipeline despite the changes being outside the js folder

What is the expected correct behavior?

should run pipeline only when the changes submitted are inside the js folder. I know it mentions here https://docs.gitlab.com/ee/ci/yaml/#ruleschanges that the rules: changes only work with branch pipelines or merge request pipelines, but in this scenario it would end up running the pipelines twice which is not the intention.

Results of GitLab environment info

using the latest version of gitlab on web (14.1)

Edited by Dov Hershkovitch