Safwan Ahmed activity https://gitlab.com/Saahmed 2026-03-18T00:25:15Z tag:gitlab.com,2026-03-18:5215243607 Safwan Ahmed pushed to project branch saf-fix-type-incompatibility-on-traversal-ids at GitLab.org / GitLab 2026-03-18T00:25:15Z Saahmed Safwan Ahmed

Safwan Ahmed (2ab7b36c) at 18 Mar 00:25

Fix bigint type incompatibility on traversal ids lookup

tag:gitlab.com,2026-03-17:5212672906 Safwan Ahmed commented on merge request !224540 at GitLab.org / GitLab 2026-03-17T12:41:41Z Saahmed Safwan Ahmed

Thanks for the work here @vyaklushin LGTM! 👍🏽. I was wondering if the main source of redundancy is overall_approver_ids. Given that we pass the same MR to all approval rules, and the MR model memoizes committer_ids_to_filter_from_approvers and committers_to_filter_from_approvers internally already

tag:gitlab.com,2026-03-17:5212671790 Safwan Ahmed approved merge request !224540: Extract shared approval context to reduce redundant computations at GitLab.org / GitLab 2026-03-17T12:41:28Z Saahmed Safwan Ahmed

What does this MR do and why?

Contributes to #589598

Problem

When evaluating approval rules for a merge request, each ApprovalWrappedRule independently computes overall_approver_ids and committer filtering data. This causes N redundant computations where N is the number of approval rules, leading to slow performance on MRs with many rules.

Solution

Introduce Approvals::Context class to hold pre-computed shared data across all approval rules. The context is created once in ApprovalState and passed through to wrapped rules, providing:

  • overall_approver_ids: Set of user IDs who approved the MR
  • committer_ids_for_filtering: Committer IDs for AR::Relation filter
  • committers_for_filtering: Committer users for Array filtering

References

Screenshots or screen recordings

N/A - Performance optimization with no UI changes.

How to set up and validate locally

  1. Create an MR with multiple approval rules (especially CODEOWNERS rules)
  2. Query the approvalSummary GraphQL endpoint
  3. Verify reduced CPU time compared to before this change

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.

tag:gitlab.com,2026-03-17:5212543717 Safwan Ahmed opened merge request !227645: Fix bigint type incompatibility on traversal ids lookup at GitLab.org / GitLab 2026-03-17T12:12:33Z Saahmed Safwan Ahmed

What does this MR do and why?

Follow up on !225446. It appears the namespace.traversal_ids datatype on local is bigint[] while on staging (and possibly other deployments) is int[]. This can lead to type incompatibility when comparing bigint[] and int[].

This MR puts an existing check into a utility method to determine the traversl_ids type, to help determine what to cast arguments to.

References

#585222

Screenshots or screen recordings

Before After

How to set up and validate locally

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.

tag:gitlab.com,2026-03-17:5212487901 Safwan Ahmed pushed new project branch saf-fix-type-incompatibility-on-traversal-ids at GitLab.org / GitLab 2026-03-17T12:00:03Z Saahmed Safwan Ahmed

Safwan Ahmed (7fd32478) at 17 Mar 12:00

Fix bigint type incompatibility on traversal ids lookup

tag:gitlab.com,2026-03-16:5209357252 Safwan Ahmed pushed to project branch saf-cache-list-group-mr-response at GitLab.org / GitLab 2026-03-16T17:07:15Z Saahmed Safwan Ahmed

Safwan Ahmed (ce9c501e) at 16 Mar 17:07

Revert spec

tag:gitlab.com,2026-03-16:5209297476 Safwan Ahmed commented on merge request !227171 at GitLab.org / GitLab 2026-03-16T16:51:30Z Saahmed Safwan Ahmed

👋🏿 @patrickbajao can I get a Merge Requests backend review on this please? Thanks!

Something to note:

I was going to query nil records as well, but it seems the flag would only be enabled when the backfill for IDs is complete right? Basing this on the changes in Make merge_request_diff_commits queries partiti... (!214768 - merged) also do not query nil records when the FF is enabled.

tag:gitlab.com,2026-03-16:5209226080 Safwan Ahmed commented on merge request !227171 at GitLab.org / GitLab 2026-03-16T16:33:42Z Saahmed Safwan Ahmed

Note

This is a literal command with the same query; AFAIK, it should not require a new plan.

tag:gitlab.com,2026-03-16:5209225653 Safwan Ahmed commented on merge request !227171 at GitLab.org / GitLab 2026-03-16T16:33:36Z Saahmed Safwan Ahmed

Note

This is a literal command with the same query; AFAIK, it should not require a new plan.

tag:gitlab.com,2026-03-16:5209190992 Safwan Ahmed commented on merge request !227171 at GitLab.org / GitLab 2026-03-16T16:25:03Z Saahmed Safwan Ahmed

Note

We want to decouple the flag from saving project_id.

See comment https://gitlab.com/gitlab-org/gitlab/-/work_items/527237#note_3141964530

tag:gitlab.com,2026-03-16:5208234136 Safwan Ahmed commented on merge request !227171 at GitLab.org / GitLab 2026-03-16T13:07:30Z Saahmed Safwan Ahmed

Note

Used in specs for the pre-backfill world, this will be removed along with diff_commit_without_metadata, when backfill is complete

tag:gitlab.com,2026-03-16:5208215576 Safwan Ahmed pushed to project branch saf-make-mr-diff-commits-association-partition-compatible at GitLab.org / GitLab 2026-03-16T13:03:36Z Saahmed Safwan Ahmed

Safwan Ahmed (0c8bb2b5) at 16 Mar 13:03

Make mr diff commits association partition compatible

tag:gitlab.com,2026-03-16:5208159052 Safwan Ahmed commented on merge request !225446 at GitLab.org / GitLab 2026-03-16T12:51:39Z Saahmed Safwan Ahmed

👋🏼 @egrieff I made some changes and the approvals reset, mind giving another look please? thanks!

tag:gitlab.com,2026-03-16:5207465024 Safwan Ahmed pushed to project branch saf-cache-list-group-mr-response at GitLab.org / GitLab 2026-03-16T10:17:21Z Saahmed Safwan Ahmed

Safwan Ahmed (f84c3ff9) at 16 Mar 10:17

Fix spec

... and 1360 more commits

tag:gitlab.com,2026-03-16:5207390903 Safwan Ahmed commented on merge request !225446 at GitLab.org / GitLab 2026-03-16T10:01:26Z Saahmed Safwan Ahmed

@tskorupa-gl I was thinking of not making it a scope now since it is experimental and may not yield the intended results. Keeping it in this class makes it local for now, I can move it when I can confirm it is stable, WDYT?

tag:gitlab.com,2026-03-16:5207385616 Safwan Ahmed commented on merge request !225446 at GitLab.org / GitLab 2026-03-16T10:00:18Z Saahmed Safwan Ahmed
      Project.joins(sql) # rubocop: disable CodeReuse/ActiveRecord -- Cleanup/make it a scope, when gitlab-org/gitlab#585222 is completed
tag:gitlab.com,2026-03-16:5207384916 Safwan Ahmed pushed to project branch saf-experiment-traversal-id-join-on-mrs at GitLab.org / GitLab 2026-03-16T10:00:09Z Saahmed Safwan Ahmed

Safwan Ahmed (36452294) at 16 Mar 10:00

Apply 1 suggestion(s) to 1 file(s)

tag:gitlab.com,2026-03-16:5207372845 Safwan Ahmed commented on merge request !225446 at GitLab.org / GitLab 2026-03-16T09:57:23Z Saahmed Safwan Ahmed
      Project.joins(sql) # rubocop: disable CodeReuse/ActiveRecord -- Cleanup/make it a cope, when gitlab-org/gitlab#585222 is completed
tag:gitlab.com,2026-03-16:5207372111 Safwan Ahmed pushed to project branch saf-experiment-traversal-id-join-on-mrs at GitLab.org / GitLab 2026-03-16T09:57:12Z Saahmed Safwan Ahmed

Safwan Ahmed (e529ee07) at 16 Mar 09:57

Apply 1 suggestion(s) to 1 file(s)