Skip to content

Implement Duplicate Upstream Prevention System

Summary

Implement a system to prevent the creation of duplicate upstreams within a top-level group, addressing storage inefficiencies and reducing configuration complexity.

Description

Currently, users can create multiple upstreams pointing to the same repository with identical credentials within a top-level group, leading to unnecessary storage usage and potential confusion. This feature will implement validation to prevent such duplicates while providing clear guidance to users.

Acceptance Criteria

Backend Implementation

  • Create unique constraint on (normalized_url_hash, credential_hash, top_level_group_id) in upstreams table
  • Modify upstream creation endpoint to return specific duplicate error with details
  • Return structured error response with duplicate details and suggested actions
    • Include reference to existing upstream in error payload
    • Provide clear error codes for different duplicate scenarios
  • Consider impact on existing installations with duplicates
  • Ensure migration path doesn't break existing virtual registries
  • Plan for edge cases with URL variations (www vs non-www, different ports, etc.)

UX/Design Requirements (ideas)

Upstream Creation Flow

  • Add real-time duplicate detection with inline warnings during URL input
    • Display "Similar upstream exists" warning with side-by-side comparison view
    • Provide "Use existing upstream" button as primary action when duplicate detected
    • Add connection test with clear status indicators and detailed feedback

Error States and Messaging

  • Design clear error message: "Duplicate upstream detected" with specific details
    • Include actionable options: "View existing", "Use existing", "Contact admin"
    • Add help text explaining why duplicates are prevented (storage efficiency)

Upstream Management Interface

  • Add duplicate status indicators in upstream list view
    • Create duplicate resolution workflow with merge/keep options
    • Show storage usage metrics and savings per upstream
    • Design bulk duplicate detection and resolution tools for admins

Existing Duplicate Handling

  • Create admin interface to identify and resolve existing duplicates
    • Design migration wizard to help consolidate duplicated upstreams
    • Add confirmation dialogs for destructive actions (merge, delete)
    • Show impact analysis before duplicate resolution (affected registries count)
Edited by Tim Rizzi