Skip to content

fix: display errors when adding a new repo #1120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

andypols
Copy link
Contributor

@andypols andypols commented Jul 26, 2025

Summary

This PR fixes a bug where the client silently ignored server-side errors when adding a new repository. As a result, users were led to believe the repository was added successfully, only to see it disappear upon refreshing the page.

Root Cause

The NewRepo.tsx component (src/ui/views/RepoList/Components/NewRepo.tsx) always closed the modal, regardless of whether the server request succeeded or failed.

Fix

Display server errors returned by addRepo in src/ui/services/repo.js.

Extended Cypress tests to:

  • Reproduce the bug.
  • Verify the fix.
  • Upgraded Cypress to version 14.5.2.
  • Added data-testid attributes to improve selector stability in Cypress tests (avoids coupling to CSS/JS changes). These are are also useful in the react unit tests (see note)
  • added a regular (non-admin) user for the cypress tests.
  • added cypress tests to ensure anonymous and regular users cannot add a repository.
  • added a cypress test to ensure an admin can successfully add and delete a repository.
  • added a cypress tests that displays an error if tries to add a duplicate repository.

Notes

Adding unit tests for the React components is desirable but considered out of scope for this PR.

Copy link

netlify bot commented Jul 26, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 65b93b3
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6894669f7963b20008524b93

@andypols andypols changed the title Fix display repo add errors fix: display errors when adding a new repo Jul 26, 2025
@github-actions github-actions bot added the fix label Jul 26, 2025
Copy link

codecov bot commented Jul 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (6bdf166) to head (65b93b3).
⚠️ Report is 72 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1120      +/-   ##
==========================================
+ Coverage   79.62%   81.30%   +1.67%     
==========================================
  Files          59       59              
  Lines        2479     2461      -18     
  Branches      289      279      -10     
==========================================
+ Hits         1974     2001      +27     
+ Misses        461      416      -45     
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andypols andypols requested a review from jescalada August 1, 2025 15:43
Copy link
Contributor

@jescalada jescalada left a comment

Choose a reason for hiding this comment

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

@andypols Looks great, thanks for the contribution! 🚀

Our E2E tests are pretty barebones so any improvements here are much appreciated! I just have some minor things to point out - will likely open a few issues for these!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants