Skip to content

App install: Handle invalid Git URLs better#426

Merged
danielhollas merged 9 commits into
aiidalab:mainfrom
danielhollas:fix/invalid-urls-raise
May 1, 2026
Merged

App install: Handle invalid Git URLs better#426
danielhollas merged 9 commits into
aiidalab:mainfrom
danielhollas:fix/invalid-urls-raise

Conversation

@danielhollas

@danielhollas danielhollas commented Apr 30, 2024

Copy link
Copy Markdown
Contributor

Closes #396

@codecov

codecov Bot commented Apr 30, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.22%. Comparing base (29badaa) to head (eb70e58).

Files with missing lines Patch % Lines
aiidalab/fetch.py 0.00% 3 Missing ⚠️
aiidalab/git_util.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #426      +/-   ##
==========================================
- Coverage   72.23%   72.22%   -0.02%     
==========================================
  Files          18       18              
  Lines        1628     1631       +3     
==========================================
+ Hits         1176     1178       +2     
- Misses        452      453       +1     
Flag Coverage Δ
py-3.12 72.22% <33.33%> (-0.02%) ⬇️
py-3.9 72.22% <33.33%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@danielhollas danielhollas force-pushed the fix/invalid-urls-raise branch from c188b1d to 45f3445 Compare April 30, 2024 13:23
@danielhollas danielhollas added the enhancement New feature or request label Jul 23, 2024
@danielhollas danielhollas force-pushed the fix/invalid-urls-raise branch from 7c9aa8e to 3481fe1 Compare October 11, 2024 14:48
@danielhollas danielhollas force-pushed the fix/invalid-urls-raise branch from 3481fe1 to 155061c Compare April 15, 2026 10:05
@danielhollas danielhollas changed the title Handle invalid URLs better App install: Handle invalid URLs better Apr 15, 2026
@danielhollas danielhollas marked this pull request as ready for review April 16, 2026 09:57

@edan-bainglass edan-bainglass left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Comment thread aiidalab/git_util.py
elif re.match(
"fatal: Invalid object name", error_message, flags=re.IGNORECASE
):
raise ValueError(f"Unknown commit: {self.commit}")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't know if the user was trying a specific commit, branch or tag so this error would be misleading.

@edan-bainglass

Copy link
Copy Markdown
Member

Hi @danielhollas. Where are we at on this one?

@danielhollas

danielhollas commented Apr 20, 2026 via email

Copy link
Copy Markdown
Contributor Author

@danielhollas

danielhollas commented Apr 20, 2026

Copy link
Copy Markdown
Contributor Author

@edan-bainglass can you take a look again. Now I actually catch the exception so that the user doesn't see the horrible stacktrace from #396, which I guess was the original motivation to open the issue.

$ aiidalab install aiidalab-ispg@git+https://github.com/ispg-group/aiidalab-ispg@invalid
Collecting apps matching requirements... \
Error: Unknown git reference: 'invalid'

Note the use of the term "git reference" because we don't know if the user meant to spell a branch, tag or a commit.

EDIT: The failing tests are due the registry

@danielhollas danielhollas changed the title App install: Handle invalid URLs better App install: Handle invalid Git URLs better Apr 20, 2026
@danielhollas danielhollas merged commit 60ccbc7 into aiidalab:main May 1, 2026
3 of 5 checks passed
@danielhollas danielhollas deleted the fix/invalid-urls-raise branch May 1, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aiidalab CLI raises when an invalid commit/branch is specified

2 participants