Gavin Hinfey approved merge request !231238: Use rapid_diffs_disabled query param for error recovery at GitLab.org / GitLab

Gavin Hinfey
2026-04-14T10:06:01Z

Summary

Improves Rapid Diffs error recovery and feature flag handling on MR diffs pages.

1. Error recovery preserves the user's cookie

Previously, when Rapid Diffs hit a server error, the rapid_diffs_enabled cookie was deleted entirely — forcing the user to manually re-enable Rapid Diffs. Now the cookie is preserved and the user is redirected with ?rapid_diffs_disabled=true, which temporarily falls back to legacy diffs for that page load only.

2. rapid_diffs_disabled=true query param is respected end-to-end

The ?rapid_diffs_disabled=true param was already used by the frontend (#visitLegacyDiffNote) but was never checked by the backend route constraint, the rapid_diffs_page_enabled? helper, or the frontend initialization. Now all three layers respect it, so visiting any MR diffs URL with this param reliably renders legacy diffs.

3. Feature flag disabled with stale cookie no longer 404s

If the rapid_diffs_on_mr_show feature flag is turned off while a user still has the rapid_diffs_enabled cookie set, they previously got a 404. Now the cookie is cleaned up and the user is redirected to legacy diffs seamlessly.

How to reproduce

Enable rapid_diffs_on_mr_show feature flag

Go to any merge request

Enable Rapid Diffs experience

Disable the feature flag

Reload merge request page

Observe the page to load properly

🤖 Generated with Claude Code