Repository navigation
Implement app reinstall button - #250
Conversation
|
@edan-bainglass I checked Support scope clarified: our work targets This UI still needs to ship with the backend change in aiidalab/aiidalab#537, as the PR description already states: the current released v26.09.0 does not yet contain The core-dependency protection remains a shared prerequisite. Reinstall is enabled even when the installed app has an incompatibility warning. That is appropriate for repairing missing ordinary dependencies, but the backend must reject conflicts with protected core packages before invoking pip. This protects the supported modern environment from being downgraded; it does not require supporting an older environment. Details and the intercepted-pip reproduction are in the review on aiidalab/aiidalab#537; this is the same finding, not an additional independent backend issue. The added browser assertion only checks that the button exists. A callback test using the supported backend, covering a successful reinstall and an installation error, would help. Validation on Python 3.12 / ipywidgets 8.1.8: with the new backend, widget probes passed for installed/uninstalled and busy states, locally modified/unregistered apps, a real button click forwarding the log output, success reporting, pip-error reporting with the diagnostic log retained, post-install-error reporting, and button recovery after failures. Installation and hook calls were intercepted; no live apps, packages, or daemon state were changed. All existing GitHub checks are green; I did not rerun the browser suite locally. |
|
@cpignedoli please re-review 🙏 |
There was a problem hiding this comment.
Thanks, Edan! I re-reviewed 16f6a16 with Codex assistance against the backend in aiidalab/aiidalab#537 (748bdcc). The core-compatibility condition addresses the earlier concern while keeping missing ordinary dependencies repairable. Widget probes passed for enable/disable behavior, output forwarding, success/error reporting, retained error logs, and requirements changed after the button was enabled. CI is green. This should ship together with the backend change, as documented.
One non-blocking suggestion is to add callback coverage alongside the browser button-presence check. Here is a compact example for tests/test_app_manager.py; I ran this exact snippet locally and all three cases passed. It isolates the callback with a mocked installer and the real log widget. Button enable/disable behavior would be a separate widget test.
Test example: success, pip failure and post-install failure
from subprocess import CalledProcessError
from types import SimpleNamespace
from unittest.mock import Mock
import pytest
from home.app_manager import AppManagerWidget
from home.widgets import LogOutputWidget
@pytest.mark.parametrize(
"error",
[None, RuntimeError("pip failed"), CalledProcessError(1, "post_install")],
ids=["success", "pip-failure", "post-install-failure"],
)
def test_reinstall_callback(error):
log = LogOutputWidget()
def reinstall(*, stdout):
assert stdout is log
stdout.write("installation output\n")
if error is not None:
raise error
app = SimpleNamespace(reinstall_app=Mock(side_effect=reinstall))
manager = SimpleNamespace(
app=app,
dependencies_log=log,
_show_msg_success=Mock(),
_show_msg_failure=Mock(),
)
try:
AppManagerWidget._reinstall_app(manager, None)
app.reinstall_app.assert_called_once_with(stdout=log)
if error is None:
manager._show_msg_success.assert_called_once_with("Reinstalled app.")
manager._show_msg_failure.assert_not_called()
assert log.value == ""
else:
manager._show_msg_failure.assert_called_once_with(str(error))
manager._show_msg_success.assert_not_called()
assert log.value == "installation output\n"
finally:
log.close()Local check: pytest -q --noconftest /tmp/test_aiidalab_home_pr250_callback_review.py — 3 passed on Python 3.12 / ipywidgets 8.1.8, with the reviewed checkouts on the import path. --noconftest avoids the unrelated repository-wide PostgreSQL fixture setup; the example itself needs no database and performs no installation.
Looks good to me!
1de315a to
9db9fe6
Compare
There was a problem hiding this comment.
Nice, thanks!
I've tested this with my app: re-install works, and button is disabled if the core dependencies are not satisfied.
There was a problem hiding this comment.
Actually noticed one thing, the log must be cleared at the beginning, because it may contain stuff from previous (failed) install / re-install.
We should expand our app manager testing suite!
436fd70 to
d91a363
Compare
Hmm, I was testing this with the latest changes and for some reason the log is not being cleared in the UI when I click the re-install button. @edan-bainglass can you please test? Here's my testing procedure:
|
Hi @danielhollas. I'm getting around to this now. Quick question - I'm a bit confused at your testing procedure, as pip would install from pypi, not local. Did you modify the app to point to your local environment for the installation? |
|
I have modified the setup.cfg file in an already installed app (e.g. Does that answer your question? |
Thanks @danielhollas. I missed that we run |
|
Thanks. Can you make a quick screencast just to make sure we're looking at the same thing? (it is very possible that the issue occurs only in my old Firefox version, I'll also try to test on chromium). I think the clear button would be an overkill for now, since this is only a problem in the error path. If it turns out the issue happens only in my browser I am happy to merge this as is. |
appstore-reinstall.mp4Tested on Chrome
Sure 🙂 |
There was a problem hiding this comment.
Alright, I've re-tested on both Firefox and Chromium and it works, I am not sure what I was doing before. Sorry for the noise, let's merge! 🚀
Closes #245
Implements the button trigger the logic implemented in aiidalab/aiidalab#537 for reinstalling apps.