Skip to content

Fix project repository mapping validation - #1527

Merged
skyfallwastaken merged 3 commits into
mainfrom
fix/project-repo-mapping-validation
Aug 6, 2026
Merged

Fix project repository mapping validation#1527
skyfallwastaken merged 3 commits into
mainfrom
fix/project-repo-mapping-validation

Conversation

@skyfallwastaken

@skyfallwastaken skyfallwastaken commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary of the problem

  • Failed repo updates show a legacy ERB page instead of returning to the project card. To make matters worse, the legacy page doesn't even work!

Describe your changes

  • Replace the git ls-remote check with authenticated GitHub API verification
  • Verify repository URLs only when they are initially set or changed, avoiding network calls during archive/unarchive
  • Return validation errors to the editor in the project card, while preserving archived and interval-filtered project pages
  • Remove the obsolete standalone edit route, action, template, generated route export, and unused GitRemote helper

Tests

Added model coverage for:

  • successful GitHub verification using the reported public repository
  • definitive missing/inaccessible responses
  • private repositories hidden from limited OAuth scopes
  • GitHub 5xx and TLS failures
  • avoiding verification on unrelated mapping updates

Screenshots / Media

Project repository mapping validation before and after

Before: validation fell through to the obsolete standalone ERB page. After: the error stays with the inline editor on the project card.

Copilot AI review requested due to automatic review settings August 6, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces shell-based repository checks with authenticated GitHub API validation and keeps failed mapping edits in the inline project-card workflow.

  • Verifies changed GitHub repository URLs while treating temporary API and TLS failures as inconclusive.
  • Redirects validation failures back to the referring projects view with the submitted URL and project identity.
  • Reopens the matching card editor, displays its validation error, and preserves the submitted value.
  • Removes the obsolete standalone edit route, template, route export, and GitRemote helper.
  • Adds controller and model coverage for validation outcomes and unrelated mapping updates.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported closed-editor behavior is addressed by restoring the affected editor and submitted URL from the redirected validation props.

Important Files Changed

Filename Overview
app/controllers/my/project_repo_mappings_controller.rb Redirects failed updates back to the originating projects page with enough Inertia error state to restore the matching inline editor.
app/javascript/pages/Projects/Index.svelte Uses returned validation state to reopen the affected project card and restore the submitted repository URL, resolving the prior feedback.
app/javascript/pages/Projects/components/ProjectCard.svelte Displays repository validation errors inside the editor and closes the editor after successful submission.
app/models/project_repo_mapping.rb Restricts remote verification to new or changed repository URLs and delegates existence checks through the repository-host service.
app/services/repo_host/github_service.rb Adds authenticated GitHub repository verification with graceful handling for limited scopes and transient failures.
config/routes.rb Removes the obsolete edit action while retaining the resource-based update route.
test/controllers/my/project_repo_mappings_controller_test.rb Covers preservation of the referring projects page and returned inline validation state.
test/models/project_repo_mapping_test.rb Covers successful, inaccessible, private, transient-failure, TLS-failure, and unchanged-URL validation paths.

Sequence Diagram

sequenceDiagram
  participant User
  participant Card as ProjectCard
  participant Controller as ProjectRepoMappingsController
  participant Model as ProjectRepoMapping
  participant GitHub
  participant Page as Projects/Index

  User->>Card: Submit repository URL
  Card->>Controller: PATCH mapping
  Controller->>Model: Update mapping
  Model->>GitHub: Verify changed repository URL
  alt Repository verified or verification inconclusive
    Model-->>Controller: Valid
    Controller-->>Page: Redirect with success
    Page-->>Card: Close editor
  else Repository definitively inaccessible
    Model-->>Controller: Validation error
    Controller-->>Page: Redirect back with error, project name, and submitted URL
    Page-->>Card: Reopen matching editor and display error
  end
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/project-rep..." | Re-trigger Greptile

@skyfallwastaken
skyfallwastaken enabled auto-merge (squash) August 6, 2026 09:15
@skyfallwastaken
skyfallwastaken merged commit 707c42b into main Aug 6, 2026
19 checks passed
@skyfallwastaken
skyfallwastaken deleted the fix/project-repo-mapping-validation branch August 6, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants