DeadlineExceeded for large, non-LFS files in an MR can block "policy rules must be satisfied" check
### Summary
In this [internal customer report](https://gitlab.zendesk.com/agent/tickets/698299), the error message `Something went wrong on our end` on the `Changes` tab on an MR with many binary files, and under `Checking if merge request can be merged`, `All policy rules must be satisfied` never completed loading.
However, it was not clear _why_ the problem occured. Logs showed `grpc_status:4, grpc_message:"Deadline Exceeded"` (ca 10.sec, i.e. [the `fast` Gitaly timeout](https://docs.gitlab.com/18.7/administration/settings/gitaly_timeouts/#available-call-timeouts), but this should be surfaced to the user.
### Steps to reproduce
0. On a test instance (v18.7.2), create a non-admin user, a group, and a test project.
1. Fill the test project with a bunch of non-LFS but binary files. I used [this tool](https://gitlab.com/gitlab-com/support/toolbox/dotfiles/-/blob/main/scripts/generate_commits.rb)
```
gls_generate_commits --bytes=64M --number=12
gls_generate_commits --bytes=48M --number=12
gls_generate_commits --bytes=24M --number=12
gls_generate_commits --bytes=12M --number=12
gls_generate_commits --bytes=1M --number=12
git push -u origin main
# results in ca. 5GB large repo, probably larger than necessary
```
2. (optional) Reduce [Gitaly timeouts](https://docs.gitlab.com/18.7/administration/settings/gitaly_timeouts/#available-call-timeouts) to speed up the testing.
3. Create a `diff` in those binary files and a text file, a new branch and an MR.
```
date > README.md
for f in $(/bin/ls 12x-*/* | shuf); do echo "$(date +%s)" >> "$f" ; done
```
4. Observe that the MR diff does not load, banner `Something went wrong on our end. Please try again.` appears and logs show `GRPC::DeadlineExceeded`, but merging is possible.
5. Create the attached approval policy in the group, and repeat step 3, creating a new MR with the non-admin user. [approval_policy.yaml](/uploads/5046a1139151513ad68a59206074741b/approval_policy.yaml)
6. This time, `Something went wrong on our end.` is associated with endless spinning of `All policy rules must be satisfied`, which blocks merging.
{width=900 height=531}
**Workaround: Migrating all binary files to LFS resolved the problem.**
Interestingly, I was not able to reproduce this, when the admin user was the MR author :thinking:
### Example Project
<!-- If possible, please create an example project here on GitLab.com that exhibits the problematic
behavior, and link to it here in the bug report. If you are using an older version of GitLab, this
will also determine whether the bug is fixed in a more recent version. -->
### What is the current *bug* behavior?
See step 6. :arrow_up:
### What is the expected *correct* behavior?
1. Policy rules retrieval and check should not be affected by `DeadlineExceeded` for the MR's changed files.
2. Similarly to LFS files and very large diffs, the `Changes` tab should flag them as not displayable, and suggest `.diff` downloading or reviewing local with `git diff` or similar, but load the text diffs fine.
3. The `Something went wrong on our end` message should include back-end details, for searching known issues, GitLab forum, etc. or even pointer to the solutions `/help/topics/git/lfs/#migrate-an-existing-repository-to-git-lfs` or `/help/administration/settings/gitaly_timeouts/#available-call-timeouts`. In particular, I find `Please try again` misleading, because it's not clear why a repetition without any changes would yield a successful policy rules check.
### Relevant logs and/or screenshots
<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code
as it's tough to read otherwise. -->
### Output of checks
#### Results of GitLab environment info
<!-- Input any relevant GitLab environment information if needed. -->
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
# gitlab-rake gitlab:env:info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 3.2.8
Gem Version: 3.7.1
Bundler Version:2.7.1
Rake Version: 13.0.6
Redis Version: 7.2.11
Sidekiq Version:7.3.9
Go Version: unknown
GitLab information
Version: 18.7.2-ee
Revision: cb985c3c109
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 16.10
URL: https://gdk.test
HTTP Clone URL: https://gdk.test/some-group/some-project.git
SSH Clone URL: ssh://git@gdk.test:2222/some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 14.45.5
Repository storages:
- default: unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Gitaly
- default Address: unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 18.7.2
- default Git Version: 2.50.1
</pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 14.45.5 ? ... OK (14.45.5)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-shell-check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Database config exists? ... yes
Tables are truncated? ... skipped
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Cable config exists? ... yes
Resque config exists? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet)
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ...
2/1 ... yes
2/2 ... yes
Redis version >= 6.2.14? ... yes
Ruby version >= 3.0.6 ? ... yes (3.2.8)
Git user has default SSH configuration? ... yes
Active users: ... 2
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 7.x-9.x or OpenSearch version 1.x-3.x ... skipped (advanced search is disabled)
All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
</pre>
</details>
### Possible fixes
<!-- If you can, link to the line of code that might be responsible for the problem. -->
### Patch release information for backports
If the bug fix needs to be backported in a [patch release](https://handbook.gitlab.com/handbook/engineering/releases/patch-releases) to a version
under [the maintenance policy](https://docs.gitlab.com/policy/maintenance/), please follow the steps on the
[patch release runbook for GitLab engineers](https://gitlab.com/gitlab-org/release/docs/-/blob/master/general/patch/engineers.md).
Refer to the [internal "Release Information" dashboard](https://dashboards.gitlab.net/d/delivery-release_info/delivery3a-release-information?orgId=1)
for information about the next patch release, including the targeted versions, expected release date, and current status.
#### High-severity bug remediation
To remediate high-severity issues requiring an [internal release](https://handbook.gitlab.com/handbook/engineering/releases/internal-releases/) for single-tenant SaaS instances,
refer to the [internal release process for engineers](https://gitlab.com/gitlab-org/release/docs/-/blob/master/general/internal-releases/engineers.md?ref_type=heads).
issue