Skip disabled plugin binary checks in version

This commit is contained in:
Nick Sweeting 2026-06-24 09:51:28 -07:00
parent 1d70e5a4bc
commit 3fa3794bf3
No known key found for this signature in database
2 changed files with 26 additions and 2 deletions

View File

@ -355,13 +355,19 @@ def version(
):
continue
any_rows = True
installed = db_binaries.get(logical_name) if db_available else None
if _binary_record_matches_runtime(installed, config.ABXPKG_LIB_DIR):
abspath = installed.abspath
version_str = (installed.version or "unknown")[:15]
provider = (installed.binprovider or "env")[:8]
valid = True
elif not plugin_enabled and not requested_names:
# `archivebox version` is expected to verify the active runtime, not
# cold-load every optional plugin provider. Migration and status
# checks often run with PLUGINS narrowed to a tiny set; resolving
# disabled plugin binaries there can spend most of the command on
# providers the current collection will never execute.
continue
else:
loaded = load_binary(actual_record)
abspath = str(loaded.loaded_abspath or "")
@ -369,6 +375,7 @@ def version(
provider = (loaded.loaded_binprovider.name if loaded.loaded_binprovider else "env")[:8]
valid = loaded.is_valid
any_rows = True
if valid:
display_path = (
_format_binary_abspath(

View File

@ -10,7 +10,7 @@ import tempfile
from pathlib import Path
from archivebox.config.paths import tmp_dir_socket_path_is_short_enough
from archivebox.cli.archivebox_version import _binary_row_dedupe_key
from archivebox.tests.conftest import run_archivebox_cmd
from archivebox.tests.conftest import cli_env, run_archivebox_cmd
def _make_deep_collection_dir(tmp_path: Path) -> Path:
@ -126,6 +126,23 @@ def test_version_shows_binaries_after_init(tmp_path, initialized_archive):
assert "Binary" in output or "Dependencies" in output
def test_version_skips_disabled_plugin_binary_resolution(tmp_path):
"""Disabled plugins should not trigger live binary detection during version."""
data_dir = tmp_path / "no-plugins"
data_dir.mkdir()
env = cli_env(PLUGINS="__archivebox_test_no_plugins__")
init_result = run_archivebox_cmd(["init"], cwd=data_dir, env=env)
assert init_result.returncode == 0, init_result.stderr
version_result = run_archivebox_cmd(["version"], cwd=data_dir, env=env)
output = version_result.stdout + version_result.stderr
assert version_result.returncode == 0, output
assert "No required binaries declared for discovered plugins" in output
assert "not installed" not in output
def test_version_shows_data_locations(tmp_path, initialized_archive):
"""Test that version shows data directory locations."""
result = run_archivebox_cmd(["version"])