[go: up one dir, main page]

Skip to content

Fix "View details" functionality for branch rules with same names at group and project levels

Problem

When both group-level and project-level branch rules exist with the same name, clicking "View details" on either rule shows the same details page, making it impossible to distinguish between the two rules or view their actual individual settings.

Current Issues

  1. Ambiguous URL routing: The current URL structure (/branch_rules?branch=main) doesn't specify whether to show group-level or project-level rule details
  2. Backend confusion: The backend doesn't know which rule type to display, so it shows the same rule (likely the first one created) for both "View details" clicks
  3. User confusion: Users see duplicate branch rules in the list but can't access their individual settings

User Impact

From customer feedback in &17598 (comment 2631643552):

  • Large customers using both group-level and project-level protected branches lose visibility into actual rule configurations
  • Users cannot distinguish between inherited group rules and project-specific rules
  • The interface appears to show duplicates when rules have the same branch pattern

Proposed Solution

Phase 1: Fix URL routing and backend handling

  1. frontend:

    • Update "View details" links to include rule ID in URL: /branch_rules?branch=main&id=41
    • Pass rule type information (group vs project) to the backend
    • See PoC: !204837
  2. backend:

    • Update controller to handle the additional id parameter
    • Modify GraphQL API to accept rule type/ID to query the correct rule
    • Ensure the correct rule (group vs project) is returned based on the parameters

Phase 2: Improve UX for group-level rules

Option A: Redirect to group settings (Recommended)

  • When clicking "View details" on a group-level rule, redirect users to the group's protected branches settings
  • Provides users with the actual location where they can view/edit the rule
  • Maintains context and gives users a clear path forward

Option B: Disable group-level "View details"

  • Disable the "View details" button for group-level rules
  • Add tooltip explaining that group rules must be viewed at the group level
  • Less ideal as it doesn't provide a path forward for users

Additional Improvements

  • Add a "Group" badge/indicator next to group-level rules in the project's branch rules list
  • Ensure consistent behavior between the list view and details view

Acceptance Criteria

  • Clicking "View details" on a project-level branch rule shows the project-level rule details
  • Clicking "View details" on a group-level branch rule redirects to the group's protected branches settings
  • URL structure clearly identifies which rule is being viewed (include rule ID)
  • Backend correctly distinguishes between group and project rules
  • Group-level rules are visually distinguished in the branch rules list (badge/indicator)
  • No duplicate or incorrect rule details are shown

Technical Implementation Notes

From &17598 (comment 2745947439):

Required changes:

  1. Update frontend to append rule ID to details page URL: &id=41
  2. Pass rule type parameter to GraphQL API
  3. Update API to accept and use the new parameter when querying database
  4. Update controller to handle additional parameter

A proof of concept has been started showing the URL structure approach.

Related Issues

Labels

groupsource code sectiondev devopscreate Category:Source Code Management typebug prioritynormal

Edited by Paulina Sedlak-Jakubowska