diff --git a/src/python/controller/pair_context.py b/src/python/controller/pair_context.py index e96d21d6..c3805beb 100644 --- a/src/python/controller/pair_context.py +++ b/src/python/controller/pair_context.py @@ -138,27 +138,18 @@ def validate_config(context: Context) -> None: def configure_lftp(lftp: Lftp, config: Config) -> None: """Apply shared LFTP configuration settings. - The parallelism profile is protocol-aware: under ``ftps`` the validated - FTPS profile (file-level parallelism with pget-n low) is derived from the - protocol at apply-time, overriding the persisted SFTP-tuned values. This - closes the migration gap for upgraders and hand-edited configs that switch - to FTPS without retuning. Under ``sftp`` the persisted values pass through - unchanged (today's behavior). + Parallelism comes from the persisted Connections settings for both + protocols. FTPS previously overrode these with a fixed profile derived at + apply-time, which silently ignored the user's Connections settings (the + Settings UI showed values that were never applied); that override has been + removed so what the UI shows is what lftp runs. """ cfg = config.lftp lftp.num_parallel_jobs = cfg.num_max_parallel_downloads # type: ignore[assignment] - if cfg.protocol == "ftps": - # Validated FTPS profile (design §11.3): mirror:parallel-transfer-count=4, - # mirror:use-pget-n=1, pget:default-n=4, net:connection-limit=8. - lftp.num_parallel_files = 4 - lftp.num_connections_per_dir_file = 1 - lftp.num_connections_per_root_file = 4 - lftp.num_max_total_connections = 8 - else: - lftp.num_parallel_files = cfg.num_max_parallel_files_per_download # type: ignore[assignment] - lftp.num_connections_per_root_file = cfg.num_max_connections_per_root_file # type: ignore[assignment] - lftp.num_connections_per_dir_file = cfg.num_max_connections_per_dir_file # type: ignore[assignment] - lftp.num_max_total_connections = cfg.num_max_total_connections # type: ignore[assignment] + lftp.num_parallel_files = cfg.num_max_parallel_files_per_download # type: ignore[assignment] + lftp.num_connections_per_root_file = cfg.num_max_connections_per_root_file # type: ignore[assignment] + lftp.num_connections_per_dir_file = cfg.num_max_connections_per_dir_file # type: ignore[assignment] + lftp.num_max_total_connections = cfg.num_max_total_connections # type: ignore[assignment] lftp.use_temp_file = cfg.use_temp_file # type: ignore[assignment] lftp.temp_file_name = "*" + Constants.LFTP_TEMP_FILE_SUFFIX if cfg.net_limit_rate: diff --git a/src/python/tests/unittests/test_controller/test_pair_context.py b/src/python/tests/unittests/test_controller/test_pair_context.py index 23cab27a..98999aa0 100644 --- a/src/python/tests/unittests/test_controller/test_pair_context.py +++ b/src/python/tests/unittests/test_controller/test_pair_context.py @@ -313,14 +313,18 @@ def test_sftp_profile_passes_persisted_values_through(self): self.assertEqual(lftp.num_connections_per_dir_file, 20) self.assertEqual(lftp.num_max_total_connections, 0) - def test_ftps_profile_overrides_persisted_sftp_tuning(self): - """Under ftps, the validated FTPS profile (§11.3) is applied regardless of - the persisted SFTP-tuned values: parallel-files=4, use-pget-n=1, - pget:default-n=4, connection-limit=8.""" + def test_ftps_passes_persisted_values_through(self): + """Under ftps, persisted Connections values pass through unchanged. + + The former fixed FTPS profile (parallel-files=4, dir-pget=1, root-pget=4, + connection-limit=8) silently overrode the user's Connections settings; it + has been removed. The persisted values below are deliberately all distinct + from that old profile, so asserting they reach lftp proves the override is + gone. + """ lftp = MagicMock() config = Config() config.lftp.protocol = "ftps" - # Persisted SFTP-tuned values that should be overridden under ftps config.lftp.num_max_parallel_downloads = 2 config.lftp.num_max_parallel_files_per_download = 3 config.lftp.num_max_connections_per_root_file = 20 @@ -332,8 +336,8 @@ def test_ftps_profile_overrides_persisted_sftp_tuning(self): # num_parallel_jobs is protocol-agnostic (queue parallelism) self.assertEqual(lftp.num_parallel_jobs, 2) - # FTPS profile overrides - self.assertEqual(lftp.num_parallel_files, 4) - self.assertEqual(lftp.num_connections_per_dir_file, 1) - self.assertEqual(lftp.num_connections_per_root_file, 4) - self.assertEqual(lftp.num_max_total_connections, 8) + # Persisted Connections values reach lftp unchanged under ftps + self.assertEqual(lftp.num_parallel_files, 3) + self.assertEqual(lftp.num_connections_per_root_file, 20) + self.assertEqual(lftp.num_connections_per_dir_file, 20) + self.assertEqual(lftp.num_max_total_connections, 0)