Skip to content

Validate duplicate repository routes while editing init profiles #392

Description

@rianjs

Problem

cr init lets users type automatic profile-selection routes while editing a review profile, but repository routes are exclusive today: one GitHub host/namespace/repo route resolves to exactly one profile.

That makes it too easy to enter a route that is already associated with another profile and believe both profiles are associated with that GitHub path. In practice, this can either fail later through config validation or move/overwrite the effective route ownership depending on the code path.

Concrete example from local config debugging:

  • codex-rianjs-bot owns github.com/open-cli-collective and github.com/rianjs.
  • claude-rianjs-bot uses the same repository access and reviewer entity, but has no routes.
  • While setting up or editing claude-rianjs-bot, typing those same routes should be rejected or clearly blocked because those routes are already owned by codex-rianjs-bot under current semantics.

Desired behavior

Add real-time validation to the init profile route editor so route entries cannot duplicate a route associated with another profile.

The validation should:

  • Allow routes already owned by the profile being edited.
  • Reject namespace routes already owned by a different profile, for example github.com/open-cli-collective.
  • Reject repo-specific routes already owned by a different profile, for example github.com/open-cli-collective/codereview-cli or github.com/open-cli-collective [codereview-cli].
  • Show an actionable field-level error that names the conflicting route and existing profile owner.
  • Preserve the current exclusive-route config model.

Notes

This is a UX validation issue, not a request to support overlapping profile routes. Overlapping routes should be handled separately.

Relevant areas likely include the init profile route field validation and the repository_profiles helpers around canonical route ownership.

Acceptance criteria

  • Tests cover same-profile route edits as valid.
  • Tests cover duplicate namespace routes owned by another profile as invalid.
  • Tests cover duplicate repo routes owned by another profile as invalid.
  • The error message identifies the conflicting route and owning profile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions