Repository navigation
Implement app reinstall feature - #537
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #537 +/- ##
==========================================
+ Coverage 74.39% 75.95% +1.55%
==========================================
Files 18 18
Lines 1738 1759 +21
==========================================
+ Hits 1293 1336 +43
+ Misses 445 423 -22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@edan-bainglass I have seen this working and the normal path looks good. A closer review of Support scope clarified: our work targets
Validation on Python 3.12: 17 tests passed across |
|
@edan-bainglass could you sanity-check my review above and the related comment on aiidalab/aiidalab-home#250? I may have expanded the scope beyond what these PRs need. Our intended environment is Are the core-dependency guard and refresh-after-failure suggestions appropriate here, or do they concern existing installation behavior that should be handled separately? In particular, is protection against an app changing core packages already enforced elsewhere? A possible approach discussed with Codex was to constrain the installed versions of protected packages during app installation, including indirect dependencies, and handle platform upgrades separately. Does that fit AiiDAlab's intended policy, or would it be too restrictive? Please treat my earlier “before approval” wording as a point for discussion pending your assessment, rather than a demand to add that broader policy to this PR. The normal reinstall path worked in the checks. |
Yeah, we should definitely check agains core dependencies before allowing re-install. If the core deps are incompatible, the re-install button must be disabled. This is especially important for the use-case we're targetting, where a user changes their underlying image so the app can suddenly become incompatible. |
286d1eb to
f6e2b46
Compare
|
@cpignedoli please re-review 🙏 |
There was a problem hiding this comment.
Thanks! Couple quick comments.
|
|
||
| def test_reinstall_app_rejects_core_dependency_conflict(generate_app, monkeypatch): | ||
| app = generate_app() | ||
| monkeypatch.setattr(app._app, "core_dependencies_met", lambda: False) |
There was a problem hiding this comment.
Instead of monkeypatching, let's have an app that has a dependencies that actually do not meet out mocked out environment, e.g. have it depend on aiida-core 1.x. Have a look in conftest.py
There was a problem hiding this comment.
I'm not fully convinced the second iteration over this test achieved what you had in mind. Happy to iterate once more if needed 🙂
There was a problem hiding this comment.
Thanks, Edan! I re-reviewed 748bdcc with Codex assistance. Both earlier concerns are addressed: reinstall checks local core requirements while allowing missing ordinary dependencies to be repaired, and failure cleanup clears the cache and refreshes state without masking the original error. The companion button behavior in aiidalab/aiidalab-home#250 also checked out.
Validation on Python 3.12: 19 repository tests passed, plus all 20 additional failure-path and widget probes. The one local test_prereleases failure reproduces identically on the exact base and is unrelated. Installation, daemon and hook subprocess calls were intercepted; no installed packages were changed. GitHub checks are green.
I agree that broader installation-policy hardening can be handled separately. Looks good to me!
|
@danielhollas can you kindly address the recent changes and confirm/object w.r.t your earlier request for changes? 🙏 |
|
Yes, but not on a Sunday ;-) Want to review aiidalab-home changes as well and do some testing. Thanks for all your work on this! |
It's Monday 🙂 |
There was a problem hiding this comment.
Thanks!
I am a little confused about the error handling, see comments inline. I also think there's a bit too much mocking in the tests and we can do a bit better.
By the way, have you tested manually what happens in the UI during various error conditions, e.g. when a pip install or post_install fails?
| monkeypatch.setattr( | ||
| app._app, | ||
| "_post_install_triggers", | ||
| lambda: calls.append(("post_install",)), | ||
| ) |
There was a problem hiding this comment.
Let's not mock this, you can instead create an actual post_install bash script, e.g.
#/bin/bash
echo "Hello from post_install script"You can then capture a log output to verify that the _post_install_triggers function was called.
| monkeypatch.setattr( | ||
| app._app, | ||
| "_install_dependencies", | ||
| lambda python_bin, stdout: calls.append(("install", python_bin, stdout)), | ||
There was a problem hiding this comment.
I think this mocking is too high-level and makes the test super weak. We can instead run the actual _install_dependencies function and mock only the run_pip_install.
| def fail_post_install(): | ||
| raise CalledProcessError(1, "post_install") |
There was a problem hiding this comment.
Here again we can have a better test fidelity by actually creating a failing post_install script
#!/bin/bash
echo "Hello from failing post_install script"
exit 1
Thanks @danielhollas. I'll address your comments.
Not via the UI. I'll see what I can do. |
d3b9f71 to
9ae0a09
Compare
There was a problem hiding this comment.
Thanks @edan-bainglass!
I'd still like to understand the exact purpose and semantics of .aiidalab but that is independent of this PR.
|
@danielhollas FYI, I accidently clicked merged halfway through editing the commit message. If crucial, I can do surgery. Otherwise, I can also add the missing part to the stacked PR (#542), but maybe that's more confusing than helpful. One note regarding stacked PRs, they are a bit confusing and can cause a mess. As I found out elsewhere, merging the head will merge the entire stack, without allowing you to provide any form of commit messages along the way. Not great 😵💫 |
|
No worries, thanks for letting us know. "App reinstall feature" is clear enough, and the commit is linked to this PR for more context.
Yeah, I noticed that as well, very annoying. |
This PR provides support for the corresponding button requested in aiidalab/aiidalab-home#245.