File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,8 +59,10 @@ def _warn_unmet_extension_dependencies(manager, manifest) -> None:
5959 extension_id = _escape_markup (dep ["id" ])
6060 reason = dep ["reason" ]
6161 # The remediation has to match the reason. `extension add` refuses an
62- # already-installed extension without --force, so suggesting it for a
63- # disabled or out-of-date one would hand the user a command that fails.
62+ # already-installed extension without --force, and `extension update`
63+ # only moves forward to the catalog release. A general PEP 440
64+ # constraint may require an exact version, an upper bound, or a
65+ # downgrade, so do not promise that update will satisfy it.
6466 if reason == "missing" :
6567 console .print (f" [yellow]{ extension_id } [/yellow] is not installed" )
6668 remedy = f"specify extension add { extension_id } "
@@ -73,7 +75,10 @@ def _warn_unmet_extension_dependencies(manager, manifest) -> None:
7375 f"{ _escape_markup (dep ['installed' ])} does not satisfy "
7476 f"{ _escape_markup (dep ['version' ])} "
7577 )
76- remedy = f"specify extension update { extension_id } "
78+ remedy = (
79+ "install a release of "
80+ f"{ extension_id } satisfying { _escape_markup (dep ['version' ])} "
81+ )
7782 console .print (f" Fix with: { remedy } " )
7883 console .print ()
7984 console .print (
Original file line number Diff line number Diff line change 4040 VALID_PRESET_TEMPLATE_TYPES,
4141)
4242from specify_cli.extensions import ExtensionRegistry
43+ from specify_cli._console import console
44+ from specify_cli.presets._commands import _warn_unmet_extension_dependencies
4345
4446
4547# ===== Fixtures =====
@@ -1245,6 +1247,25 @@ def test_unsatisfied_version_constraint_reports_both_versions(
12451247 assert unmet[0]["installed"] == "0.1.0"
12461248 assert unmet[0]["version"] == ">=9.0.0"
12471249
1250+ def test_version_warning_does_not_promise_update_satisfies_constraint(self):
1251+ """Version remediation must handle constraints update cannot guarantee."""
1252+ manager = MagicMock()
1253+ manager.find_unmet_extension_dependencies.return_value = [
1254+ {
1255+ "id": "speckit-inventory",
1256+ "reason": "version",
1257+ "installed": "3.0.0",
1258+ "version": "<2",
1259+ }
1260+ ]
1261+
1262+ with console.capture() as capture:
1263+ _warn_unmet_extension_dependencies(manager, MagicMock())
1264+
1265+ output = strip_ansi(capture.get())
1266+ assert "install a release of speckit-inventory satisfying <2" in output
1267+ assert "specify extension update" not in output
1268+
12481269 def test_optional_dependency_is_never_reported(
12491270 self, project_dir, temp_dir, valid_pack_data
12501271 ):
You can’t perform that action at this time.
0 commit comments